Sylius + MySQL + Elasticsearch
Symfony-based e-commerce platform with full-text search.
Overview
Sylius is a modern, component-based e-commerce platform built on Symfony framework, designed for developers who need flexibility and customization beyond traditional e-commerce solutions like WooCommerce or Magento. Originally created in 2011, Sylius follows Domain-Driven Design principles and provides a headless commerce approach, making it ideal for businesses requiring multi-channel sales, complex product catalogs, or integration with existing enterprise systems. Unlike monolithic platforms, Sylius separates business logic into reusable components, enabling developers to build custom e-commerce experiences while maintaining core commerce functionality.
This stack combines Sylius with MySQL for transactional data storage, Elasticsearch for advanced product search and filtering, NGINX as a high-performance web server, and MailHog for email testing during development. MySQL handles order processing, customer data, and inventory management with ACID compliance, while Elasticsearch provides faceted search, autocomplete, and product recommendations that scale with catalog size. NGINX serves static assets efficiently and proxies dynamic requests to the PHP application, while MailHog captures all outgoing emails for testing checkout flows, customer notifications, and marketing campaigns without sending real emails.
This configuration targets mid-market retailers, B2B companies, and agencies building custom e-commerce solutions who need enterprise-grade search capabilities and reliable order processing. The combination excels for businesses with complex product catalogs (thousands of SKUs), multiple customer segments, or integration requirements with ERP, CRM, or PIM systems where off-the-shelf platforms fall short.
Key Features
- Symfony-based component architecture enabling custom business logic and workflows
- Full-text product search with faceted filtering, autocomplete, and relevance scoring via Elasticsearch
- Multi-channel commerce support for web, mobile apps, and third-party marketplaces
- Advanced promotion engine with coupon codes, discounts, and customer-specific pricing
- MySQL InnoDB storage with transaction safety for order processing and inventory management
- Flexible taxation system supporting multiple tax zones and complex calculation rules
- REST API for headless commerce implementations and third-party integrations
- Administrative panel with order management, inventory tracking, and customer service tools
Common Use Cases
- 1B2B companies selling to multiple customer tiers with custom pricing and approval workflows
- 2Retailers with large product catalogs requiring advanced search, filtering, and recommendation features
- 3Agencies developing custom e-commerce solutions for clients with specific business requirements
- 4Multi-brand retailers managing separate storefronts with shared inventory and customer data
- 5Marketplace operators connecting multiple vendors with centralized order and payment processing
- 6International businesses requiring multi-currency support and localized tax calculations
- 7Companies migrating from legacy e-commerce systems while maintaining custom integrations
Prerequisites
- Docker and Docker Compose installed with minimum 6GB available RAM for all services
- Ports 80, 8025 available for web interface and MailHog email testing interface
- Basic understanding of Symfony framework and PHP application deployment
- Familiarity with Elasticsearch indexing concepts for product catalog management
- Knowledge of NGINX configuration for SSL termination and performance tuning in production
- MySQL administration skills for 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 sylius: 3 image: sylius/sylius:latest4 environment: 5 - APP_ENV=prod6 - APP_SECRET=${APP_SECRET}7 - DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/sylius8 - ELASTICSEARCH_URL=http://elasticsearch:92009 - MAILER_DSN=smtp://mailhog:102510 volumes: 11 - sylius-public:/app/public/media12 depends_on: 13 - mysql14 - elasticsearch15 networks: 16 - sylius-network17 restart: unless-stopped1819 nginx: 20 image: nginx:alpine21 volumes: 22 - ./nginx.conf:/etc/nginx/nginx.conf:ro23 - sylius-public:/app/public:ro24 ports: 25 - "80:80"26 depends_on: 27 - sylius28 networks: 29 - sylius-network30 restart: unless-stopped3132 mysql: 33 image: mysql:8.034 environment: 35 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}36 - MYSQL_DATABASE=sylius37 - MYSQL_USER=${MYSQL_USER}38 - MYSQL_PASSWORD=${MYSQL_PASSWORD}39 volumes: 40 - mysql-data:/var/lib/mysql41 networks: 42 - sylius-network43 restart: unless-stopped4445 elasticsearch: 46 image: elasticsearch:7.17.1047 environment: 48 - discovery.type=single-node49 - ES_JAVA_OPTS=-Xms512m -Xmx512m50 volumes: 51 - es-data:/usr/share/elasticsearch/data52 networks: 53 - sylius-network54 restart: unless-stopped5556 mailhog: 57 image: mailhog/mailhog58 ports: 59 - "8025:8025"60 networks: 61 - sylius-network62 restart: unless-stopped6364volumes: 65 sylius-public: 66 mysql-data: 67 es-data: 6869networks: 70 sylius-network: 71 driver: bridge.env Template
.env
1# Sylius2APP_SECRET=your-app-secret-change-this3MYSQL_ROOT_PASSWORD=secure_root_password4MYSQL_USER=sylius5MYSQL_PASSWORD=secure_mysql_passwordUsage Notes
- 1Store at http://localhost
- 2Admin at http://localhost/admin
- 3MailHog at http://localhost:8025
- 4Install fixtures: bin/console sylius:fixtures:load
- 5Elasticsearch for product search
Individual Services(5 services)
Copy individual services to mix and match with your existing compose files.
sylius
sylius:
image: sylius/sylius:latest
environment:
- APP_ENV=prod
- APP_SECRET=${APP_SECRET}
- DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/sylius
- ELASTICSEARCH_URL=http://elasticsearch:9200
- MAILER_DSN=smtp://mailhog:1025
volumes:
- sylius-public:/app/public/media
depends_on:
- mysql
- elasticsearch
networks:
- sylius-network
restart: unless-stopped
nginx
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- sylius-public:/app/public:ro
ports:
- "80:80"
depends_on:
- sylius
networks:
- sylius-network
restart: unless-stopped
mysql
mysql:
image: mysql:8.0
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=sylius
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
volumes:
- mysql-data:/var/lib/mysql
networks:
- sylius-network
restart: unless-stopped
elasticsearch
elasticsearch:
image: elasticsearch:7.17.10
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms512m -Xmx512m
volumes:
- es-data:/usr/share/elasticsearch/data
networks:
- sylius-network
restart: unless-stopped
mailhog
mailhog:
image: mailhog/mailhog
ports:
- "8025:8025"
networks:
- sylius-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 sylius:5 image: sylius/sylius:latest6 environment:7 - APP_ENV=prod8 - APP_SECRET=${APP_SECRET}9 - DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/sylius10 - ELASTICSEARCH_URL=http://elasticsearch:920011 - MAILER_DSN=smtp://mailhog:102512 volumes:13 - sylius-public:/app/public/media14 depends_on:15 - mysql16 - elasticsearch17 networks:18 - sylius-network19 restart: unless-stopped2021 nginx:22 image: nginx:alpine23 volumes:24 - ./nginx.conf:/etc/nginx/nginx.conf:ro25 - sylius-public:/app/public:ro26 ports:27 - "80:80"28 depends_on:29 - sylius30 networks:31 - sylius-network32 restart: unless-stopped3334 mysql:35 image: mysql:8.036 environment:37 - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}38 - MYSQL_DATABASE=sylius39 - MYSQL_USER=${MYSQL_USER}40 - MYSQL_PASSWORD=${MYSQL_PASSWORD}41 volumes:42 - mysql-data:/var/lib/mysql43 networks:44 - sylius-network45 restart: unless-stopped4647 elasticsearch:48 image: elasticsearch:7.17.1049 environment:50 - discovery.type=single-node51 - ES_JAVA_OPTS=-Xms512m -Xmx512m52 volumes:53 - es-data:/usr/share/elasticsearch/data54 networks:55 - sylius-network56 restart: unless-stopped5758 mailhog:59 image: mailhog/mailhog60 ports:61 - "8025:8025"62 networks:63 - sylius-network64 restart: unless-stopped6566volumes:67 sylius-public:68 mysql-data:69 es-data:7071networks:72 sylius-network:73 driver: bridge74EOF7576# 2. Create the .env file77cat > .env << 'EOF'78# Sylius79APP_SECRET=your-app-secret-change-this80MYSQL_ROOT_PASSWORD=secure_root_password81MYSQL_USER=sylius82MYSQL_PASSWORD=secure_mysql_password83EOF8485# 3. Start the services86docker compose up -d8788# 4. View logs89docker 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/sylius-complete/run | bashTroubleshooting
- Elasticsearch cluster health RED status: Increase Docker memory limit to minimum 4GB and set ES_JAVA_OPTS=-Xms1g -Xmx1g
- Sylius installation fails with memory errors: Add PHP memory_limit=2G environment variable and increase container resources
- Product search returns no results: Run bin/console fos:elastica:populate to reindex product catalog in Elasticsearch
- MySQL connection refused errors: Verify MYSQL_USER and MYSQL_PASSWORD environment variables match between services
- Static assets not loading: Check NGINX volume mounts and ensure sylius-public volume contains uploaded media files
- Email notifications not captured: Verify MAILER_DSN points to mailhog:1025 and check MailHog interface at localhost:8025
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
syliusmysqlelasticsearchnginxmailhog
Tags
#sylius#symfony#ecommerce#elasticsearch#php
Category
E-Commerce & BusinessAd Space
Shortcuts: C CopyF FavoriteD Download