Environment Variables
At minimum, setSPREE_API_URL and SPREE_PUBLISHABLE_KEY in your hosting platform’s dashboard or .env file. See Environment Variables for the full reference — analytics, error tracking, wholesale, emails, and SEO.
Production Build
npm start command starts the production server.
Vercel
Vercel is the recommended deployment platform for Next.js applications.One-Click Deploy
- Push your code to GitHub
- Go to vercel.com/new and import your repository
-
Add environment variables:
SPREE_API_URLandSPREE_PUBLISHABLE_KEY(required)SPREE_WEBHOOK_SECRET,RESEND_API_KEY,EMAIL_FROM— for transactional emailsGTM_ID— optional, Google Tag ManagerSENTRY_DSN,SENTRY_ORG,SENTRY_PROJECT,SENTRY_AUTH_TOKEN— optional, error tracking with readable stack traces
- Click Deploy
Vercel CLI
Preview Deployments
Every pull request gets a unique preview URL, making it easy to test storefront changes before merging. Add your Spree API environment variables to the Vercel project settings so previews connect to your staging API.Docker
A multi-stageDockerfile ships at the repo root. It uses Next.js standalone output to produce a small (~240 MB) image on node:22-alpine, runs as a non-root user, and exposes port 3001.
SPREE_API_URL and SPREE_PUBLISHABLE_KEY are required at build time — the storefront prerenders pages against the Spree API. Point them at a Spree instance reachable from wherever you run docker build (hosted Spree, a tunnel, or host.docker.internal for a local backend on Docker Desktop).Sentry source maps at build time
SENTRY_AUTH_TOKEN is passed via a BuildKit secret so it never lands in image layers or the build cache. The other Sentry vars are regular build args:
Building against a local Spree backend
On Docker Desktop (macOS/Windows), reach the host’s Spree viahost.docker.internal:
Self-Hosted Node.js
For any platform that supports Node.js (Render, Railway, Fly.io, AWS, etc.):- Install dependencies and build:
- Start the production server:
3001. Set the PORT environment variable to change it.
CI/CD
GitHub Actions
Performance Checklist
Before going to production, verify:- API URL points to your production Spree instance (not
localhost) - HTTPS is enabled on both the storefront and the Spree API
- CORS is configured on your Spree API to allow requests from your storefront domain
- Sentry is configured for error monitoring (
SENTRY_DSN) - GTM/GA4 is set up for analytics (
GTM_ID) - Cookie security — the storefront uses
secure: truefor cookies in production (NODE_ENV=production) - Caching — Next.js cache tags are used for efficient revalidation; review your caching strategy for high-traffic stores

