The starter
npm create @sevigram/loom copies the starter: a storefront built with React Router 7 in framework mode, with server rendering and @sevigram/loom.
Home, products, product, collection, services, service booking, cart, order tracking, customer account, contact and not found.
It’s your code: change the design, add pages, or remove what you don’t need.
Settings
Section titled “Settings”npm run dev and npm run preview read .env. npm start reads only the server’s environment, so set the same variables on your host.
| Variable | Purpose |
|---|---|
SEVIGRAM_STOREFRONT_TOKEN |
Required. Public token (sfpub_…), sent to the browser for the cart and checkout. |
SEVIGRAM_STOREFRONT_PRIVATE_TOKEN |
Optional. Private token (sfprv_…), server only. Needed for customer accounts. |
APP_ORIGIN |
Required. The origin shoppers use, for example https://shop.example. Checkout returns to APP_ORIGIN/orders/return. It must be one of the storefront’s allowed origins. |
SEVIGRAM_API_BASE_URL |
Optional. Defaults to https://api.sevigram.com/storefront/v1. |
TRUST_PROXY |
Optional. The number of proxies in front of the server that append to X-Forwarded-For. Default 0, off. See Deploying. |
CLIENT_IP_HEADER |
Optional. A single-value client IP header your proxy sets, such as cf-connecting-ip. Needs TRUST_PROXY of 1 or more. |
SEVIGRAM_DEMO_TOKEN |
Written by the scaffolder for the demo shop. Safe to delete once you use your own token. |
SEVIGRAM_DEMO_ORIGINS |
The demo’s allowed origins. Safe to delete once you use your own token. |
Without a valid public token or APP_ORIGIN, the app shows a “Connect your storefront” page that names the missing variables.
Scripts
Section titled “Scripts”| Script | What it does |
|---|---|
npm run dev |
Development server on http://localhost:5173. |
npm run build |
Production build into build/. |
npm run preview |
Runs the production build with .env. Listens on PORT, else on APP_ORIGIN’s port. |
npm start |
Runs the production build with the host’s environment. |
npm test |
Unit and component tests. |
npm run check |
loom check: verifies the tokens, allowed origin and API version. |
npm run typecheck |
Generates route types and type-checks. |
Prices and locale
Section titled “Prices and locale”The root loader picks a locale from the shop’s country, for example en-NG, and passes it to StorefrontProvider, so prices and dates render the same on the server and in the browser.
The starter’s tests never call the real API. They use the msw handlers and contract fixtures from @sevigram/storefront-client/testing:
import { setupServer } from "msw/node";import { handlers } from "@sevigram/storefront-client/testing";
const server = setupServer(...handlers("https://storefront.test/v1"));The fixtures are checked against the Storefront API’s OpenAPI contract, so your tests break if you rely on a shape the API doesn’t send.