Seedworks Labs Wiki The engineering referenceStudio website ↗
Coconut

Overview & code map

Trace the budgeting app from routes to repositories and services.

Engineering documentation • Reviewed 2026-11-29

Purpose and supported shapes#

Coconut manages monthly allowance, budgets, recurring costs, transactions, one-off income and reserve movements. Each person has an independent personal finance dataset. Shared Spaces add collaborative expenses without exposing every participant's personal database.

The repository contains Android, local web and desktop packaging, plus a production hosted-web mode at coconut.seedworkslab.de. Do not describe them as having identical account requirements: local use is offline-first; hosted mode gates access behind a verified Seed account.

Start at the root#

src/app/_layout.tsx composes the application shell, themes, data and navigation. src/data/DataProvider.tsx is the central orchestration layer. Its context exposes settings, the current dashboard, month history, budgets, fixed expenses, subscriptions and named mutation methods.

Important provider operations include startMonth, replanMonth, closeCurrentMonth, addTransaction, saveTransaction, setFixedExpenseActual, dashboardFor, syncPersonalAndRefresh and syncSharedAndRefresh. These are the bridge between screens and data/business rules—not a second persisted database.

MonthDashboard gathers a forecast, reserve projection, budget statuses, fixed-expense statuses, transactions, income, subscription instances and budget labels/colors. dashboardFor(monthKey) allows historical screens to use the same underlying calculation path.

Screen and feature map#

Route/file under src/app/ User-facing responsibility Implementation below the screen
(tabs)/index.tsx Current-month overview Provider dashboard, forecast and reserve services
(tabs)/transactions.tsx Transaction browsing database/transactions.ts, transaction form/details components
(tabs)/statistics.tsx Historical comparison and trends services/statistics-service.ts, chart components
(tabs)/shared.tsx Shared Spaces and periods Shared repositories, shared sync, split/balance service
(tabs)/settings.tsx Preferences and feature entry points Settings/local preferences, sync configuration, backup and updates
planning/month.tsx Start or revise the month plan month-planning-editor.tsx, month plan repository/service
planning/close-month.tsx Review and close the month Provider settlement, closing-window and report services
planning/fixed-expenses.tsx, planning/budgets.tsx Maintain plan inputs Aggregate repositories and reusable forms
planning/subscriptions.tsx, planning/reserve.tsx Subscription periods and reserve history Subscription and reserve services/repositories
transaction/new.tsx, transaction/[id].tsx Create/edit spending transaction-form.tsx, transaction DTO and active-month validation
income/new.tsx, income/[id].tsx One-off income database/income.ts, income-form.tsx
shared/expense.tsx, shared/balances.tsx Shared expense editing and settlement suggestions Split validation, shared repositories and derived mirrors
monthly-report/[monthKey].tsx, monthly-history.tsx Closed-month review Monthly reports and historical dashboard queries
sync.tsx, auth/callback.tsx Account/sync UI and hosted callback sync/supabase.ts, hosted OAuth and engine

The parenthesized (tabs) folder is an Expo Router route group, not a literal URL segment. Bracketed filenames define route parameters.

Follow a transaction end to end#

  1. A route renders transaction-form.tsx, collecting amount, date, merchant, budget and other supported fields. Formatting and attachment selection are separate UI/utilities.
  2. The screen invokes a provider mutation using TransactionInput, rather than emitting ad hoc SQL.
  3. The provider validates the date against the active working month and calls database/transactions.ts. Money is represented as integer cents.
  4. The repository writes SQLite. Migration-installed triggers record sync-facing changes in the outbox.
  5. The provider refreshes local state/dashboard calculations. The UI does not wait for a network round trip to make the transaction useful.
  6. If sync is enabled and authenticated, the sync scheduler can upload changes. A later pull applies remote changes locally and refreshes the same UI path.

A shared-expense-linked transaction is different: its financial amount is derived from the shared split and must not be treated as an independently editable copy. See Shared Spaces.

Feature implementation map#

Feature Files/functions to inspect
Allowance and planning headroom services/allowance-service.ts: remainingAllowance, remainingForBudget
Dashboard totals services/forecast-service.ts: forecastMonth, budgetStatus
Variable recurring costs services/estimation-service.ts: estimateAmount
Subscription allocation services/subscription-service.ts: monthlyChargeCents, subscriptionChargesForMonth
Active working period services/active-month-service.ts: resolveActiveMonth, validateDateInActiveMonth
Reserve and closing services/reserve-service.ts, month-closing-service.ts, provider settleMonth
Replanning audit trail services/month-planning-service.ts, database/monthPlan.ts
Reports and history services/monthly-report-service.ts, statistics-service.ts, database/monthlyReports.ts
Attachments utils/attachment.ts, attachment-source.ts, attachment-display.ts, components/attachment-field.tsx
Backup validation and transfer utils/backup.ts, database/backup-validation.ts, app/planning/backup.tsx
Languages and themes i18n/{en,de,hu}.ts, theme/, provider preference setters
Release notices updates/release-notes.ts, services/update-service.ts, platform-specific update installers

Reading order for a contributor#

Read the financial rules before changing a displayed total. Read the data model before editing repositories or migrations. For a cloud discrepancy, start with sync, then follow serialization and FK mapping—not the screen displaying the symptom.

idea.txt describes intended product behavior and AGENTS.md constrains modifications. Source and tests determine current implementation; a design document is not evidence that a planned feature ships.

Verification#

From Coconut/, the available scripts include npm test, npm run typecheck, npm run lint, npm run export:web, and npm run export:hosted-web. Native and browser acceptance are additional checks, not implied by a passing TypeScript build.

Never clear application/browser storage or wipe an emulator to make a check pass. Existing data can be irreplaceable. The development guide explains safe investigation.