π Building a Tauri v2 + Drizzle + SQLite App β Starter Template
A complete starter template using Tauri v2, Drizzle ORM, and SQLite β with proxy-based queries, live previews, and working fullstack setup. No backend server needed.
β Unlike older tutorials, this one uses Tauri v2 and solves the JSON + proxy adapter problem.
π¦ Whatβs Inside?
- 𧬠Drizzle ORM (sqlite-proxy mode)
- π§± SQLite for local database
- β‘ Tauri v2 for native UI
- π Auto migrations on dev start
- π§ͺ Working nested relations (Drizzle
with:
support)
π§βπ» Getting Started
git clone https://github.com/meditto/tauri-drizzle-proxy
cd tauri-drizzle-proxy
pnpm install
pnpm tauri dev
First time you run it, all migrations will run automatically.
π§ If you modify your schema, run:
pnpm db:generate
π§ How It Works
Drizzle ORM runs in sqlite-proxy
mode. All SQL is sent to the Tauri backend via a custom run_sql
command. The backend uses sqlx
to execute the query and return JSON to your UI.
This repo adds:
- β SQL type fallback for handling subqueries + JSON columns
- β
Custom SQLite row adapter to handle nested
.with()
queries - β Logs & dev-friendly debug output
π οΈ Tech Stack
Layer | Tech |
---|---|
UI | React + Vite |
ORM | Drizzle ORM |
Database | SQLite |
Backend | Rust (sqlx ) |
Shell | Tauri v2 |
π‘ What Was Fixed (vs Previous Attempts)
Previous attempts to integrate Drizzle ORM with Tauri (such as tauri-drizzle-sqlite-proxy-demo) relied entirely on the tauri-plugin-sql
to run queries. This led to issues with relation loadingβespecially when returning empty records with nested relations.
This project takes a different approach:
- β
It uses
tauri-plugin-sql
only for database creation and migrations. - β
It implements a custom Rust SQL proxy using
sqlx
, giving full control over query execution and serialization. - β
It includes a workaround for Drizzle ORM's limitation: when a
get
query returns an empty array, we return an empty object to avoid breaking relation parsing.
This design ensures full relation support and reliable query behavior in a Tauri + Drizzle + SQLite environment.
π Repo
π https://github.com/meditto/tauri-drizzle-proxy
Let me know if you have questions or want to contribute. Star the repo if it helped you!
Top comments (0)