Developer Guide
This page keeps contributor and codebase details out of the README.
Project Shape
Section titled “Project Shape”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.
Public Homepage
Section titled “Public Homepage”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.
Project Structure
Section titled “Project Structure”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.jsonQuality Checks
Section titled “Quality Checks”| 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:
pnpm validatepackage.json includes pnpm.overrides for patched transitive dependencies pulled in by tooling. Run pnpm audit when checking dependency security.
Main Documentation
Section titled “Main Documentation”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. |
Phone Security Plugin
Section titled “Phone Security Plugin”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).
Local API
Section titled “Local API”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.
AI Provider Configuration
Section titled “AI Provider Configuration”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.
Content Security Policy
Section titled “Content Security Policy”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.
Component Guidelines
Section titled “Component Guidelines”- 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.
State And Data
Section titled “State And Data”- 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
DataProviderinterface (useDataProvider()in components,services.dataProviderin Local API routes). Onlysrc/providers/LocalDataProvider.tsimports@/lib/dexieDB. ESLint enforces this outside test files. - Rename and delete vendors, accounts, categories and sub-categories only through their
DataProvidermethods (renamePayee,updateAccountDetails,renameCategory,renameSubCategory, themerge*methods and thedelete*methods). Other records store these names, and the methods update them inside the same ledger in one database transaction.
Deployment
Section titled “Deployment”The web build is a static SPA in dist/. Any static host can serve it.
Cloudflare Pages works well:
- Connect the Git repository.
- Set the build command to
pnpm run build. - Set the output directory to
dist. - Use Node 20+ for the build environment.
The included public/_redirects file supports client-side routing on Cloudflare Pages.
Manual deploy example:
pnpm run buildnpx wrangler pages deploy dist