Skip to content

Contributing ​

Thanks for helping build Mintage. This page gets you from a fresh clone to a passing test run, and covers the conventions every change must follow.

Set up ​

bash
corepack enable                 # pnpm 10
pnpm install
pnpm -r build                   # core → db → api → web → docs
pnpm -r test                    # Vitest everywhere
pnpm dev                        # API :4000 + web :5173
CommandWhat it does
pnpm devAPI and web dev servers together, with the web app proxying /api
pnpm -r testAll unit and integration tests
pnpm typecheckType-check every package
pnpm e2ePlaywright end-to-end tests against the dev servers
pnpm seedLoad demo data into your local database
pnpm docs:devThis Help Centre at http://localhost:5174

Node 22.13 or later is required (Mintage uses node:sqlite).

Where things live ​

Each package owns one layer — see Architecture. Domain logic goes in packages/core as pure functions with no I/O; the API wires it to repositories; the web app calls the API.

packages/core/src/types.ts is the canonical domain model. If you need a new field, change the zod schema there first; the inferred type, the API input validation and the database mapping follow. See Data model.

Conventions ​

These are binding — review will ask for them.

  • Money is integer cents. Use Cents and the helpers in money.ts. Never add or multiply money as floating-point numbers.
  • Units and prices are DecimalString. Compute with Decimal (import { Decimal } from 'decimal.js' — the named import) and round once at the end.
  • Calendar dates are ISODate strings (YYYY-MM-DD). Use dates.ts; never do Date arithmetic on calendar dates (time zones and DST will bite).
  • Validate at every boundary with zod. Every persisted or transported type has a schema with the same name plus Schema.
  • Throw KeelError with a code, message and details — never a string.
  • No any. Use unknown and narrow. Exhaustive switch statements end with assertNever.
  • Named exports only, readonly where sensible, 2-space indentation, semicolons, single quotes, 110 columns.
  • No new dependencies without discussion — prefer the standard library (node:crypto, node:sqlite, Intl).
  • Accessibility: WCAG 2.2 AA, visible focus, 44 px targets, everything reachable by keyboard, prefers-reduced-motion respected.

Tests ​

  • Colocate tests as *.test.ts next to the code.
  • Money and tax code needs hand-computed fixtures. Cover the edge cases the spec calls out: the CGT 12-month boundary, discount by entity type, loss ordering, splits, a return of capital above cost base, FX transfers, recurring dates such as the 31st in February and fortnightly across year end, and the reconciliation difference finder.
  • Bug fixes come with a test that fails before the fix.

Adding a bank or broker preset ​

Presets live in packages/core/src/importers.

  1. Add a sample export (with personal details removed) to samples/.
  2. Add the preset: its name (e.g. 'ubank'), the import kind (bank_transactions or broker_trades), header patterns used for detection, and a ColumnMapping (fields, date format, amount sign convention, buy/sell values).
  3. Make header matching tolerant — trim, ignore case and punctuation, accept known variants (Units/Quantity).
  4. Add a test that parses the sample and checks a few rows exactly, including signs, dates and fees.
  5. Document it: add the export steps to Bank files or the relevant broker page.

Adding a help article ​

Every screen in the web app registers a helpKey, and its contextual help lives in apps/web/src/help/<helpKey>.md.

  1. Create the file with frontmatter title, key (must equal the file name) and docsUrl (a docs path without a leading slash, such as guide/transactions).
  2. Use the standard sections: What this screen is for, How to, Tips, Related, and Glossary where finance or tax terms appear.
  3. In Related, link other help panels as help:<key> and docs pages as docs:<path>.
  4. Add the key to HELP_KEYS in apps/web/src/help/index.ts.

Working on these docs ​

The Help Centre is a VitePress site in apps/docs.

bash
pnpm docs:dev                       # live preview
cd apps/docs && npx vitepress build # must pass — dead links fail the build
  • Write in plain, warm, second-person Australian English.
  • Use the global components: WorkflowAnimation (animated walkthroughs; data in .vitepress/theme/workflows/*.ts), Screenshot, Shortcut and Callout (tip, warning, tax).
  • Every tax statement carries "general information, not tax advice" — a tax callout adds it for you.
  • Screenshots go in apps/docs/public/screens/<name>.png; until one exists, Screenshot shows a placeholder.

Pull requests ​

  • Keep changes focused; one feature or fix per PR.
  • pnpm -r build && pnpm -r test must pass.
  • Describe what changed and why, and how you tested it.

Not tax advice. Mintage provides general information only — it does not consider your personal circumstances. Check with a registered tax agent or licensed financial adviser before acting. Disclaimer