Skip to content

Platform Overview

This section covers cross-cutting concerns: systems that multiple apps depend on and that have contracts worth understanding before touching any single app.

Current coverage

TopicStatus
File StorageFull deep-dive — lifecycle, cleanup safety, consumers, risk register, verification
Auth / JWTStub — expand when needed
Queues (CLEANUP_QUEUE, EMBEDDING_QUEUE)Stub
Cron scheduleCovered inside File Storage → Cleanup Safety
Hyperdrive / DB access patternsStub
Rate limiting (Durable Objects)Stub
Feature flagsSee packages/feature-flags/AGENTS.md in the repo

Design principles

  1. Single source of truth per concern. One table, one service, one function owns each invariant. Cross-cutting duplication is a smell.
  2. Layered defense for destructive operations. Anything that deletes data uses ≥3 independent gates. See File Storage → Cleanup Safety for the canonical example.
  3. API is the only R2 writer / deleter. Web, mobile, admin, cal, ai-worker, clipper never call env.STORAGE.put or .delete directly.
  4. Migrations are additive. Rename/drop columns in two deploys (add new → backfill → switch readers → drop old).