Skip to content

๐Ÿ› ๏ธ Developmentยถ

DailyCost Vault is a Tauri v2 + Vite + TypeScript strict + Rust/SQLite full-stack project โ€” one codebase covering Windows / macOS / Linux / Android / iOS / Web.

Source layout

The app source and browser extension both live in this repo:

  • BunnyChen-Item-Bookkeeping/ โ€” app source (frontend src/ + backend src-tauri/)
  • dailycost-exporter-extension/ โ€” browser extension (Taobao / JD.com / Steam order export)

The extension also ships inside the desktop installer (mapped into $RESOURCE/browser-extension/), so once the app is installed you can set it up from Settings โ†’ ๐Ÿงฉ Browser Extension with no separate download. The source stays in this repo so the whole tree remains buildable โ€” do not delete the extension folder here: if bundle.resources has no matching files, cargo check / pnpm tauri dev fail outright.


Requirementsยถ

DependencyVersionPurpose
Node.js22+Frontend build (Vite)
pnpm11+Package manager
Ruststable (1.88+)Backend & desktop build
Tauri CLIvia project (pnpm scripts)Desktop / mobile build

Platform system dependencies (see official Tauri Prerequisites):

  • Windows: Microsoft C++ Build Tools ("Desktop development with C++") + WebView2 (bundled with Win10/11)
  • macOS: Xcode (Command Line Tools is enough for desktop)
  • Linux (Debian/Ubuntu): libwebkit2gtk-4.1-dev, build-essential, curl, wget, file, libxdo-dev, libssl-dev, libayatana-appindicator3-dev, librsvg2-dev

Quick Startยถ

1. Install dependenciesยถ

cd BunnyChen-Item-Bookkeeping
pnpm install

2. Browser-only development (no Rust needed) โ€” start the dev web appยถ

pnpm dev
# โ†’ open http://localhost:1420 in your browser

Pure frontend hot-reload (HMR) โ€” great for iterating on UI and interaction logic. In this mode there is only the web frontend, no Rust backend:

  • Data is stored in browser localStorage (a simulated BrowserDb), independent from the desktop SQLite database
  • Only needs Node.js + pnpm โ€” no Rust or desktop system dependencies, runs on any machine
  • Frontend changes hot-reload instantly; update checks go through the GitHub API channel (no Tauri updater)
  • Stop: press Ctrl+C in the terminal to end the Vite process

3. Desktop development (Tauri window + hot-reload)ยถ

pnpm tauri dev

Starts the Vite dev server and opens a desktop window; frontend changes hot-reload instantly, Rust changes require recompilation.

4. Rust backend compile checkยถ

cd src-tauri && cargo check

Checks whether the Rust code compiles, without producing a binary.


Create Your First Tauri Project (init)ยถ

Want to scaffold your own Tauri app from scratch? Tauri offers two approaches โ€” this project itself was created via create-tauri-app (TypeScript + pnpm + Vanilla template).

Run in the directory where you want the project (pnpm recommended):

# Interactive wizard
pnpm create tauri-app

# Or non-interactive (Linux / macOS)
sh <(curl https://create.tauri.app/sh)

Follow the prompts:

PromptThis project chose
Project namedailycost-vault
Identifiercom.bunnychen.dailycostvault
Frontend languageTypeScript / JavaScript
Package managerpnpm
UI templateVanilla
UI flavorTypeScript

After scaffolding:

cd dailycost-vault
pnpm install
pnpm tauri dev   # opens a Tauri window

Option 2: Add Tauri to an existing frontend (Tauri CLI)ยถ

If you already have a frontend project (Vite / Next.js / โ€ฆ), initialize the backend with the Tauri CLI:

# 1. Install the Tauri CLI (dev dependency)
pnpm install -D @tauri-apps/cli@latest

# 2. Initialize Tauri (interactive prompts)
pnpm tauri init
# โœ” What is your app name?
# โœ” What should the window title be?
# โœ” Where are your web assets located? โ†’ dist
# โœ” What is the url of your dev server? โ†’ http://localhost:5173
# โœ” What is your frontend dev command? โ†’ pnpm dev
# โœ” What is your frontend build command? โ†’ pnpm build

This creates a src-tauri/ directory. If you use Vite, ignore src-tauri in vite.config.ts to avoid hot-reload conflicts:

export default defineConfig({
  server: { watch: { ignored: ["**/src-tauri/**"] } },
})

Finally, run pnpm tauri dev to verify. Full walkthrough: Tauri Create a Project.


Project Structureยถ

BunnyChen-Item-Bookkeeping/
โ”œโ”€โ”€ index.html              # Single-page entry
โ”œโ”€โ”€ package.json            # Frontend scripts & dependencies
โ”œโ”€โ”€ vite.config.ts          # Vite config
โ”œโ”€โ”€ tsconfig.json           # TypeScript strict config
โ”œโ”€โ”€ src/                    # Frontend source (TypeScript + vanilla DOM, no framework)
โ”‚   โ”œโ”€โ”€ main.ts             # Entry point
โ”‚   โ”œโ”€โ”€ ui-home.ts          # Home (asset wall / filters / cards)
โ”‚   โ”œโ”€โ”€ ui-modal.ts         # Generic modal
โ”‚   โ”œโ”€โ”€ ui-settings.ts      # Settings page
โ”‚   โ”œโ”€โ”€ ui-analytics.ts     # Analytics page
โ”‚   โ”œโ”€โ”€ ui-share.ts         # Share & reports
โ”‚   โ”œโ”€โ”€ db.ts               # Database access
โ”‚   โ”œโ”€โ”€ data.ts             # Unified data-access layer (desktop / browser)
โ”‚   โ”œโ”€โ”€ data-events.ts      # Data change events
โ”‚   โ”œโ”€โ”€ prefs.ts            # Preferences
โ”‚   โ”œโ”€โ”€ theme.ts / themes.ts          # Theme system
โ”‚   โ”œโ”€โ”€ emoji.ts / custom-emoji.ts    # Emoji system
โ”‚   โ”œโ”€โ”€ i18n.ts             # i18n (zh / en / zh-TW)
โ”‚   โ”œโ”€โ”€ types.ts / utils.ts / aggregate.ts
โ”‚   โ””โ”€โ”€ locales/            # Translations
โ””โ”€โ”€ src-tauri/              # Rust backend
    โ”œโ”€โ”€ src/                # Rust source (Tauri commands / SQLite)
    โ”œโ”€โ”€ Cargo.toml          # Rust dependencies
    โ”œโ”€โ”€ tauri.conf.json     # App config (identifier / window / updater)
    โ”œโ”€โ”€ capabilities/       # Permission capabilities
    โ”œโ”€โ”€ icons/              # Platform icons
    โ””โ”€โ”€ gen/                # Android / iOS generated projects

The frontend uses vanilla TypeScript + DOM (no framework); the Rust backend exposes 30+ Tauri commands over IPC, with data stored in a local SQLite database.


Sample Dataยถ

  • src-tauri/example-data.db โ€” bundled sample database (generated by a script)
  • src-tauri/generate_example_db.py โ€” sample data generator
  • src/assets/example-data.json / example-incomes.json โ€” frontend sample data

Click "Load sample data" in the app to try the full feature set without importing anything.


Official Docsยถ

For details, refer to the official Tauri documentation:

TopicLink
Prerequisitesv2.tauri.app/start/prerequisites
Create a Projectv2.tauri.app/start/create-project
Project Structurev2.tauri.app/start/project-structure
Tauri CLI Referencev2.tauri.app/reference/cli
Developv2.tauri.app/develop

Next Stepsยถ