Developer Guide
Local development
Clone, install, configure, and run Command Inbox locally
Prerequisites
| Tool | Version |
|---|---|
| Bun | Latest stable |
| Node-compatible OS | macOS, Linux, or WSL on Windows |
| Neon Postgres | Or local Postgres 16+ with pgvector |
| Google Cloud project | Gmail + Calendar OAuth credentials |
Optional for Phase 2+:
- Google AI (Gemini) and/or OpenAI API key
- Pusher Channels app
- GCP Pub/Sub topic + ngrok for webhooks
1. Clone and install
git clone <repo-url> commad-inbox
cd commad-inbox
bun installThis installs the root app and workspace packages (including apps/docs).
2. Environment
Copy the example env file:
cp .env.example .env.localFill in at minimum Phase 0 variables:
| Variable | How to get it |
|---|---|
DATABASE_URL | Neon connection string (pooled) |
CORSAIR_KEK | openssl rand -base64 32 — keep stable |
GOOGLE_CLIENT_ID / SECRET | Google Cloud OAuth client |
BETTER_AUTH_SECRET | openssl rand -base64 32 |
See Environment variables for the full list.
3. Database and Corsair
bun run db:migrate
bun run corsair:setupOptional sanity check:
bun run smoke:corsairOr run all Phase 0 steps:
bun run phase0If you change CORSAIR_KEK after setup, run bun run corsair:reset — existing encrypted tokens become unreadable.
4. Start the dev server
bun devOpen http://localhost:3000.
If port 3000 is busy, Next.js may use 3001 — check terminal output and match ngrok accordingly.
5. Sign in and connect
- Sign in with Google
- Complete Connect Google for Gmail + Calendar
- Wait for backfill on
/inbox
6. Phase 2 local webhooks (optional)
For realtime triage during development:
- Set AI keys in
.env.local - Configure Pub/Sub per Webhooks & realtime
- Run ngrok:
ngrok http 3000(or 3001) - Set
APP_URLto the ngrok HTTPS URL - Restart dev server
7. Documentation site
Run the Fumadocs app locally:
bun run docs:devOpen http://localhost:3001 (docs app default port).
Build docs:
bun run docs:buildCommon scripts
| Script | Purpose |
|---|---|
bun dev | Main app dev server |
bun run db:migrate | Apply Drizzle migrations |
bun run db:studio | Drizzle Studio GUI |
bun run corsair:setup | Initialize Corsair integrations |
bun run gmail:watch | Register Gmail push watch |
bun run docs:dev | Docs site dev server |
Full list: Scripts & CLI.
Next steps
- Corsair setup — OAuth and tenant details
- Webhooks & realtime — Pub/Sub + Pusher
- Troubleshooting