Skip to content

Developer Guide

This page keeps contributor and codebase details out of the README.

Vaulted Money is a React, TypeScript, Vite, Tailwind, Electron, and Capacitor app. The web app is the shared renderer. Electron packages it for desktop, and Capacitor packages it for iOS and Android.

For a detailed system view, read Architecture.

The root route (/) is a public landing page that runs without an active ledger. It covers the privacy-first, local-first, and open-source positioning.

The authenticated app lives under /ledgers and the app routes behind the main layout.

The homepage is implemented in src/pages/HomePage.tsx and is kept outside the authenticated Layout route so it does not trigger active-ledger redirects.

vaulted.money/
├── electron/ # Electron main and preload code (incl. Local API server)
├── src/
│ ├── api/ # Local API: route table, compute, OpenAPI, bridge
│ ├── components/ # Reusable and feature UI
│ ├── contexts/ # React context providers
│ ├── hooks/ # Custom hooks
│ ├── pages/ # Route-level pages
│ ├── providers/ # Data provider implementations
│ ├── types/ # Shared TypeScript types
│ └── utils/ # Helpers and domain utilities (search parser, fuzzy matching, filters)
├── android/ # Capacitor Android project
├── ios/ # Capacitor iOS project
├── documentation/ # Project docs
├── specs/ # Feature specifications
├── package.json
├── vite.config.ts
└── tsconfig.json
Check Command Purpose
Lint pnpm lint ESLint checks.
Type safety tsc --noEmit TypeScript verification.
Formatting pnpm format:check Prettier verification for source files.
Tests pnpm test:coverage Vitest with coverage.
Build pnpm build Production compile check.

Run the combined local validation with:

Terminal window
pnpm validate

package.json includes pnpm.overrides for patched transitive dependencies pulled in by tooling. Run pnpm audit when checking dependency security.

The documentation map shows every page, who it is for, and how the pages link to each other.

File Purpose
API.md Local API reference (desktop app).
API_COOKBOOK.md Recipes and client examples for the Local API.
postman/README.md Postman collection, setup and test suite.
DESIGN.md Brand identity, logo geometry, and color strategy.
WHY_VAULTED_MONEY.md Motivation and privacy philosophy.
SUPPORT.md How to get help.
UI_UX_STANDARDS.md UI and UX expectations.

The app lock and the Keychain/Keystore store are an in-repo Capacitor plugin named VaultedLock (no package). The typed contract is src/lib/nativeLock.ts; iOS is ios/App/App/VaultedLockPlugin.swift and SecretStore.swift, Android is android/app/src/main/java/com/vaultedmoney/app/VaultedLockPlugin.java and SecretVault.java. Feature code never calls it: use getSecret, setSecret and removeSecret from src/lib/secureSecrets.ts. Tests use a fake plugin (src/tests/fakeLock.ts); lock behaviour itself can only be verified on a real phone (see IOS_RULES.md 3.7 and ANDROID_RULES.md 3.6).

The desktop app exposes an opt-in REST API (src/api/, electron/apiServer.ts). It is a public contract: any change to an API entity must update the route, src/api/api.test.ts, API.md and the Postman collection together. pnpm test fails if a route has no Postman request or if a Postman assertion fails. The full checklist is in CLAUDE.md; the design is in ARCHITECTURE.md.

Vaulted Money supports bring-your-own-key categorization. Users manage providers on the AI & agents page: the add/edit dialog holds the API key (kept in local storage, optional for a custom OpenAI-compatible endpoint such as a local model) and the list has a Use this one button to pick the provider in use.

Provider types include Gemini, OpenAI, Anthropic, Mistral, Perplexity, and Custom OpenAI-compatible endpoints.

API keys are stored locally and are never included in exports.

Production builds add a Content Security Policy through the html-csp plugin in vite.config.ts (build only, so the dev server’s hot reload keeps working). Scripts, styles, fonts and frames are limited to the app itself. connect-src allows any https: address because users configure their own AI endpoints, so a new AI provider needs no CSP change.

  • Put generic UI primitives in src/components/ui/.
  • Put feature-specific components in src/components/<feature>/.
  • Use functional React components with TypeScript interfaces.
  • Style with Tailwind utilities and existing local patterns.
  • Keep responsive behavior mobile-first.
  • Add comments only where they clarify non-obvious logic.
  • Global financial data comes through useTransactions().
  • Ledger state comes through useLedger().
  • UI-only state should usually stay local with useState.
  • Async data loading uses TanStack Query where appropriate.
  • Local persistence is implemented through Dexie and IndexedDB.
  • Read and write stored data through the DataProvider interface (useDataProvider() in components, services.dataProvider in Local API routes). Only src/providers/LocalDataProvider.ts imports @/lib/dexieDB. ESLint enforces this outside test files.
  • Rename and delete vendors, accounts, categories and sub-categories only through their DataProvider methods (renamePayee, updateAccountDetails, renameCategory, renameSubCategory, the merge* methods and the delete* methods). Other records store these names, and the methods update them inside the same ledger in one database transaction.

The web build is a static SPA in dist/. Any static host can serve it.

Cloudflare Pages works well:

  1. Connect the Git repository.
  2. Set the build command to pnpm run build.
  3. Set the output directory to dist.
  4. Use Node 20+ for the build environment.

The included public/_redirects file supports client-side routing on Cloudflare Pages.

Manual deploy example:

Terminal window
pnpm run build
npx wrangler pages deploy dist