Engineering blueprint

Built for a million shoppers — and the Monday after.

Every deliverable on this page maps to code in the repository: an edge-first storefront, an event-driven core, tenant-isolated data and a self-learning AI loop that never blocks checkout.

99.99% uptime SLO<20ms webhook acks1M+ active shoppers3 active regions
Open the dashboardRead schema.sql

One request, end to end

A checkout click touches the edge, the API, Postgres, Kafka and WhatsApp without ever waiting on the slowest link.

trace 7d8a91f2
38ms

Edge render

Tenant resolved from the host, HTML served from the nearest PoP.

94ms

Stateless API

Autoscaled pods validate, rate-limit and write through PgBouncer.

18ms ack

Event fan-out

Order event hits Kafka once; consumers confirm, invoice and notify.

1.1s

AI reply

Retrieval, guardrails and streaming answer in the customer's language.

01 / blueprint

Edge-first storefronts

The catalogue is rendered where the customer is. Publishing is a cache-tag invalidation, not a redeploy.

Host-based tenant resolution

A single edge runtime maps 40k+ custom domains to a tenant, locale and experiment bucket with a signed Edge Config read — no origin hop.

Immutable revisions

Every publish writes a versioned document to object storage. The edge pins a revision, so a rollback is one pointer swap.

Tag-based purge

Storefront publishes invalidate tenant-scoped cache tags across 312 PoPs. Median propagation is 1.2s.

Media that never blocks LCP

AVIF/WebP derivatives are generated on upload, served through the CDN with long-lived immutable hashes and responsive srcsets.

Preview without leaking

Draft previews use short-lived HMAC tokens scoped to tenant and revision, so unpublished content is never publicly addressable.

No client downloads

The merchant app is a PWA. WhatsApp confirmation, wizard flows and the AI inbox all work in the browser, including on low-end Android.

Latency budget — storefront

p95 measured at the edge, last 24 hours

SLO met
Edge TTFB38ms / < 50ms
Largest Contentful Paint0.9s / < 2.5s
Cumulative Layout Shift0.01 / < 0.1
Interaction to Next Paint62ms / < 200ms
Global publish purge1.2s / < 5s

PoPs

312

Cache hit

98.4%

Purge p99

2.4s

typescript

Tenant resolution at the edge

One lookup on the hot path. Everything else is cached with the tenant in the key.

export const config = { runtime: "edge" };

export async function middleware(req: NextRequest) {
  const host = req.headers.get("host") ?? "";
  const tenant = await edgeConfig.get(`domain:${host}`);

  if (!tenant) return new NextResponse("Unknown storefront", { status: 404 });

  const res = NextResponse.next();
  res.headers.set("x-tenant-id", tenant.id);
  res.headers.set("x-tenant-region", tenant.region);
  res.headers.set("x-cache-tag", `storefront:${tenant.id}:v${tenant.revision}`);
  return res;
}

Scale math

Designed for 10× the launch load

Numbers below are the planning envelope, not aspiration. Every tier scales horizontally and degrades independently.

Active shoppers

1.2M

300k daily actives · 12k peak RPS at the edge

Orders / minute

4,200

Partitioned writes through 400 PgBouncer connections

AI messages / minute

38,000

Regional model routing with per-tenant spend caps

Events / second

72,000

48 Kafka partitions per hot topic, 3 consumer groups

The guarantee

No single merchant, campaign or carrier outage can take the platform down. Limits are per tenant, queues are bounded, and the DLQ always has a replay path.

Open the dashboard

Every claim on this page has a counterpart in schema.sql, platform/, or the Next.js app.