Skip to main content

Quickstart

storefront-web needs no database, no Kafka and no secret. Its only dependency is the storefront-bff, and for local work you do not even need that: the repository ships an in-memory stub BFF (server/stub*.ts).

note

The commands and responses below are derived from the code on this branch (package.json, Makefile, server/). They are not pasted from a captured terminal session.

Prerequisites​

ToolVersionWhy
Node.js>=22.18 (engines in package.json; .nvmrc says 22)the server runs TypeScript directly (node server/index.ts), which needs Node's native type stripping
npmthe one that ships with Node 22npm ci against the committed package-lock.json
Chromium for Playwrightinstalled once with npx playwright install chromiumnpm run e2e
Chromeany recent; set CHROME_PATH if it is not foundnpm run lhci
GNU makeanyoptional thin wrappers over npm
Dockeroptionaldocker build -t storefront-web:ci .
Helm, Python 3optionalchart tests under charts/storefront-web/tests/ and the harness linters under scripts/harness/

Run it against the stub BFF (no backend)​

npm ci
npm run build
npm run start:stub # STOREFRONT_STUB=1 node server/index.ts, listening on :3000

The server logs storefront-web listening on :3000 (stub BFF). Open http://localhost:3000/. The stub serves synthetic departments and products (for example item-kettle, item-mug) and enforces the same contract as the real BFF: a 3-character destination prefix, 422 session-required on GET /carts without a shopper, problem+json errors. Typing the ZIP 78701 (prefix 787) gives delivery promises; 10001 is answered "not served".

First calls, from another terminal:

curl -i http://localhost:3000/healthz # 200, body: ok
curl -s http://localhost:3000/api/storefront/categories # the department tree
curl -s 'http://localhost:3000/api/storefront/products?q=kettle' # search hits and facets
curl -i -X POST http://localhost:3000/api/storefront/carts # 201 and Set-Cookie: sf_state=...; Path=/api/storefront; HttpOnly

Run it against a real BFF​

BFF_URL=http://127.0.0.1:8080 npm run dev # Vite dev server with HMR on :5180
npm run build
BFF_URL=http://127.0.0.1:8080 npm start # production server on :3000

BFF_URL is the BFF origin (the server appends /api/storefront). When pointing at the platform gateway, use its origin, for example BFF_URL=http://localhost:8000 PORT=3200 npm start. See Configuration for every variable and Integration for the routes called.

Command reference​

CommandWhat it does
npm ci / make installinstall the locked dependencies
npm run devreact-router dev --port 5180
npm run build / make buildreact-router build into build/client and build/server
npm startnode server/index.ts: SSR, static assets, /healthz, /readyz, the /api/storefront proxy
npm run start:stubthe same with STOREFRONT_STUB=1
npm run lint / make linteslint .
npm run typecheck / make typecheckreact-router typegen && tsc --noEmit
npm test / make testvitest run
npm run test:coverage / make coveragevitest with the thresholds of vitest.config.ts
npm run check:bundlethe no-network-url-in-bundle sensor over build/client (run npm run build first)
make bundle-checkbuild then check:bundle
npm run e2e / make e2ePlaywright journeys, building and serving the stub on port 3100
npm run e2e:liveone real purchase against a live storefront (E2E_LIVE=1, base http://storefront.localhost unless E2E_BASE_URL is set)
npm run lhciLighthouse CI budgets (mobile); LHCI_FORM_FACTOR=desktop for desktop
make lighthousebuild, then lhci for mobile and for desktop
make checklint, typecheck, test, build
make check-fastlint, typecheck (the agent Stop hook gate)
make check-alllint, typecheck, coverage, bundle-check, e2e
make guide-lintpython3 scripts/harness/guide_lint.py
make harness-testtest_hook.py and test_red_issue.py

Build and run the image​

docker build -t storefront-web:local .
docker run --rm -p 3000:3000 -e BFF_URL=http://host.docker.internal:8080 storefront-web:local

The build stage runs npm run build && npm run check:bundle, so an image never exists with a leaking bundle. The runtime stage is node:22-slim as user node, port 3000, with a HEALTHCHECK on /healthz.

Where to go next​