A Tauri 2 starter for desktop SaaS apps. Sign-in, secure token storage, per-user local data and a backend are already built and tested, so you can start on your product.
MIT · Tauri 2 · React · TypeScript · work in progress
Why this exists
Every desktop SaaS needs the same first month of work: sign-in, a safe place for tokens, a local database, a backend that keeps users apart, updates, releases. This repo does that part once, with rules that keep it clean as you add features.
It is opinionated and small on purpose. You can read the whole thing.
Status
Built from docs/PRD.md in milestones. Each one is reviewed
before the next starts.
| # | Milestone | State |
|---|---|---|
| M0 | Monorepo, tooling, lint-enforced architecture | Done |
| M1 | App shell: routing, theming, settings, command palette | Done |
| M2 | Config, logging, typed IPC, OS keychain, ports | Done |
| M3 | Auth: email + Google, JWT, deep-link OAuth | Done* |
| M4 | Per-user SQLite, migrations, notes example, API | Done |
| M5 | Feature flags (PostHog) | Done |
| M6 | Billing and licensing | Done |
| M7 | Crash reporting and analytics with consent | Done |
| M8 | Tray, shortcuts, single instance, auto-update | Done |
| M9 | CI, end-to-end tests, signed releases | Done |
| M10 | Rename script, feature generator, setup docs | Planned |
* The Google sign-in logic is tested, but the live OAuth round trip has not
been run yet. See docs/deferred-checks.md for
everything that still needs a human.
What is in it today
- Desktop shell: Tauri 2, React, TanStack Router and Query, Tailwind v4, shadcn/ui, light/dark theme that also drives the native title bar.
- Auth: Better Auth running in your own API. Short-lived JWT access tokens, tokens stored only in the OS keychain, PKCE-bound deep-link OAuth.
- Per-user data: structured records only. One SQLite file per user on the desktop, and a Postgres backend where every query is scoped to the verified user. There is no file or blob storage.
- Typed IPC: Rust commands are exported to TypeScript, no hand-written
invoke("string")calls. - Ports and adapters: auth, database, secrets, logging, billing and the rest sit behind interfaces. Swapping a vendor means writing one adapter.
- Architecture checks: import rules are lint errors, not guidelines.
The notes feature is an example that exercises the whole stack. Delete it when you start a real product (see Make it yours).
How it fits together
%%{init: {'theme':'base','themeVariables':{'fontSize':'15px','lineColor':'#22c55e','edgeLabelBackground':'#f5f5f5'}}}%%
flowchart LR
subgraph Desktop["Desktop app (Tauri 2)"]
UI("React UI<br/>routes and features") --> Ports("Ports<br/>interfaces")
Ports --> Adapters("Adapters<br/>auth, storage, logging")
Adapters --> Rust("Rust shell<br/>typed IPC")
Rust --> SQLite[("SQLite<br/>one file per user")]
Rust --> Keychain[("OS keychain<br/>tokens")]
end
Adapters -- "HTTPS + JWT" --> API
subgraph Server["Server"]
API("Hono API<br/>Better Auth, requireAuth, notes") --> PG[("Postgres<br/>Drizzle")]
end
classDef app fill:#0a0a0a,stroke:#39ff14,stroke-width:2px,color:#f5f5f5
classDef server fill:#0a0a0a,stroke:#f5f5f5,stroke-width:2px,color:#f5f5f5
classDef store fill:#0a0a0a,stroke:#39ff14,stroke-width:4px,color:#f5f5f5
class UI,Ports,Adapters,Rust app
class API server
class SQLite,Keychain,PG store
style Desktop fill:#141414,stroke:#39ff14,stroke-width:2px,color:#39ff14
style Server fill:#141414,stroke:#f5f5f5,stroke-width:2px,color:#f5f5f5
linkStyle default stroke:#22c55e,stroke-width:2px
Repo layout
apps/
desktop/ Tauri app
src/
app/ providers, router, layout
routes/ file-based routes
features/ one folder per feature (auth, notes, settings)
ports/ interfaces, plus adapters/ (vendor code lives only here)
shared/ ui, lib, i18n
src-tauri/ Rust: commands, keychain, SQLite migrations
api/ Hono API: Better Auth, notes, Drizzle schema
packages/
shared/ Zod schemas and types used by both apps
config/ ESLint (with the architecture rules), TS, Prettier
docs/ PRD, milestones, decisions, setup guides
Stack
| Area | Choice |
|---|---|
| Shell | Tauri 2 |
| UI | React, TypeScript (strict), Vite, Tailwind v4, shadcn/ui |
| Routing and data | TanStack Router, TanStack Query, Zustand, Zod |
| API | Hono, Better Auth, Drizzle |
| Databases | Postgres (server, any host), SQLite (desktop) |
| Tooling | pnpm workspaces, Turborepo, Vitest, commitlint |
Quick start
You need Node 22+, pnpm, Rust (stable), the Tauri prerequisites for your OS, and Docker for the local database.
pnpm install
pnpm db:up # Postgres 17 on localhost:5433
cp apps/api/.env.example apps/api/.env # then edit, see below
pnpm --filter api db:migrate
pnpm --filter api dev # API on :8787
pnpm --filter desktop tauri dev # desktop app
Minimum apps/api/.env for local work:
DATABASE_URL=postgres://app:app@localhost:5433/app
DATABASE_URL_DIRECT=postgres://app:app@localhost:5433/app
BETTER_AUTH_SECRET=<openssl rand -base64 32>
BETTER_AUTH_URL=http://localhost:8787
GOOGLE_CLIENT_ID=dummy
GOOGLE_CLIENT_SECRET=dummy
The Google values are required by the env schema. Placeholders are fine for
email and password sign-in. Real credentials and the OAuth steps are in
docs/auth-setup.md. On macOS, deep links only work in a
built app, not in tauri dev.
Commands
| Command | What it does |
|---|---|
pnpm lint |
ESLint, architecture rules, vendor-import guard |
pnpm typecheck |
TypeScript across all packages |
pnpm test |
Vitest (API tests run on PGlite, no Docker needed) |
pnpm build |
Build every package |
pnpm db:up / db:down / db:reset |
Local Postgres |
pnpm --filter desktop gen:bindings |
Regenerate the Rust-to-TS bindings |
Rules the code follows
- Features are isolated. A feature imports
sharedandports, never another feature. - Vendors stay in adapters. No SDK import outside
ports/adapters/. - No secrets in the frontend. Tokens live in the OS keychain only.
- Validate at the edges. API responses, IPC results and stored settings are parsed with Zod.
- Server decides. Client checks are UX; the API enforces access.
- Conventional Commits, enforced by commitlint.
The full list is in docs/PRD.md.
Make it yours
The rename script and feature:new / feature:remove generators arrive in
M10. Until then: rename by hand (product name, bundle id, deep-link scheme),
and delete features/notes, its route, its migrations and apps/api/src/notes.
Docs
Contributing
Found a bug or have an idea? Open an issue. Pull requests are welcome.
Before you open one, run pnpm lint && pnpm typecheck && pnpm test, and write
commit messages in Conventional Commits
format.