Environment Variables
Set these variables in your hosting platform’s dashboard or.env file.
Required
| Variable | Description |
|---|---|
SPREE_API_URL | Your Spree API endpoint (e.g., https://api.mystore.com) |
SPREE_PUBLISHABLE_KEY | Publishable API key from your Spree admin |
These are server-side only variables — no
NEXT_PUBLIC_ prefix needed since all API calls happen in Server Actions.Optional
| Variable | Description | Default |
|---|---|---|
GTM_ID | Google Tag Manager container ID | (disabled) |
SENTRY_DSN | Sentry DSN for error tracking | (disabled) |
SENTRY_ORG | Sentry organization slug | (none) |
SENTRY_PROJECT | Sentry project slug | (none) |
SENTRY_AUTH_TOKEN | Sentry auth token (for source maps in CI) | (none) |
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_URL,SPREE_PUBLISHABLE_KEY) - 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
Create aDockerfile in your project root:
Enable standalone output in your
next.config.ts for Docker deployments: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:
3000 by default. 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

