# Bagisto E-commerce Platform

> Bagisto Laravel e-commerce with MySQL.

- Category: E-Commerce & Business
- Difficulty: intermediate
- Components: bagisto, mysql, redis, nginx
- Tags: bagisto, ecommerce, laravel, shop
- Source: https://docker.recipes/ecommerce/bagisto-ecommerce-stack

## Overview

Bagisto is a modern, Laravel-based e-commerce framework that provides a complete foundation for building online stores and marketplaces. Developed by Webkul, Bagisto offers multi-channel selling capabilities, comprehensive inventory management, and built-in support for multi-vendor marketplaces, making it a powerful alternative to Magento or WooCommerce for businesses seeking a flexible PHP-based e-commerce solution. This Docker stack combines Bagisto with MySQL 8.0 for robust relational data storage, Redis for high-speed caching and session management, and Nginx as a reverse proxy to handle web traffic efficiently. The MySQL database stores product catalogs, customer data, and order information with full ACID compliance, while Redis accelerates page load times by caching frequently accessed data and managing user sessions. Nginx serves as the front-end web server, handling static assets and proxying PHP requests to the Bagisto application container. This configuration is ideal for e-commerce businesses, Laravel developers building custom online stores, agencies deploying client shopping platforms, and entrepreneurs launching multi-vendor marketplaces who need a scalable, feature-rich e-commerce solution with professional-grade performance optimization.

## Features

- Multi-channel selling with support for web, mobile, and social commerce platforms
- Built-in multi-vendor marketplace functionality with vendor management and commission tracking
- Advanced inventory management with configurable products, bundles, and downloadable goods
- MySQL InnoDB storage engine with full-text search capabilities for product catalogs
- Redis-powered session storage and Laravel cache optimization for sub-millisecond response times
- Nginx reverse proxy with HTTP/2 support and static asset optimization
- Laravel Artisan command-line tools for migrations, seeding, and custom development
- Comprehensive admin panel with role-based permissions and multi-language support

## Use cases

- Small to medium businesses launching their first professional online store
- Multi-vendor marketplaces requiring commission management and vendor dashboards
- Laravel developers building custom e-commerce solutions for clients
- Agencies migrating clients from Magento or Shopify to a self-hosted platform
- B2B companies needing advanced inventory management and bulk ordering capabilities
- International retailers requiring multi-currency and multi-language support
- Developers prototyping e-commerce features in a local development environment

## Prerequisites

- Docker and Docker Compose installed on the host system
- Minimum 2GB RAM available (1GB+ for MySQL, 512MB+ for Redis, remainder for Bagisto and Nginx)
- Port 80 available for web traffic (or configure custom port via NGINX_PORT)
- Basic understanding of Laravel framework and PHP development practices
- Database administration knowledge for MySQL backup and maintenance procedures
- SSL certificate and domain configuration for production deployments

## docker-compose.yml

```yaml
services:
  bagisto:
    image: bagisto/bagisto:latest
    container_name: bagisto
    restart: unless-stopped
    environment:
      - DB_HOST=bagisto-mysql
      - DB_DATABASE=bagisto
      - DB_USERNAME=${DB_USER}
      - DB_PASSWORD=${DB_PASSWORD}
      - REDIS_HOST=bagisto-redis
    volumes:
      - bagisto_storage:/var/www/html/storage
    depends_on:
      - bagisto-mysql
      - bagisto-redis

  bagisto-mysql:
    image: mysql:8.0
    container_name: bagisto-mysql
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MYSQL_DATABASE=bagisto
      - MYSQL_USER=${DB_USER}
      - MYSQL_PASSWORD=${DB_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql

  bagisto-redis:
    image: redis:7-alpine
    container_name: bagisto-redis
    restart: unless-stopped
    volumes:
      - redis_data:/data

  nginx:
    image: nginx:alpine
    container_name: bagisto-nginx
    restart: unless-stopped
    ports:
      - "${NGINX_PORT:-80}:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - bagisto

volumes:
  bagisto_storage:
  mysql_data:
  redis_data:
```

## .env

```bash
# Bagisto
NGINX_PORT=80
DB_USER=bagisto
DB_PASSWORD=bagisto_password
DB_ROOT_PASSWORD=root_password
```

## Usage notes

- Docs: https://devdocs.bagisto.com/
- Store at http://localhost, admin panel at /admin
- Complete web installer wizard on first visit
- Default admin: admin@example.com / admin123 - change immediately
- Laravel Artisan: docker exec bagisto php artisan
- Multi-vendor marketplace capabilities available

## Troubleshooting

- Bagisto shows database connection error: Verify DB_HOST, DB_USERNAME, and DB_PASSWORD environment variables match MySQL container settings
- Web installer fails during setup: Check MySQL container is fully initialized by examining logs with docker logs bagisto-mysql
- Laravel cache issues or session problems: Restart Redis container and clear Laravel cache with docker exec bagisto php artisan cache:clear
- Nginx 502 Bad Gateway errors: Ensure Bagisto container is running and accessible on its internal network port
- File upload or storage permissions errors: Verify bagisto_storage volume is properly mounted and container has write permissions
- Performance issues with large catalogs: Increase MySQL innodb_buffer_pool_size and configure Redis maxmemory settings based on available RAM

