Skip to main content
Spree uses environment variables for all deployment configuration. No secrets or credentials are stored in the codebase.

Required

These variables are required to run Spree in production.

URLs and Hosts

RAILS_HOST is the canonical public host of your deployment. URLs Spree generates outside a request context use it — links in emails, webhook payloads, and image/attachment URLs in API responses (for the latter, CDN_HOST takes precedence when set).
When neither RAILS_HOST nor CDN_HOST is configured, image and attachment URLs fall back to the store’s URL setting, which is localhost on a fresh install — API responses will contain https://localhost/... URLs.
Generated URLs use https unless both RAILS_FORCE_SSL and RAILS_ASSUME_SSL are set to false (see SSL).

Email (SMTP)

This configuration is used for system emails (e.g. staff invitations, report ready, export complete). Customer facing emails are handled by the storefront via webhooks.
Spree works with any SMTP provider (Resend, Postmark, Mailgun, SendGrid, Amazon SES, etc.). Set SMTP_HOST to enable email delivery — when not set, no delivery method is configured and production email delivery fails (development opens emails in the browser via letter_opener). Links in emails use the host configured via RAILS_HOST.

Web Server

Application

File Storage (S3 / Cloudflare R2)

By default, uploaded files (product images, assets) are stored on the local filesystem. Set the appropriate credentials to use cloud storage instead. Spree auto-detects the provider based on which credentials are present.

Amazon S3

Cloudflare R2

Search (Meilisearch)

Optional. When configured, Spree uses Meilisearch for product search, filtering, and faceted navigation instead of SQL. After setting these, enable the provider and reindex:

Error Tracking (Sentry)

SSL

By default, Spree assumes it runs behind an SSL-terminating reverse proxy. Set these to false if running without SSL (e.g., local development or behind a proxy that doesn’t do SSL termination).

Local Development

These variables are used when running the server/ app locally (not via DATABASE_URL):