Architecture.

The Intern is built on an edge-first, serverless architecture designed for global scale, low latency, and zero infrastructure management.

Frontend — Next.js 15 on Cloudflare Pages

App Router with React Server Components. Tailwind CSS v4 with a dual-theme design system (light: cream/red #E63221, dark: black/green #22c55e). shadcn/ui component library. Firebase Auth context for session management. GSAP for animations. Deployed via Cloudflare Pages at https://ai-agent-apb.pages.dev.

Backend — Hono v4 on Cloudflare Workers

Hono v4 framework. 28 route modules mounted at /api/*. Middleware stack: logger → CORS (origin: *) → env seeder (setEnv + setGoogleKey). The env seeder caches Cloudflare bindings so all downstream getDb() calls work without explicit env passing. Deployed with npm run deploy.

Database — Neon PostgreSQL + Memgraph

Neon Postgres via Drizzle ORM (users, agent_configurations, agent_memory, skills, workspace_files, knowledge_chunks, etc.). Memgraph is used as a parallel Brain-Graph to maintain semantic relationships and dependencies, queried via the graph-client and MCP tools.

AI — 3-Provider Fallback

Anthropic (Claude) is the primary provider. Google Gemini is fallback 1 (requires GOOGLE_API_KEY). OpenAI is fallback 2 (requires OPENAI_API_KEY). Each provider has an independent circuit breaker. The sketch-runner.ts module handles all LLM interactions with streaming, tool calling, and memory enrichment.

Cloudflare bindings

AGENT_SESSION: Durable Object for stateful agent sessions. TASK_QUEUE: Queue for async job processing with DLQ. HYPERDRIVE_DB: Connection pooling (configured, optional). INTERN_CACHE: KV store for caching (configured, optional). Secrets: ANTHROPIC_API_KEY, GOOGLE_API_KEY, OPENAI_API_KEY, ELEVENLABS_API_KEY, TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, STRIPE_SECRET_KEY, DATABASE_URL.