This project sets up a simple E-commerce platform using microservices architecture. The setup includes an API Gateway, Product and Order services, a frontend, RabbitMQ, and a PostgreSQL database.
- API Gateway: Handles routing requests to the respective services.
- Product Service: Manages product data.
- Order Service: Handles order creation and retrieval.
- Frontend: A React-based frontend for interacting with the E-commerce platform.
- RabbitMQ: Used for communication between services (e.g., handling order events).
- PostgreSQL: A database for storing product and order data.
This project is currently a work in progress. Some components may be incomplete or subject to change.
- Docker and Docker Compose installed on your system.
Create a .env
file in the ecommerce
directory with the following content:
POSTGRES_USER=admin_postgres
POSTGRES_PASSWORD=123
POSTGRES_DB=products
RABBITMQ_DEFAULT_USER=admin_rabbit
RABBITMQ_DEFAULT_PASS=123
To start all services, navigate to the ecommerce
directory and run:
docker-compose up --build
- Frontend: http://localhost:8080
- API Gateway: http://localhost:3000
- RabbitMQ Management UI: http://localhost:15672
- Product Service: http://localhost:4000/products
- Order Service: http://localhost:5000/orders
The PostgreSQL database will be initialized using the init.sql
file. It creates the necessary products
and orders
tables if they do not exist.
ecommerce/
├── api-gateway/
│ ├── Dockerfile
│ └── index.js
├── frontend/
│ ├── Dockerfile
│ ├── public/
│ └── src/
├── product-service/
│ ├── Dockerfile
│ └── index.js
├── order-service/
│ ├── Dockerfile
│ └── index.js
├── db/
│ ├── init.sql.template
│ └── init.sql
├── docker-compose.yml
├── .env
└── prebuild.sh
- Ensure that the environment variables are correctly set up before running the project.
- This setup is intended for local development and testing purposes only.
- Use the
prebuild.sh
script to generateinit.sql
before starting the services if changes are made to theinit.sql.template
.
- Implement more comprehensive error handling.
- Improve documentation for each service.
- Add automated tests for services.
- Enhance frontend design.
This project is open-source and available under the MIT License.
Disclaimer: This project is still in development. Some features may be incomplete or non-functional.