Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Create SQLite database in a tauri TS app?

Docs of tauri are still trash. I can only find tutorials in the internet about setting up a node ts server for web projects with sqlite. Does anybody know how I can do that? Assuming a boilerplate app that gets generated in the beginning after setup quick start guide. Where am I supposed to create the db? In the tauri rust or ts part?

I wan't to store passwords in the database because I'm building a password generator.

like image 471
Maksim Momcilovic Avatar asked Sep 19 '25 08:09

Maksim Momcilovic


2 Answers

Where am I supposed to create the db? In the tauri rust or ts part?

From the tauri docs:

Tauri is a framework for building tiny, blazing fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.

The TS part is meant to handle your frontend-related stuff, invoking Tauri commands, which are basically Rust functions. To answer your question, you should handle database interactions in the Rust part of your Tauri app, exposing an API that can be used by the TS part of your app that handles rendering the data.

like image 51
Jonas Fassbender Avatar answered Sep 22 '25 06:09

Jonas Fassbender


Tauri has an official plugin tauri-plugin-sql for managing database operations, whether you plan on using sqlite, mysql or postgres. I'd look into it: https://github.com/tauri-apps/tauri-plugin-sql

like image 27
thib Avatar answered Sep 22 '25 05:09

thib