Skip to content

System Map and Infrastructure Overview

Single reference for what the system is and how components connect. For ADRs and deeper design, see decisions/, runtime/, and systems/.


1. High-Level System Map

┌─────────────────────────────────────────────────────────────────────────────────┐
│                              CepatEdge (CepatEdge)                               │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                  │
│   ┌──────────────┐         ┌──────────────────────────────────────────────────┐   │
│   │   Browser    │  HTTPS  │           Cloudflare Edge (global)              │   │
│   │   (Users)    │────────▶│  ┌─────────────┐    ┌─────────────────────┐   │   │
│   └──────────────┘         │  │ Pages (SPA) │    │ Workers (Hono API)   │   │   │
│                            │  │ React (Vite)│    │ Auth, Me, Maintenance│   │   │
│                            │  └──────┬──────┘    └──────────┬──────────┘   │   │
│                            │         │                      │               │   │
│                            │         │                      │               │   │
│                            │         │              ┌───────▼───────┐       │   │
│                            │         │              │ Durable Obj  │       │   │
│                            │         │              │ Sessions +   │       │   │
│                            │         │              │ Cache (DO)    │       │   │
│                            │         │              └───────┬───────┘       │   │
│                            │         │                      │               │   │
│                            └─────────┼──────────────────────┼───────────────┘   │
│                                      │                      │                   │
│   ┌──────────────────────────────────┼──────────────────────┼──────────────┐   │
│   │         External services         │                      │              │   │
│   │  ┌────────────┐  ┌────────────┐   │   ┌────────────┐    │              │   │
│   │  │ Neon       │  │ R2         │   │   │ Email       │    │              │   │
│   │  │ PostgreSQL │◀─┼────────────┼───┼───┤ (notifications)   │              │   │
│   │  │ (DB)       │  │ (Storage)  │   │   └────────────┘    │              │   │
│   │  └────────────┘  └────────────┘   │                      │              │   │
│   └──────────────────────────────────┼──────────────────────┼──────────────┘   │
│                                                                                  │
└─────────────────────────────────────────────────────────────────────────────────┘

2. Request Flow (Simplified)

  1. User → HTTPS → Cloudflare Edge.
  2. Static/frontendCloudflare Pages (React + Vite SPA build); APICloudflare Workers (Hono).
  3. Workers:
    • Resolve auth (JWT + Durable Objects session).
    • Hit cache (DO) when applicable; on miss, call Neon (Drizzle).
    • For file read/write: R2 (avatars, maintenance attachments).
    • For notifications: Email (e.g. SMTP / provider).
  4. Response back through edge to browser.

3. Infrastructure Diagram (By Provider)

LayerTechnologyPurpose
Edge / CDNCloudflareTLS, DDoS, routing, edge execution.
Compute (API)Cloudflare WorkersHono app: auth, me, maintenance, system routes.
Compute (UI)Cloudflare PagesStatic/SPA frontend.
State / cacheDurable ObjectsSessions, cache instances (per namespace).
DatabaseNeon (PostgreSQL)Persistent data (users, requests, attachments metadata).
Object storageCloudflare R2Bucket cepatedge — avatars, maintenance attachments.
EmailConfigurableNotifications (e.g. welcome, maintenance assigned).

Public URLs (production)

RoleDomainApp
Marketingcepatedge.comapps/landing
Product SPAapp.cepatedge.comapps/web
APIapi.cepatedge.comapps/worker
Docsdocs.cepatedge.comapps/docs
Git analyticsgit.cepatedge.comapps/git

Auth cookies (.cepatedge.com) apply to app + API only. See guides/domains.md.


4. Component Map (Logical)

ComponentLocation (code)Depends on
API routesapps/worker/src/routes/Services, middleware
Authservices/auth/JWT, cookies, cache (DO session)
Meroutes/me/, services/me/Auth, storage (avatar), DB
Maintenanceroutes/maintenance/, services/maintenance/Auth, DB, cache, storage (attachments)
Cacheservices/cache/Durable Objects
Storageservices/storage/R2 bindings
DBlib/db/ (Drizzle)Neon
Mailerservices/mailer/Email provider

5. Data Flow Summary

  • Auth: Login → validate creds (DB) → create session (DO) → set cookie (JWT + session id). Later requests: cookie → DO session + JWT verify.
  • Maintenance: CRUD and workflow (create/approve/assign/complete) → DB; cache (DO) used for reads when enabled; attachments → R2, metadata in DB.
  • Avatar: Upload → R2 + DB path; GET → R2 stream.
  • Backups: Neon’s built-in backups; optional copy to R2 (see Runbook).

6. Where to Go Next

  • System /system/* observability (logs, audit, monitor, settings): SYSTEM.md at repository root — types, list vs detail, writers, cross-navigation; complete this track before leaning on dashboard analytics for the same surfaces.
  • Admin dashboard & analytics (cache metrics, KPI payloads): DASHBOARD.md at repository root — AnalyticsCacheService, consolidated endpoints, /system/cache and /system/settings hints.
  • Decisions: ADR index (edge-first, DO, Neon, R2, Hono, etc.).
  • DO vs KV analysis: do-vs-kv-analysis.md — Why DO (not KV) for logs and maintenance cache; timestamp/indexed storage + pagination plan.
  • Runtime limits and behaviour: runtime/.
  • Core systems (auth, maintenance, cache): systems/.
  • Deployment and rollback: Deployment workflow and Runbook.