CDB System Architecture
Overview
Cody Design Build runs on three interconnected web apps — all sharing a single Supabase database. This document describes how they fit together.
Three Apps
Field — buildbase.vercel.app
The main job management platform. Used daily by David, Phil, and Jerry.
What it does:
- Job tracking (pipeline, active, archived)
- Contact + organization management
- SMS messaging via Twilio
- Calendar (Google Calendar integration)
- Proposals + estimating
- Cost Inbox (bank transactions → coded costs)
- Task management
- Google Contacts sync
Stack: Next.js 14, TypeScript, Tailwind CSS, Supabase
Crew — fieldcrew.vercel.app
PWA for field employees. Time clock + task management from a phone.
What it does:
- Clock in / clock out
- View assigned tasks
- Simple, mobile-first UI
Stack: Next.js, TypeScript, Tailwind CSS, Supabase (shared DB)
Mission Control — cdb-mission-control.vercel.app
Internal financial dashboard for Jerry and David.
What it does:
- Revenue and cost overview
- Job profitability tracking
- High-level financial metrics
Stack: Vanilla HTML/CSS/JS frontend, Vercel serverless API routes (Node ESM), Supabase
Shared Database
All three apps connect to the same Supabase project:
- Project ID:
evfgrjslfrjwyopyzqzx - Region: us-east-1
- Auth: Service key (stored in Vercel env vars per app)
Key tables: jobs, contacts, organizations, tasks, transactions, messages, conversations, team, time_entries, proposals, line_items, cost_codes
Agents
CDB runs four AI agents via OpenClaw on the Mac mini:
| Agent | Role | Workspace |
|-------|------|-----------|
| Jerry | Orchestration + David's direct assistant | ~/.openclaw/workspace/ |
| Phil | CFO/ops — JT, Airtable, contacts, job costing | ~/.openclaw/workspace-phil/ |
| Mickey | Dev — all software builds and deployments | ~/.openclaw/workspace-mickey/ |
| Bobby | Marketing, client comms, email + SMS | ~/.openclaw/workspace-bobby/ |
Rule: All external communications (email, SMS to clients) go through Bobby. Jerry, Phil, and Mickey never send external comms directly.
Data Flow
Plaid → Finta → Supabase → Field Cost Inbox → Coded transactions
JT → Phil queries → Field (read-only via JT API)
Contacts: Field API → Google Contacts (auto-sync, one-way)
SMS inbound: Twilio → /api/sms/inbound → Supabase → Field /messages
SMS outbound: Field /messages → /api/sms/send → Twilio
Calendar: Google Calendar API → Field /calendar (read/write)
Time entries: Crew → Supabase → Field /team
Deployment
All three apps deploy to Vercel. Field and Crew use the Vercel CLI; Mission Control uses GitHub Actions.
# Field
cd ~/.openclaw/workspace/cdb-field
vercel --token $(cat ~/.openclaw/workspace/secrets/vercel-token.txt) --prod
# Mission Control
git push origin main # → GitHub Actions auto-deploys
Credentials & Secrets
All secrets live at ~/.openclaw/workspace/secrets/ on the Mac mini:
| File | What it is |
|------|-----------|
| supabase-service-key.txt | Supabase service role key |
| supabase-mgmt-token.txt | Supabase management API token |
| vercel-token.txt | Vercel deploy token |
| google-tokens.json | Google OAuth tokens (refresh token included) |
| google-oauth-client.json | Google OAuth client credentials |
| jobtread-grant-key.txt | JobTread API grant key |
| airtable-pat.txt | Airtable personal access token |
These are injected as Vercel env vars for each project. Never commit secrets to the repo.