Architecture · Stack
Paradigm B2B — request paths, bindings, models, BC integration points
Prototype

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.

SurfaceURLStack
Prototypeparadigm-prototype.pages.devSvelteKit 2.57 + adapter-cloudflare 7 → CF Pages
Storefrontparadigm-storefront.bigcommerce-testing-7727.workers.devSvelteKit + adapter-cloudflare → CF Worker
Adminparadigm-admin.pages.devVite + React 18 + BigDesign 2.4 → CF Pages
APIparadigm-api.bigcommerce-testing-7727.workers.devPlain CF Worker (no framework) routing by URL prefix
Hive MCPparadigm-hive-mcp.bigcommerce-testing-7727.workers.devCF Worker + D1 + Phase-1 token broker (per ADR-0007)
Hive Dashboardparadigm-hive-dashboard.pages.devStatic 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 WorkerapiFetch('/mm1/chat', body)paradigm-api Worker                  // apps/api/src/scenarios/mm1.ts:handleChatrunChat(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 poolresponse.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.

BindingKindResourceUsed for
AIWorkers AICF AI bindingAll LLM calls via env.AI.run(model, …)
DBD1paradigm-api-d1Scenario state (reorder_predictions, atrisk_signals, budgets, agent_traces, etc.)
CACHEKVparadigm-cachePrompt-response cache · rate-limit counters · session bridge
UPLOADSR2paradigm-uploadsDocumented for EE2.1 BOM photo input · not used in deployed text-parse demo
VECTORIZEVectorizeparadigm-ragDocumented for MM2.2 + EE2.1 RAG · deferred (CF token Vectorize Admin scope blocker)
EVENTS_QUEUEQueueparadigm-eventsProducer + 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.

CapabilityFile · linePrompt cache keyTTL
MM1.1apps/api/src/scenarios/mm1.ts:50mm1.1:<hash(msg)>1h
MM2.1apps/api/src/scenarios/mm2.ts:47mm2.1:<sku>:<segment>24h
MM2.2apps/api/src/scenarios/mm2.ts:94mm2.2:<anchorSku>24h
EE2.1apps/api/src/scenarios/ee2.ts:42ee2.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 REST
Base: api.bigcommerce.com/stores/cdfqf9k6zf/v3/… · Auth: X-Auth-Token · Token: BIGCOMMERCE_ACCESS_TOKEN secret
Used by: nothing on the wire today (catalog queries documented but not deployed). Wires the future-state for MM1.1, EE2.1, MM2.1 catalog reads.
b2b-client.ts — B2B Edition REST
Base: api.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)
Used by: EE1.1 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.toml due 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_PRODUCTS against 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?"

What it is: A CF Worker (paradigm-hive-mcp) + D1 (paradigm-hive-d1) + dashboard. Cloned from bc-subscriptions/.hive.
What it does: Coordinates work across agent sessions (task claims, locks, decisions). Acts as a secret broker (per ADR-0007) so agents request short-lived BC API tokens scoped to their role rather than holding long-lived credentials.
What it's NOT: Customer-facing. End-users (buyers, merchants, Andy) never interact with Hive.

Reference docs

  • docs/SE-HANDOFF.md — SE launch page with 13-capability map
  • docs/content/02-feasibility.md §"Per-capability reality check" — truth column per capability
  • docs/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 clients
  • apps/api/wrangler.toml — Worker bindings + cron schedule
Stack verified against deployed code 2026-05-12. If a per-slice Strategy panel describes the stack differently, this page is the source of truth — please flag the discrepancy so it can be reconciled.