Spree Commerce
Modular Ruby on Rails e-commerce platform.
Overview
Spree Commerce is an open-source, modular e-commerce platform built on Ruby on Rails that has been empowering online retailers since 2007. Known for its API-first architecture and extensible design, Spree provides a complete e-commerce solution with support for multi-store operations, complex product catalogs, and sophisticated order management. The platform's modular approach allows developers to customize every aspect of the shopping experience while maintaining a stable core foundation. This Docker stack combines Spree with PostgreSQL and Redis to create a production-ready e-commerce environment. PostgreSQL serves as the primary database, handling complex product relationships, customer data, and transactional integrity that e-commerce applications demand. Redis complements the stack by providing high-speed caching for product catalogs, session management for customer logins, and background job processing for order fulfillment workflows. The combination delivers the performance and reliability needed for modern online retail operations. This configuration is ideal for startups launching their first online store, established retailers migrating from legacy platforms, and developers building custom e-commerce solutions. The stack's scalability makes it suitable for everything from boutique shops to enterprise marketplaces, while the containerized deployment ensures consistent performance across development and production environments.
Key Features
- Multi-store and multi-vendor marketplace capabilities with shared customer databases
- API-first architecture with both REST and GraphQL endpoints for headless commerce
- Advanced inventory management with stock tracking, variants, and multi-location support
- Flexible tax calculation system supporting multiple jurisdictions and complex rules
- Built-in payment gateway integrations with support for multiple processors
- Product catalog with unlimited variants, options, and digital asset management
- Customer segmentation and promotional engine with coupon and discount management
- Order state machine with customizable workflow and fulfillment tracking
Common Use Cases
- 1Fashion retailers needing complex product variants with size, color, and style combinations
- 2B2B marketplaces requiring custom pricing, bulk orders, and vendor management
- 3Subscription commerce platforms with recurring billing and inventory automation
- 4Multi-brand retailers managing separate storefronts with shared backend systems
- 5International e-commerce sites needing multi-currency and localization support
- 6Digital product stores selling software, courses, or downloadable content
- 7Dropshipping operations requiring automated supplier integration and order routing
Prerequisites
- Docker Engine 20.10+ and Docker Compose 2.0+ installed on your system
- Minimum 2GB RAM available (1GB+ for PostgreSQL, 512MB+ for Redis, 512MB+ for Spree)
- Port 3000 available for Spree storefront and admin interface access
- Basic Ruby on Rails knowledge for customization and troubleshooting
- Understanding of e-commerce concepts like SKUs, variants, and payment processing
- SSL certificate and domain name for production deployments
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 spree: 3 image: spreecommerce/spree:latest4 container_name: spree5 restart: unless-stopped6 environment: 7 DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}8 REDIS_URL: redis://redis:63799 SECRET_KEY_BASE: ${SECRET_KEY}10 volumes: 11 - spree_data:/app/public12 ports: 13 - "3000:3000"14 depends_on: 15 - postgres16 - redis17 networks: 18 - spree1920 postgres: 21 image: postgres:16-alpine22 container_name: spree-postgres23 environment: 24 POSTGRES_DB: ${DB_NAME}25 POSTGRES_USER: ${DB_USER}26 POSTGRES_PASSWORD: ${DB_PASSWORD}27 volumes: 28 - postgres_data:/var/lib/postgresql/data29 networks: 30 - spree3132 redis: 33 image: redis:alpine34 container_name: spree-redis35 networks: 36 - spree3738volumes: 39 spree_data: 40 postgres_data: 4142networks: 43 spree: 44 driver: bridge.env Template
.env
1DB_NAME=spree2DB_USER=spree3DB_PASSWORD=changeme4SECRET_KEY=your-secret-key-hereUsage Notes
- 1Docs: https://docs.spreecommerce.org/
- 2Access storefront at http://localhost:3000, admin at /admin
- 3API-first architecture with REST and GraphQL endpoints
- 4Built on Ruby on Rails - highly customizable via extensions
- 5Multi-store, multi-vendor, multi-currency support
- 6Default admin: spree@example.com / spree123 (change immediately)
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
spree
spree:
image: spreecommerce/spree:latest
container_name: spree
restart: unless-stopped
environment:
DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
REDIS_URL: redis://redis:6379
SECRET_KEY_BASE: ${SECRET_KEY}
volumes:
- spree_data:/app/public
ports:
- "3000:3000"
depends_on:
- postgres
- redis
networks:
- spree
postgres
postgres:
image: postgres:16-alpine
container_name: spree-postgres
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- spree
redis
redis:
image: redis:alpine
container_name: spree-redis
networks:
- spree
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 spree:5 image: spreecommerce/spree:latest6 container_name: spree7 restart: unless-stopped8 environment:9 DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}10 REDIS_URL: redis://redis:637911 SECRET_KEY_BASE: ${SECRET_KEY}12 volumes:13 - spree_data:/app/public14 ports:15 - "3000:3000"16 depends_on:17 - postgres18 - redis19 networks:20 - spree2122 postgres:23 image: postgres:16-alpine24 container_name: spree-postgres25 environment:26 POSTGRES_DB: ${DB_NAME}27 POSTGRES_USER: ${DB_USER}28 POSTGRES_PASSWORD: ${DB_PASSWORD}29 volumes:30 - postgres_data:/var/lib/postgresql/data31 networks:32 - spree3334 redis:35 image: redis:alpine36 container_name: spree-redis37 networks:38 - spree3940volumes:41 spree_data:42 postgres_data:4344networks:45 spree:46 driver: bridge47EOF4849# 2. Create the .env file50cat > .env << 'EOF'51DB_NAME=spree52DB_USER=spree53DB_PASSWORD=changeme54SECRET_KEY=your-secret-key-here55EOF5657# 3. Start the services58docker compose up -d5960# 4. View logs61docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/spree/run | bashTroubleshooting
- Spree container exits with database connection errors: Ensure PostgreSQL container is fully started before Spree boots, add healthcheck or increase depends_on delay
- Asset compilation fails with 'No space left on device': Increase Docker Desktop disk space allocation or clean up unused images and volumes
- Redis connection timeouts during high traffic: Increase Redis memory limit and configure Redis maxmemory-policy to allkeys-lru for better cache management
- PostgreSQL performance degrades with large catalogs: Enable PostgreSQL query logging and add indexes on frequently searched product attributes and categories
- Spree admin interface returns 500 errors: Check SECRET_KEY_BASE environment variable is set and at least 30 characters long
- Image uploads fail or return broken links: Verify spree_data volume is properly mounted and container has write permissions to /app/public directory
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download