Designed and deployed a containerized microservices-based e-commerce backend with independent scaling, service isolation, and Kubernetes orchestration to simulate production-grade distributed systems.
I made this project to understand how scalable and large-scale software systems are designed, deployed, scaled, and managed in real-world environments. Instead of building a monolithic application, this project follows a microservices architecture similar to what is used in production-grade e-commerce platforms.
The application is split into independent services such as User Service, Product Service, Order Service, and supporting infrastructure components. Each service is developed, containerized, and deployed independently locally using minikube, allowing the system to scale specific services based on demand rather than scaling the entire application.
ecommerce-microservices/
│
├── amazon-data.json
├── README.md
│
├── api-gateway/
│ ├── src/
│ │ └── index.ts
│ ├── Dockerfile
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── compose.yaml
│ └── package.json
│
├── user-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── routes/
│ │ ├── schema.ts
│ │ ├── db.ts
│ │ └── index.ts
│ ├── Dockerfile
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── compose.yaml
│ └── package.json
│
├── product-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── utils/
│ │ ├── db.ts
│ │ └── index.ts
│ ├── Dockerfile
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── compose.yaml
│ └── package.json
│
└── order-service/
├── src/
│ ├── controllers/
│ ├── routes/
│ ├── schema.ts
│ ├── db.ts
│ └── index.ts
├── Dockerfile
├── deployment.yaml
├── service.yaml
├── compose.yaml
└── package.json
In the Product Microservice, I implemented:
- Pagination of products to improve the API performance, reducing memory storage, and lowering the server load.
- Storage for the Product Images in AWS S3 Bucket
- Database being MongoDB, it was chosen as the database due to its suitability for scenarios with a high View-to-Update ratio (approximately 3%), indicating significantly more read operations compared to write operations.
- Implemented Cache Key based Caching using redis(in-memory key-value based db) for fetching product details with low latency and also implemented removal of cached data whenever operations such as creation, updation, or deletion happens in the database to keep data consistency. Latency decreased by 90.4%
In the User Microservice, I Implemented:
- Database being PostgreSQL, for relational and transactional operations
In the Order Microservice , Implemented:
- Database being PostgreSQL, for relational and transactional operations
- Synchronous Sevice-to-Service Communication between this service and user & product service - when creating an order multiple transactional operations where this service sends a request to the product-service or user-service and await for response.
- Managing inter-service communication failures
- Handling environment variable configuration across services
- Understanding difference between ClusterIP and NodePort Debugging networking issues in Kubernetes
- Understanding good API development practices like pagination, soft deleting etc.
- Understanding failures due to version controlling in code, docker images and pod deployments
- Understood about logging, api-gateway practices, and server debugging.
- Asynchronous communication using Kafka or RabbitMQ (Message Queues)
- Redis caching layer
- CI/CD pipeline using GitHub Actions
- Centralized config management
- Distributed Authentication and Authorization
- Language Agnostic Services (using Java, or Golang for concurrency or python for a basic recommender service using user purchase history)
- Use RDS for databases and EKS for Kubernetes in cloud (optional)
- Mastering API Pagination: Best Practices for Performance & Scalability
- Integrate AWS S3 with Your Node.js Project: A Step-by-Step Guide
- Design E-Commerce Applications with Microservices Architecture
- How To Perform Full-text Search in MongoDB
- A Comprehensive Guide to Service-to-Service Communication: Synchronous and Asynchronous Approaches.
- Isolated Scaling, Deployment and Monitoring
- It's modular, multiple devs can work independently on different modules
- If any error occurs in one module, no need to stop all the services
- Multiple languages can be used (Go, Java, JS, Python etc) each can be used for its features and advantages, like python can be used for ML-related services, Go and Java can be used for concurrency and robust services, node.js can be used for lightweight services (rapid development).
- Too complex to implement for simple backend systems, imagine having to track multiple services' deployments, monitoring and maintainance
- Communication and Data Transfer complexity is too much and can raise issues.
- Data Management Challenges, handling multiple DBs hence handing data between Relational and Non-relational Dbs is challenging.
- Testing Overhead, too many things to test
I have added the documentation to start and run each service in its designated service folder.
For Redis Deployment, run
kubectl apply -f k8s/redis-deployment.yaml&kubectl apply -f k8s/redis-service.yaml

