Runtime Architecture
ChyperAI runs on Cloudflare:
- Pages Functions: handle API routes under /api/* inside the repo's functions/ directory.
- Worker (chyperai-worker): hosts Durable Objects (WorkspaceLock) and can run backend tasks.
- Durable Objects: stateful coordination units; WorkspaceLock prevents conflicting operations per workspace.
- D1 (chyperai_db): relational persistence backed by Cloudflare’s SQLite service.
Bindings & configuration:
- DO_WORKSPACE → Durable Object namespace bound to chyperai-worker script.
- DB → D1 binding chyperai_db; migrations in db/migrations/.
- Environment: Clerk/GitHub secrets and runtime flags in wrangler.toml.
Flow:
- Request hits Cloudflare Pages.
- Functions route resolves and queries D1 / interacts with Durable Objects.
- Responses returned with low latency from edge locations.