Architecture
Lambda Design
Serverless functions as the atomic unit of Meridian's backend. Every endpoint is a cold-start-optimized, stateless handler deployed at the edge.
Stateless by Default
Each function carries zero in-memory state between invocations. Session data, rate-limit counters, and license lookups live in Upstash KV — reachable in under 2ms from any Vercel edge region.
Cold-Start Budget
Meridian targets a 250ms p99 cold start. Bundles are tree-shaken to under 5MB uncompressed. Heavy dependencies are loaded lazily behind the first request path that needs them.
Idempotency Keys
Every mutation endpoint accepts an Idempotency-Key header. Duplicate submissions within a 24-hour window return the cached response — no double-charges, no duplicate license activations.
Circuit Breakers
When downstream dependencies (KeyAuth, SellAuth) degrade, each lambda opens a per-endpoint breaker after 5 consecutive failures. Requests immediately return a 503 with a retry-after header until the half-open probe succeeds.