A full‑stack TypeScript app combining an Express API and a React + Vite client. The server serves both API and client on port 5000.
- Prerequisites:
- Node.js 18+ (works on Node 20/22/25)
- A Postgres database (Neon recommended)
- Setup:
cp .env.example .env- Set
DATABASE_URLin.envto your Postgres connection string npm install
- Dev:
npm run dev(API + client onhttp://localhost:5000)
- Build:
npm run build(client todist/public, server todist/system)
- Run (production):
npm start(runsnode dist/system/index.js)
Required:
DATABASE_URL— Neon/Postgres connection string
Optional (features degrade gracefully if unset):
OPENAI_API_KEY— Enable AI assistant via OpenAISTRIPE_SECRET_KEY,MERCURY_API_KEY,WAVE_API_TOKEN— IntegrationsGITHUB_TOKEN— Enable GitHub repository widgets (stars, PRs, issues)
GET /api/session— Demo userGET /api/financial-summaryGET /api/tasks,POST /api/tasksPOST /api/ai-assistant/query— Body:{ "query": "..." }
Cloudflare Workers config is in deploy/system-wrangler.toml.
-
Routes:
finance.chitty.cc/*→ ChittyFinance (this app)get.chitty.cc/*→ Registration service (external; not routed here)connect.chitty.cc/*→ ChittyConnect (external; this app links to it)
-
Build:
npm run build(usesbuild:system) -
Deploy:
npm run deploy- Requires Cloudflare auth (
wrangler login) and secrets set:wrangler secret put DATABASE_URLwrangler secret put OPENAI_API_KEY(optional)wrangler secret put CHITTYCONNECT_API_BASE(e.g.https://connect.chitty.cc/api)wrangler secret put CHITTYCONNECT_API_TOKEN(server-to-server auth to ChittyConnect)
- Requires Cloudflare auth (
Server uses ChittyConnect when configured to fetch Mercury data via static egress and supports selecting multiple bank accounts.
- Env:
CHITTYCONNECT_API_BASE,CHITTYCONNECT_API_TOKEN,CHITTY_CONNECT_URLCHITTYCONNECT_KEEPALIVE_MINUTES(default 50) — background refresh cadence
- Endpoints:
GET /api/mercury/accounts— list accounts via ChittyConnectPOST /api/mercury/select-accounts— persist selected account IDsGET /connect— redirects toCHITTY_CONNECT_URL(defaulthttps://connect.chitty.cc)
- UI:
- Settings → Integrations → Mercury
- “Connect” opens ChittyConnect
- “Manage accounts” scrolls to account selector
- Tokens are proactively refreshed in the background when configured
- Settings → Integrations → Mercury
Note: The server bundle targets Node ESM. The Workers config enables node_compat, but some Node/Express patterns may not be fully supported on Workers without additional adaptation. For traditional Node deploys, run npm start on a VM or container with Postgres access.