Skip to main content

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:

  1. Request hits Cloudflare Pages.
  2. Functions route resolves and queries D1 / interacts with Durable Objects.
  3. Responses returned with low latency from edge locations.