Development Workflow.
How to set up a local development environment and contribute to The Intern.
Prerequisites
Node.js 18+. A Cloudflare account (free tier works). A Neon PostgreSQL database (free tier works). An Anthropic API key (sk-ant-...). A Firebase project with Authentication enabled.
Backend setup
cd backend && npm install. Create backend/.dev.vars with: DATABASE_URL=postgresql://..., ANTHROPIC_API_KEY=sk-ant-..., and optionally GOOGLE_API_KEY (Gemini fallback) and OPENAI_API_KEY (OpenAI fallback). Run npm run dev to start the Hono worker locally on port 8787 via wrangler dev.
Frontend setup
cd frontend && npm install. Create frontend/.env.local with: NEXT_PUBLIC_API_URL=http://localhost:8787 (for local backend) and all NEXT_PUBLIC_FIREBASE_* variables from your Firebase project settings. Run npm run dev to start Next.js on port 3000.
Database schema
The schema is defined in backend/src/db/schema.ts using Drizzle ORM. To push schema changes: npx drizzle-kit push. To seed initial data (credit plans, agent templates, skills): npx tsx src/db/seed.ts.
Deploy backend
cd backend && npm run deploy. This deploys to your Cloudflare Workers account. Set secrets with: npx wrangler secret put ANTHROPIC_API_KEY (also add GOOGLE_API_KEY and OPENAI_API_KEY for the 3-provider fallback). The wrangler.toml configures bindings for Durable Objects and Queues.
Deploy frontend
Connect your repository to Cloudflare Pages. Build command: npm run build. Output directory: .next. Set environment variables in the Cloudflare Pages dashboard. Deployments trigger automatically on git push.