Skip to content

System Overview

Lattice runs on Cloudflare’s edge infrastructure. A single Gateway Worker handles all routing. D1 (SQLite at the edge) is the source of truth. KV provides a read cache with 5-minute TTL. The system fits within Cloudflare’s $5/month paid tier.

┌─────────────┐
│ Gateway │ <- Routes by entity ID
│ Worker │ Hono-based, all endpoints
└──────┬──────┘
┌────────────┼────────────┐
│ │
┌─────┴─────┐ ┌──────┴──────┐
│ D1 │ │ KV │
│ (SQLite) │ │ (cache) │
│ │ │ TTL: 300s │
│ entities │ └─────────────┘
│ telos_* │
│ events │
│ policies │
└───────────┘

From wrangler.toml:

BindingTypeName
DBD1 Databaselattice-db
CACHEKV NamespaceRead cache
ENVIRONMENTVariable"development"

From package.json:

  • hono ^4.7.0 — HTTP framework
  • nanoid ^5.0.0 — ID generation
  • wrangler ^4.0.0 — Cloudflare dev/deploy tooling
  • @cloudflare/workers-types — TypeScript types for Workers runtime