This template should help get you started developing completely local, cross-platform desktop apps.
bun i
bunx tauri dev
By default, tauri-template
comes with an embedded SQLite database named tauri-template.db
.
You can override this with the following steps:
-
Choose between
SQLite
orPostgreSQL
-
Set
DATABASE_URL
insrc-tauri/.env
:sqlite:<name>.db
for SQLitepostgres://postgres@localhost/<name>
for Postgres (or cloud-hosted URL) -
sqlx migrate add <name>
creates a migration file inmigrations/<timestamp>-<name>.sql
. Run this command insrc-tauri/
Add your database schema changes here. -
Next time you restart your app, your migrations will be applied.
sqlx migrate run
applies your migrations manually.
Go here for information on migration reverts.
Rust does not support cetain database types. You must create serializers for those data types. Read here for Sqlite and here for Postgres.
You can look here for an example on how to serialize Postgres Numeric
and Date
types in Rust using the time
and rust_decimal
crates.
bun run tauri build
Rust Rover - this is the default recommendation. It is free for non-commercial use.
VS Code - install all the recommendations from .vscode/extensions.json
. This should be an automatic popup.
Easiest way to use Postgres on Mac is Postgres.app