A distributed bouquet e-commerce platform developed using microservices architecture.
This project demonstrates core distributed computing concepts including:
- Service separation
- REST API communication
- Independent databases
- Docker containerization
- Gateway-based routing
- Scalable architecture
Instead of using a monolithic architecture, the application is divided into multiple independent services:
| Service | Responsibility | Port |
|---|---|---|
| Gateway Service | Main entry point / routing | 5000 |
| User Service | User management | 5001 |
| Product Service | Bouquet/product management | 5002 |
| Order Service | Order handling | 5003 |
| Payment Service | Payment simulation | 5004 |
| Frontend | User Interface | 5005 |
Each service communicates through HTTP REST APIs.
- Each service handles a specific domain
- API Gateway acts as a single entry point
- MySQL is shared across services (separate databases per service)
- Frontend communicates only with Gateway
Frontend (Port 5005)
↓
API Gateway (Port 5000)
↓
--------------------------------
| User Service (5001) |
| Product Service (5002) |
| Order Service (5003) |
| Payment Service (5004) |
--------------------------------
↓
MySQL DB
distributed__Ecommerce__system/
│
├── gateway/
│ └── app.py
│
├── user_service/
│ ├── app.py
│ ├── db.py
│ └── Dockerfile
│
├── product_service/
│ ├── app.py
│ ├── db.py
│ └── Dockerfile
│
├── order_service/
│ ├── app.py
│ ├── db.py
│ └── Dockerfile
│
├── payment_service/
│ ├── app.py
│ ├── db.py
│ └── Dockerfile
│
├── frontend/
│ ├── templates/
│ ├── index.html
│ ├── products.html
│ ├── orders.html
│ └── payment.html
│ ├── app.py
│
├── database_dumps/
│ └── product_db.sql
| └── payment_db.sql
| └── user_db.sql
| └── order_db.sql
│
├── docker-compose.yml
├── init.sql
└── README.md
| Technology | Purpose |
|---|---|
| Python | Backend development |
| Flask | REST API framework |
| MySQL | Database |
| Docker | Containerization |
| HTML/CSS/JS | Frontend |
| Requests Library | Service communication |
git clone https://github.com/Anooshakhalid/distributed__Ecommerce__system.git
cd distributed__Ecommerce__systemInstall:
- Python 3
- Docker Desktop
Run:
pip install flask requests mysql-connector-python
pip install flask-corsdocker compose up --buildOR Import Database (First Time Setup) - Manual:
docker exec -i mysql_db mysql -u root -proot product_db < database_dumps/product_db.sql
docker exec -i mysql_db mysql -u root -proot order_db < database_dumps/order_db.sql
docker exec -i mysql_db mysql -u root -proot payment_db < database_dumps/payment_db.sql
docker exec -i mysql_db mysql -u root -proot user_db < database_dumps/user_db.sqlExport Database (After Final Updatation)
docker exec mysql_db mysqldump -u root -proot product_db > database_dumps/product_db.sql
docker exec mysql_db mysqldump -u root -proot order_db < database_dumps/order_db.sql
docker exec mysql_db mysqldump -u root -proot payment_db < database_dumps/payment_db.sql
docker exec mysql_db mysqldump -u root -proot user_db < database_dumps/user_db.sqlThis creates:
- user_db
- product_db
- order_db
- payment_db
Open another terminal:
cd gateway
py app.pyGateway runs on:
http://localhost:5000/api/
Open another terminal:
cd frontend
py app.pyFrontend runs on:
http://localhost:5005/
docker compose up --builddocker compose downdocker compose restartThe project includes sustainability considerations:
- Independent services reduce unnecessary resource usage.
- Services can scale individually.
- Containerization improves deployment efficiency.
- Distributed systems reduce single-point overload.
This project is for academic and educational purposes.