FundSight RP is a Next.js 16 financial command-center app with authenticated user accounts, PostgreSQL persistence, protected routes, and Docker/CI deployment.
The app now reads report/chart data from persisted user records (not hardcoded mock arrays) and is structured for production deployment.
- Next.js 16 (App Router + Proxy middleware)
- React 19
- Better Auth
- PostgreSQL (
pg) - Playwright (E2E smoke tests)
Copy .env.example to .env and set all required values.
Mandatory:
DATABASE_URLBETTER_AUTH_SECRETBETTER_AUTH_URLNEXT_PUBLIC_APP_URL
Recommended:
APP_URLTRUSTED_ORIGINS
Optional:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETNEXT_PUBLIC_ENABLE_DEMO_MODENEXT_PUBLIC_DEMO_EMAILNEXT_PUBLIC_DEMO_PASSWORD
Notes:
- In production,
BETTER_AUTH_SECRETis required and startup will fail if it is missing. TRUSTED_ORIGINSshould include every deployed frontend origin that can initiate auth flows.
npm ci
npm run db:migrate
npm run devnpm run lint
npm run typecheck
npm run build
npm run test:e2e- Removed report/chart mock arrays and now derive report datasets from persisted transactions/budget/net-worth records.
- Enforced
BETTER_AUTH_SECRETin production runtime (no unsafe fallback secret in production). - Added partial JSON updates for user financial stores to prevent full-row overwrite races.
- Added explicit
404behavior for mutation routes when target records do not exist. - Added request schema validation (
zod) and rate limiting for mutating APIs. - Added request-ID propagation (
x-request-id) and structured API logging helpers. - Added undo support for destructive actions (transactions, accounts, subscriptions, savings goals, loans).
- Added full CRUD for savings goals, loans, accounts, transactions, and subscriptions.
- Added service-worker based PWA offline shell support and offline fallback page.
- Added mobile + PWA E2E checks in Playwright.
GET|PATCH /api/budget- template apply (
50/30/20,zero_based,envelope) - budget settings and rollover controls
- variance alerts and weekly cashflow
- template apply (
GET|POST|PATCH|DELETE /api/loans- debt strategy plans (snowball/avalanche)
- refinance comparison
- loan due alerts
- DTI trend points
GET|POST|PATCH|DELETE /api/savings/goals- create, update, delete, and summarize savings goals
GET|POST|PATCH|DELETE /api/user/accounts- account create/edit/delete flows
GET|POST|PATCH|DELETE /api/tools/subscriptions- subscription/bill management with edit toggles and field updates
GET|POST|PATCH|DELETE /api/transactions- filtered listing + CSV export (
format=csv) - bulk reconcile/categorize/delete
- saved views
- transaction auto-categorization rules
- CSV import (
action: import_csv) - category mapping import (
action: import_category_mappings)
- filtered listing + CSV export (
POST /api/undo- restores latest supported destructive action
GET|POST|DELETE /api/net-worth/snapshots- snapshot timeline with notes/reasons and DTI context
GET /api/insights/management- consolidated management insights (budget variance, cashflow, debt strategy, quality checks)
GET /api/ops/metrics- authenticated runtime + database latency metrics for monitoring pipelines
- Completed:
- P0 production hardening and correctness fixes
- Budget templates + rollover + variance + weekly planned-vs-actual cashflow
- Debt strategy + refinance simulator + due alerts + DTI trend APIs
- Transaction filters/saved views/rules/reconciliation + CSV export APIs
- Full CRUD on savings goals, loans, subscriptions, and accounts
- Undo APIs and command palette quick action (including goal/loan deletes)
- Net-worth snapshots API and management-insights API
- PWA install metadata + service worker offline fallback
- Encrypted backup/restore scripts and runbook
- Remaining:
- Wire
/api/ops/metricsinto external dashboard/alerting tooling - Schedule backup scripts in your deployment environment (cron/runner)
- Wire
- Set all required environment variables, especially
BETTER_AUTH_SECRET. - Run migrations with
npm run db:migrate. - Build and start with
npm run build && npm run start(or Docker). - Verify health endpoint:
GET /api/health. - Verify auth flow: sign-up, sign-in, protected route redirect.
- Verify persisted user data flows for budget, savings, loans, subscriptions, reports.
Use the helper script to create app role/database in the shared central Postgres:
POSTGRES_SUPERPASS='<central-postgres-password>' \
APP_DB_PASSWORD='<new-app-password>' \
APP_DB_NAME='fundsight_rp' \
APP_DB_USER='fsrp_user' \
bash scripts/provision-central-db.shThen set:
DATABASE_URL=postgresql://fsrp_user:<password>@kt-central-db:5432/fundsight_rpdocker compose up -d --build
docker compose psThe app binds to 127.0.0.1:3110 and exposes health on /api/health.
.github/workflows/ci.yml- lint, typecheck, build, e2e
.github/workflows/docker-build.yml- builds and pushes GHCR image on main/master/tag pushes
docs/FEATURE-CATALOG.mddocs/PRODUCTION-ROADMAP.mddocs/BACKUP-RESTORE.md