Architecture & Tech Stack
What's actually deployed, what the LLM is, where BC is on the wire, and the production-path pieces that are documented but not yet wired. Verified against deployed code on 2026-05-12. Per-slice Reality today in the Strategy panel (s) cites specifics; this page is the common stack.
Deployed surfaces
All six are live on the BigCommerce Testing Cloudflare account (5e70ef24…),
project-namespaced as paradigm-*. The SE walks Andy through the first
four; the last two support the build team.
| Surface | URL | Stack |
|---|---|---|
| Prototype | paradigm-prototype.pages.dev | SvelteKit 2.57 + adapter-cloudflare 7 → CF Pages |
| Storefront | paradigm-storefront.bigcommerce-testing-7727.workers.dev | SvelteKit + adapter-cloudflare → CF Worker |
| Admin | paradigm-admin.pages.dev | Vite + React 18 + BigDesign 2.4 → CF Pages |
| API | paradigm-api.bigcommerce-testing-7727.workers.dev | Plain CF Worker (no framework) routing by URL prefix |
| Hive MCP | paradigm-hive-mcp.bigcommerce-testing-7727.workers.dev | CF Worker + D1 + Phase-1 token broker (per ADR-0007) |
| Hive Dashboard | paradigm-hive-dashboard.pages.dev | Static SPA on CF Pages |
Request path — Live LLM (MM1.1, MM2.1, MM2.2, EE2.1)
Four of the thirteen capabilities exercise the LLM on the wire today. They all follow the same
path through apps/api/src/lib/ai.ts:runChat:
Browser (slice page) │ form POST ▼ SvelteKit +page.server.ts // runs in storefront or prototype CF Worker │ apiFetch('/mm1/chat', body) ▼ paradigm-api Worker // apps/api/src/scenarios/mm1.ts:handleChat │ runChat(env, messages, opts) ▼ apps/api/src/lib/ai.ts // KV cache check first │ ┌──── hit? → return cached text (+ trace 'cache_hit' to D1) │ └──── miss ▼ env.AI.run('@cf/meta/llama-3.1-8b-instruct', { messages, max_tokens, temperature }) │ // Workers AI binding — runs on CF AI GPU pool ▼ response.response (string) │ extractJson<T>() — strips ```json fences, parses JSON object │ recordTrace() — D1 agent_traces table │ env.CACHE.put(key, text, ttl) — KV with TTL ▼ JSON back to SvelteKit page → DOM
Latency envelope: KV cache hit ≈ 10–50ms · LLM call (miss) ≈ 800–2400ms. Visible to the user via meta.model_latency_ms in the response JSON.
Worker bindings
From apps/api/wrangler.toml + apps/api/src/types.ts:Env.
| Binding | Kind | Resource | Used for |
|---|---|---|---|
| AI | Workers AI | CF AI binding | All LLM calls via env.AI.run(model, …) |
| DB | D1 | paradigm-api-d1 | Scenario state (reorder_predictions, atrisk_signals, budgets, agent_traces, etc.) |
| CACHE | KV | paradigm-cache | Prompt-response cache · rate-limit counters · session bridge |
| UPLOADS | R2 | paradigm-uploads | Documented for EE2.1 BOM photo input · not used in deployed text-parse demo |
| VECTORIZE | Vectorize | paradigm-rag | Documented for MM2.2 + EE2.1 RAG · deferred (CF token Vectorize Admin scope blocker) |
| EVENTS_QUEUE | Queue | paradigm-events | Producer + consumer for cross-scenario events |
LLM call map — where the AI actually runs
Four runChat() callsites across the 13 capabilities. Other scenarios
either heuristic-only (no LLM today) or stub.
| Capability | File · line | Prompt cache key | TTL |
|---|---|---|---|
| MM1.1 | apps/api/src/scenarios/mm1.ts:50 | mm1.1:<hash(msg)> | 1h |
| MM2.1 | apps/api/src/scenarios/mm2.ts:47 | mm2.1:<sku>:<segment> | 24h |
| MM2.2 | apps/api/src/scenarios/mm2.ts:94 | mm2.2:<anchorSku> | 24h |
| EE2.1 | apps/api/src/scenarios/ee2.ts:42 | ee2.1:<hash(desc)> | 1h |
Default model: @cf/meta/llama-3.1-8b-instruct (8B Llama 3.1 Instruct,
Workers AI tier). Per-call model override is supported but not used today. All scenarios use the
same model.
BC integration points — where BigCommerce is on the wire
Two BC API clients in apps/api/src/lib/. Three capabilities call them
in the deployed code today.
bc-client.ts — BC core RESTapi.bigcommerce.com/stores/cdfqf9k6zf/v3/… · Auth: X-Auth-Token · Token: BIGCOMMERCE_ACCESS_TOKEN secretb2b-client.ts — B2B Edition RESTapi.bigcommerce.com/b2b/management/… · Auth: X-Auth-Token (legacy authToken deprecated 2025-09-30) · Token: BIGCOMMERCE_B2B_ACCESS_TOKEN secret (split per 2026-05-09)registerPartner (POST /companies — creates real Company in sandbox) · EE1.4 unifiedOrders (GET /orders — pulls real B2B Edition orders) · MM1.3 handleCompliance (GET /companies/{id} for company name).Sandbox store: cdfqf9k6zf. Seeded catalog: 6 real products
(#2973-#2978) via scripts/seed-catalog.ts (commit 99d738d). Product
IDs surfaced in MM1.1, EE2.1 LLM responses resolve to these.
What's NOT in the stack
Common questions an evaluator might ask. Truthful answers prevent overclaim damage.
- No Anthropic Claude API. No OpenAI API. Pure Workers AI binding.
- No tool / function calling. One-shot prompt → text → JSON-extract. The "tool-use over catalog" claim in some strategy panels is aspirational; the catalog is statically embedded in the system prompt as a hardcoded list.
- No streaming. Single completion; the user sees latency as a "Parsing…" spinner, not token-by-token render.
- No RAG / no Vectorize. Binding is commented out in
wrangler.tomldue to CF token Vectorize Admin scope. MM2.2 bundling + EE2.1 BOM matching documented to use RAG; deferred until the scope is granted. - No vision model for EE2.1 today. The "field photo → SKU" capability (Klevu's territory) is text-input only.
- No BC catalog API on the wire for MM1.1 / EE2.1 / MM2.1. Productions reads are documented; deployed code uses hardcoded
MOCK_PRODUCTSagainst the seeded sandbox SKU IDs. - No real payment processing for EE1.2. Settlement math demos the BC checkout integration surface; Stripe Connect / Adyen MarketPay / HyperWallet are the production answer.
- No PROS pricing on the wire (ADR-0006 locked stub). MCP procurement handshake (EE2.3) — server is deployed, live Claude→MCP demo requires Claude Desktop config on the demo machine.
Hive coordination (separate stack)
The Hive layer (ADR-0003) is a multi-agent coordination + secret broker layer used by the build team. It's not part of the demo product surface. Listed here because Andy may ask "what's the Hive thing?"
paradigm-hive-mcp) + D1 (paradigm-hive-d1) + dashboard. Cloned from bc-subscriptions/.hive.Reference docs
docs/SE-HANDOFF.md— SE launch page with 13-capability mapdocs/content/02-feasibility.md§"Per-capability reality check" — truth column per capabilitydocs/decisions/0001-0007— locked ADRs (storefront stack, infra, Hive, PROS stub, token broker, etc.)apps/api/src/lib/ai.ts— Workers AI helper (cache + trace)apps/api/src/lib/bc-client.ts·b2b-client.ts— BC core + B2B Edition clientsapps/api/wrangler.toml— Worker bindings + cron schedule