Appearance
Data model
packages/core/src/types.ts is Mintage's canonical domain model. Every persisted or transported type is a zod schema plus an inferred TypeScript type with the same name (AccountSchema → Account). If the spec and the types ever disagree, the types win.
Primitives
| Type | Shape | Notes |
|---|---|---|
Id | non-empty string | From newId() (crypto.randomUUID) |
Cents | safe integer | Money in minor units, signed |
DecimalString | "-?digits(.digits)?" | Units, prices for computation, ratios |
ISODate | YYYY-MM-DD | Calendar date, entity-local |
ISOTimestamp | ISO-8601 with offset | Created/updated times (UTC) |
CurrencyCode | 3 letters, upper-cased | AUD, GBP, USD… |
CountryCode | AU GB US NZ CA IE DE FR SG JP ZA OTHER | Drives locale, FY start and sales-tax name |
Most aggregates carry createdAt and updatedAt.
How it fits together
text
User ──< Membership >── Entity ──┬──< Account ──< Transaction ──< Split ──> Category, Tag
│ (role) │ │ │ │
│ │ │ │ ├──> Payee ├──> Attachment
│ │ │ │ └── transferId pairs two Transactions
│ │ │ ├──< Reconciliation
│ │ │ └──< RecurringRule (template → Transactions)
│ │ ├──< Budget ──< BudgetLine ──> Category
│ │ ├──< Goal ──> Account (linked)
│ │ ├──< Rule
│ │ ├──< SmsfMember
│ │ ├──< Contact ──< Invoice ──< InvoiceLine
│ │ ├──< ImportProfile, ImportBatch ──> (Transactions, Trades, IncomeEvents)
│ │ └──< CarriedForwardLoss (per FY)
│ │
│ └── investments:
│ Account (investment) ──< Trade ──> Security ──< Price
│ │ sell: ParcelAllocation[] ──> Parcel
│ buy ──creates──> Parcel ──< ParcelAdjustment ──> CorporateAction / AMIT
│ └──< CgtEvent (on disposal) ──> Trade | CorporateAction
│ IncomeEvent ──> Security, Account (DRP ──creates──> Parcel)
├──< Watchlist, PriceAlert ──> Security
├──< CheckIn, Streak, Achievement, Insight
└── AuditLog (every mutation)Users, entities and roles
User — email, display name, passwordHash (scrypt, scrypt$N$r$p$salt$hash), totpSecret/totpEnabled, and preferences: locale (default en-AU), displayCurrency, theme (system | light | dark), calmMode, reducedMotion, privacyBlur, and a free-form onboardingState.
Entity — a set of books. type is one of individual | household | smsf | trust | company | partnership | sole_trader | club. It has a country, baseCurrency, locale, and a financial-year start as fyStartMonth + fyStartDay (AU 7/1, UK 4/6, NZ 4/1, US 1/1).
TaxProfile (embedded in Entity) — entityType (drives the CGT discount), marginalRate and medicareLevy for what-if estimates, GST settings (gstRegistered, gstBasis: cash | accruals, gstPeriod: monthly | quarterly | annually), cgt2027ValuationMethod?: market_value | apportionment (the deprecated cgtRegime is ignored — the 2027 reform applies automatically), masked TFN, ABN, and an optional smsf block: fundName, pensionPhaseProportion (exempt current pension income share) and investmentStrategyTargets (asset class with target, min and max %).
Membership — joins a user to an entity with a Role: owner | editor | viewer | accountant.
SmsfMember — name, date of birth, phase: accumulation | pension | ttr, and balance.
Accounts and the ledger
Account — type is one of transaction | savings | offset | term_deposit | cash | credit_card | loan | mortgage | hecs_help | investment | superannuation | crypto | property | vehicle | other_asset | other_liability | receivable | payable. isLiability() covers credit cards, loans, mortgages, HECS-HELP, other liabilities and payables. Accounts hold institution, masked number, BSB, hin and broker for brokerage accounts, opening balance and date, interest rate, credit limit, includeInNetWorth, isClosed, colour/icon and sort order.
Category — hierarchical via parentId; kind: income | expense | transfer; nature: essential | discretionary | savings | income | none for needs/wants analysis; flags isTaxDeductible, gstApplicable, isBudgetable, isHidden, isSystem (e.g. Uncategorised, Transfer, Opening balance).
Payee — a normalised name with aliases (raw bank descriptors that map to it) and a defaultCategoryId.
Tag — free label; isProject: true makes it a project for job costing.
Transaction — one movement on one account: date, signed amountCents (+ deposit, − withdrawal), payeeId and the original payeeRaw, memo, reference, status: pending | cleared | reconciled | void, origin: manual | import | recurring | rule | feed | system, and:
splits— at least oneSplit(categoryId, signedamountCents, memo,tagIds, optionalgstCentsand anisTaxDeductibleoverride). Splits always sum to the transaction amount.transferId/transferAccountId— both legs of a transfer share atransferIdand are written atomically.originalAmountCents,originalCurrency,fxRate— the foreign-currency side of a purchase or transfer.recurringRuleId,importBatchId,fingerprint(dedupe hash of account, date, amount and normalised descriptor),attachmentIds,reconciliationId.isReviewed—falseputs it in the daily check-in queue.
Attachment — file metadata (fileName, mimeType, sizeBytes, sha256) and a storagePath outside the web root.
Rule — conditions (field payeeRaw | memo | amount | accountId | reference; op contains | equals | startsWith | endsWith | regex | gt | lt | between), match: all | any, actions (set payee/category/memo, add tags, percentage or fixed splits, mark reviewed), priority, stopProcessing, hitCount.
RecurringRule — a scheduled transaction. recurrence has frequency (daily | weekly | fortnightly | four_weekly | monthly | quarterly | half_yearly | yearly), interval, startDate, endDate or count, byMonthDay (−1 = last day), byWeekday, and businessDayAdjust: none | previous | next. template holds the account, amount, payee, memo, splits and optional transfer account. Plus isVariableAmount, autoPost, remindDaysBefore, nextDueDate, lastPostedDate and skippedDates.
Reconciliation — account, statementDate, statementBalanceCents, reconciledBalanceCents, status: in_progress | completed, the transactionIds ticked, and notes.
Budgets and goals
Budget — mode: category | envelope | percent_plan, period: weekly | fortnightly | monthly | quarterly | yearly, an anchorDate the periods count from, expectedIncomeCents, an optional percentPlan (needs, wants, savings) and **BudgetLine**s (categoryId, amountCents, rollover, note).
Goal — type: savings | debt_payoff | net_worth | emergency_fund | purchase | custom, targetCents, optional targetDate, startDate, linkedAccountIds (progress derived from balances) or manualProgressCents, startingBalanceCents, planned contribution and frequency, implementationIntention, milestonesHit (25/50/75/90/100), and status: active | achieved | paused | abandoned.
Securities, prices and FX
Security — code, exchange (ASX, NYSE, NASDAQ, LSE…), ISIN, name, type: share | etf | lic | managed_fund | bond | hybrid | option | warrant | crypto | cash | other, currency, sector, assetClass, country, isBenchmark, isAmit, and the price priceProvider / providerSymbol (e.g. VAS.AX).
Price — one row per security per date: closeCents in the security's currency, optional OHLC and volume, and source.
FxRate — base, quote, date, rate, source.
Trades, parcels and CGT
Trade — side: buy | sell, trade date and optional settlementDate, units (decimal), priceCents, brokerageCents, feesCents, gstCents, grossCents (units × price) and netCents (buy: gross + costs; sell: gross − costs), currency and fxRate, confirmationNo, broker, and for sells the strategy used plus explicit **ParcelAllocation**s (parcelId, units). cashTransactionId links the settlement on the cash account.
Parcel — created by every buy (and DRP allotment): acquiredDate (a roll-over may preserve an earlier date), originalUnits and remainingUnits, costBaseCents and reducedCostBaseCents for the remaining units, isPre1999 (indexation eligible), closedDate, and an append-only list of **ParcelAdjustment**s — each with a date, sourceType (corporate_action | amit | manual | return_of_capital | indexation), sourceId, unitsDelta, costBaseDeltaCents, reducedCostBaseDeltaCents and a note. Adjustments are the audit trail of everything that has happened to a parcel.
CorporateAction — type is one of the 17 event types, with date, optional exDate, entityId (null = market-wide) and type-specific params:
| Type | Params |
|---|---|
split, consolidation | ratioFrom, ratioTo |
bonus_issue | ratioFor, ratioHeld |
rights_issue | ratioFor, ratioHeld, priceCents, takenUp |
drp | dividendId (units come from the IncomeEvent) |
return_of_capital | perUnitCents |
demerger | newSecurityId, unitsRatioFor, unitsRatioHeld, costBasePctToNew, newAcquisitionDateRule: original | event |
takeover_cash | perUnitCents |
takeover_scrip | newSecurityId, ratioFor, ratioHeld, cashPerUnitCents?, rollover |
code_change, name_change | newCode?, newName? |
amit_cost_base_adjustment | netAmountPerUnitCents (+ increases, − decreases cost base) |
unit_conversion | newSecurityId, ratioFor, ratioHeld |
merger, delisting, special_dividend, capital_call | validated in investments/corporateActions.ts |
appliedAt records when it was applied, and source is manual | import | suggested.
IncomeEvent — kind: dividend | distribution | interest | special_dividend, exDate, payDate, unitsHeld, cashPerUnitCents (may be fractional), franked/unfranked amounts, frankingCreditsCents and frankingRate (0.30 default), foreign income and foreign tax, AMIT/trust components (interest, other income, discounted capital gain, CGT concession, other capital gain, tax-deferred, tax-exempt, AMIT cost base net), grossCents, withholdingCents, netCashCents, and DRP details (isDrp, drpUnits, drpPriceCents).
CgtEvent — one per parcel disposed (or per corporate action that triggers CGT): dates, units, proceedsCents, costBaseCents, reducedCostBaseCents, grossGainCents (negative = loss), isLoss, discountEligible, holdingDays, method: discount | indexation | other, indexedCostBaseCents, and financialYear ("2025-26").
CarriedForwardLoss — per entity per financial year, lossCents, source: computed | manual.
Watchlist and PriceAlert (condition: above | below | pct_change) belong to a user, not an entity.
Imports
ImportProfile — a saved mapping: preset (e.g. 'nabtrade', 'cba', 'iress'), kind (bank_transactions | broker_trades | holdings_snapshot | prices | corporate_actions | income | budget | full_backup), format (csv | ofx | qfx | qif | camt053 | json | xlsx | clipboard), a default account and a ColumnMapping: fields (Mintage field → source column), dateFormat, decimalSeparator, amountSign: signed | debit_credit_columns | debit_positive | type_column, invertAmount, skipRows, hasHeader, and buy/sell sideValues.
ImportBatch — one import: file name and SHA-256, counts (rowCount, importedCount, duplicateCount, errorCount), row errors, and status: previewed | committed | reverted with timestamps. Everything an import creates carries its importBatchId, which is how revert works.
Business-lite
Contact — kind: customer | supplier | both, email, ABN, address, payment terms.
Invoice — kind: invoice | bill, number, issue and due dates, **InvoiceLine**s (quantity, unit price, taxRate default 0.10, category, line total and tax), subtotal/tax/total/paid, status: draft | sent | part_paid | paid | overdue | void, and linked payment transactions.
Engagement
CheckIn—kind: daily | weekly_review | monthly_money_date, reflections (prompt → answer) and duration.Streak— per user andkind: daily | weekly_review: current, longest, last date,freezeTokens(default 2).Achievement— akey, title, description, icon,unlockedAt,seenAt.Insight— a feed item:kind(anomaly, subscription creep, duplicate charge, dividend received, CGT discount unlocked, budget pacing, fresh start, tax-loss harvest, goal milestone, price alert, low balance forecast),severity: info | positive | warning | action, title, body, data, anactionRoute, and dismiss/expiry times.
Audit
AuditLog — user, entity, action, targetType, targetId, before and after snapshots, IP and time. Every mutation writes one.
Derived views (not persisted)
AccountBalance— balance, cleared and pending amounts for an account on a date.Holding— units, cost base, average cost, market price and date, market value, unrealised gain (and the discount-eligible part), portfolio weight, and the open parcels behind it.NetWorthPoint— assets, liabilities and net worth on a date, in a currency.
See also: Architecture · API