Saleor E-commerce Platform
Saleor headless e-commerce with GraphQL.
Overview
Saleor is a modern, headless e-commerce platform built with Python and Django that provides a GraphQL-first API for building custom shopping experiences. Originally created by Mirumee Software in 2018, Saleor separates the commerce backend from the frontend presentation layer, allowing developers to build native mobile apps, progressive web applications, or traditional websites while maintaining a single source of truth for product catalogs, inventory, and order management. This Docker stack combines Saleor's core API with PostgreSQL for robust relational data storage, Redis for high-performance caching and session management, and Celery workers for asynchronous task processing. PostgreSQL handles complex product relationships, customer data, and transactional integrity required for e-commerce operations, while Redis accelerates API responses through intelligent caching and manages real-time features like cart sessions. The Celery worker processes background tasks such as sending order confirmation emails, processing webhook notifications to external systems, and generating product export files without blocking the main API. This configuration is ideal for developers building scalable e-commerce solutions that require API-first architecture, whether creating multi-channel retail experiences, marketplace platforms, or custom B2B commerce applications that need to integrate with existing enterprise systems.
Key Features
- GraphQL API with real-time playground for testing queries, mutations, and schema exploration at /graphql/
- Headless architecture enabling custom storefront development with React, Vue, mobile apps, or any frontend framework
- Multi-tenant product catalog with variant support, digital products, and complex pricing rules managed through Django admin
- PostgreSQL-powered inventory tracking with stock locations, reservations, and automated low-stock notifications
- Redis-cached session management for cart persistence, user preferences, and API response optimization
- Celery-based asynchronous processing for email campaigns, payment webhooks, order fulfillment, and data exports
- Built-in payment gateway integrations supporting Stripe, Braintree, and custom payment processors through plugins
- Advanced tax calculation engine with support for multiple jurisdictions and automated compliance reporting
Common Use Cases
- 1Building custom e-commerce storefronts for fashion retailers requiring complex product variants and size matrices
- 2Creating marketplace platforms where multiple vendors manage their own product catalogs and inventory
- 3Developing mobile-first shopping apps that need native iOS/Android interfaces connected to robust backend APIs
- 4Implementing B2B commerce solutions with custom pricing tiers, bulk ordering, and account-based purchasing workflows
- 5Launching headless commerce for content-driven brands integrating shopping with editorial content management
- 6Building subscription commerce platforms requiring recurring billing and automated inventory replenishment
- 7Creating omnichannel retail experiences connecting online stores with point-of-sale and warehouse management systems
Prerequisites
- Docker Engine 20.10+ and Docker Compose with minimum 4GB RAM allocated for PostgreSQL and Redis operations
- Available ports 8000 (Saleor API) with additional ports needed if deploying separate Saleor Dashboard frontend
- Environment variables configured: DB_USER, DB_PASSWORD, SECRET_KEY (generate 50+ character Django secret key)
- Basic understanding of GraphQL queries and mutations for API interaction and testing
- Python/Django knowledge helpful for customizing Saleor models, adding payment integrations, or developing plugins
- PostgreSQL administration skills for database maintenance, backup strategies, and performance optimization
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 saleor-api: 3 image: ghcr.io/saleor/saleor:latest4 container_name: saleor-api5 restart: unless-stopped6 ports: 7 - "${API_PORT:-8000}:8000"8 environment: 9 - DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor10 - REDIS_URL=redis://saleor-redis:6379/011 - SECRET_KEY=${SECRET_KEY}12 - ALLOWED_HOSTS=localhost13 depends_on: 14 - saleor-db15 - saleor-redis1617 saleor-db: 18 image: postgres:15-alpine19 container_name: saleor-db20 restart: unless-stopped21 environment: 22 - POSTGRES_USER=${DB_USER}23 - POSTGRES_PASSWORD=${DB_PASSWORD}24 - POSTGRES_DB=saleor25 volumes: 26 - saleor_db_data:/var/lib/postgresql/data2728 saleor-redis: 29 image: redis:7-alpine30 container_name: saleor-redis31 restart: unless-stopped32 volumes: 33 - redis_data:/data3435 saleor-worker: 36 image: ghcr.io/saleor/saleor:latest37 container_name: saleor-worker38 restart: unless-stopped39 command: celery -A saleor worker --loglevel=info40 environment: 41 - DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor42 - REDIS_URL=redis://saleor-redis:6379/043 - SECRET_KEY=${SECRET_KEY}44 depends_on: 45 - saleor-db46 - saleor-redis4748volumes: 49 saleor_db_data: 50 redis_data: .env Template
.env
1# Saleor2API_PORT=80003DB_USER=saleor4DB_PASSWORD=saleor_password5SECRET_KEY=your_secret_keyUsage Notes
- 1Docs: https://docs.saleor.io/
- 2GraphQL Playground at http://localhost:8000/graphql/
- 3Deploy Saleor Dashboard separately: npx saleor-dashboard
- 4Celery worker handles async tasks: emails, webhooks, exports
- 5Migrate: docker exec saleor-api python manage.py migrate
- 6Create superuser: docker exec -it saleor-api python manage.py createsuperuser
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
saleor-api
saleor-api:
image: ghcr.io/saleor/saleor:latest
container_name: saleor-api
restart: unless-stopped
ports:
- ${API_PORT:-8000}:8000
environment:
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor
- REDIS_URL=redis://saleor-redis:6379/0
- SECRET_KEY=${SECRET_KEY}
- ALLOWED_HOSTS=localhost
depends_on:
- saleor-db
- saleor-redis
saleor-db
saleor-db:
image: postgres:15-alpine
container_name: saleor-db
restart: unless-stopped
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=saleor
volumes:
- saleor_db_data:/var/lib/postgresql/data
saleor-redis
saleor-redis:
image: redis:7-alpine
container_name: saleor-redis
restart: unless-stopped
volumes:
- redis_data:/data
saleor-worker
saleor-worker:
image: ghcr.io/saleor/saleor:latest
container_name: saleor-worker
restart: unless-stopped
command: celery -A saleor worker --loglevel=info
environment:
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor
- REDIS_URL=redis://saleor-redis:6379/0
- SECRET_KEY=${SECRET_KEY}
depends_on:
- saleor-db
- saleor-redis
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 saleor-api:5 image: ghcr.io/saleor/saleor:latest6 container_name: saleor-api7 restart: unless-stopped8 ports:9 - "${API_PORT:-8000}:8000"10 environment:11 - DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor12 - REDIS_URL=redis://saleor-redis:6379/013 - SECRET_KEY=${SECRET_KEY}14 - ALLOWED_HOSTS=localhost15 depends_on:16 - saleor-db17 - saleor-redis1819 saleor-db:20 image: postgres:15-alpine21 container_name: saleor-db22 restart: unless-stopped23 environment:24 - POSTGRES_USER=${DB_USER}25 - POSTGRES_PASSWORD=${DB_PASSWORD}26 - POSTGRES_DB=saleor27 volumes:28 - saleor_db_data:/var/lib/postgresql/data2930 saleor-redis:31 image: redis:7-alpine32 container_name: saleor-redis33 restart: unless-stopped34 volumes:35 - redis_data:/data3637 saleor-worker:38 image: ghcr.io/saleor/saleor:latest39 container_name: saleor-worker40 restart: unless-stopped41 command: celery -A saleor worker --loglevel=info42 environment:43 - DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@saleor-db/saleor44 - REDIS_URL=redis://saleor-redis:6379/045 - SECRET_KEY=${SECRET_KEY}46 depends_on:47 - saleor-db48 - saleor-redis4950volumes:51 saleor_db_data:52 redis_data:53EOF5455# 2. Create the .env file56cat > .env << 'EOF'57# Saleor58API_PORT=800059DB_USER=saleor60DB_PASSWORD=saleor_password61SECRET_KEY=your_secret_key62EOF6364# 3. Start the services65docker compose up -d6667# 4. View logs68docker 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/saleor-ecommerce-stack/run | bashTroubleshooting
- saleor-api container exits with database connection errors: Ensure PostgreSQL container is fully initialized before API startup, increase depends_on wait time or add healthcheck
- GraphQL playground returns 500 errors on queries: Run database migrations with 'docker exec saleor-api python manage.py migrate' to create required tables
- Celery worker shows 'No module named saleor' errors: Verify both saleor-api and saleor-worker containers use identical environment variables and image versions
- Redis connection timeouts during high traffic: Increase Redis memory limits and configure Redis persistence (AOF) for session data recovery
- Product images not displaying in API responses: Configure MEDIA_URL and MEDIA_ROOT environment variables, ensure proper volume mounting for file uploads
- Payment webhooks failing with timeout errors: Check Celery worker logs and increase task timeout settings, verify external payment provider webhook URLs are reachable
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
Components
saleorpostgresqlrediscelery
Tags
#saleor#ecommerce#headless#graphql
Category
E-Commerce & BusinessAd Space
Shortcuts: C CopyF FavoriteD Download