This project is a fully containerized, microservice-based e-commerce platform designed to demonstrate modern software development practices. It includes user management, product management, and order management functionalities, all built using a microservice architecture. The system leverages Docker, Nginx, Golang, and Streamlit to create a scalable, secure, and efficient e-commerce solution.
This project is a proof-of-concept e-commerce platform built using a microservice architecture. It consists of the following services:
- Frontend Service: A Streamlit-based web application for user interaction.
- User Service: Manages user-related operations (e.g., creating and listing users).
- Product Service: Handles product-related operations (e.g., adding and listing products).
- Order Service: Manages order-related operations (e.g., creating and listing orders).
All services are containerized using Docker and communicate through an Nginx reverse proxy, which acts as the central gateway for all incoming requests.
- Microservice Architecture: Each service is independent and can be developed, deployed, and scaled separately.
- Nginx Reverse Proxy: Centralized request handling, load balancing, and enhanced security.
- Dockerized Environment: Easy setup and deployment using Docker Compose.
- RESTful APIs: Each microservice exposes RESTful endpoints for seamless communication.
- Real-Time Frontend: Streamlit-based frontend for a user-friendly interface.
- Scalable Design: Ready for horizontal scaling with additional service instances.
The project follows a microservice architecture with the following components:
-
Frontend Service:
- Built with Streamlit.
- Provides a user interface for interacting with the platform.
- Communicates with backend services via Nginx.
-
Backend Services:
- User Service: Manages user data (Golang).
- Product Service: Manages product data (Golang).
- Order Service: Manages order data (Golang).
- Each service runs in its own Docker container and exposes RESTful APIs.
-
Nginx Reverse Proxy:
- Acts as the entry point for all incoming requests.
- Routes requests to the appropriate backend service.
- Provides load balancing and WebSocket support.
-
Docker Compose:
- Manages the entire system as a multi-container application.
- Simplifies development and deployment.
- Backend: Golang (Gin framework)
- Frontend: Streamlit (Python)
- Reverse Proxy: Nginx
- Containerization: Docker, Docker Compose
- API Communication: RESTful APIs
- Real-Time Communication: WebSocket (via Nginx)
Before running the project, ensure you have the following installed:
- Docker (Install Docker)
- Docker Compose (Install Docker Compose)
-
Clone the repository:
git clone https://github.com/your-username/microservice-ecommerce.git cd microservice-ecommerce
-
Build and start the containers using Docker Compose:
docker-compose up --build
-
Access the application:
- Frontend: Open your browser and go to
http://localhost
. - API Endpoints: Use the endpoints listed in the API Endpoints section.
- Frontend: Open your browser and go to
Once the containers are up and running, you can access the application as follows:
- Frontend:
- Open your browser and go to
http://localhost:8501
. - This will load the Streamlit-based frontend where you can interact with the platform
- Open your browser and go to
- POST /api/users: Create a new user.
- GET /api/users: List all users.
- POST /api/products: Add a new product.
- GET /api/products: List all products.
- POST /api/orders: Create a new order.
- GET /api/orders: List all orders.
- Database Integration: Add persistent storage using databases like PostgreSQL or MongoDB.
- Authentication: Implement user authentication and authorization (e.g., JWT).
- Advanced Load Balancing: Use Kubernetes for orchestration and advanced load balancing.
- Logging and Monitoring: Integrate tools like Prometheus and Grafana for monitoring.
- Frontend Enhancements: Improve the Streamlit frontend with more features and a better UI/UX.
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push to the branch.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License. See the LICENSE file for details.