Search code examples
typescriptsqliterustdatabase-connectiontauri

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.


Solution

  • 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.