A full-stack e-commerce system built with Spring Boot, React, and an event-driven architecture powered by Kafka. The application is split into independent microservices behind an API Gateway, uses Redis for caching, MongoDB for order storage, PostgreSQL for inventory management and idempotent event processing, Prometheus for observability, and supports both Docker Compose and Kubernetes (Minikube) deployments.
This project demonstrates modern backend engineering concepts including microservices architecture, event-driven communication, API gateways, caching strategies, containerization, orchestration with Kubernetes, and full-stack integration.
- Java 21
- Spring Boot
- Spring Web MVC
- Spring Data MongoDB
- Spring Data JPA
- PostgreSQL
- Spring Kafka
- Spring Cache (Redis)
- Spring Cloud Gateway
- Spring Boot Actuator
- Micrometer
- React (Vite)
- JavaScript
- Fetch API
- Docker
- Docker Compose
- Kubernetes
- Minikube
- Apache Kafka
- ZooKeeper
- MongoDB
- PostgreSQL
- Redis
- Prometheus
React Frontend
β
βΌ
ecommerce.local (Ingress)
β
βΌ
API Gateway
β
ββββββββ΄ββββββββββββββ
βΌ βΌ
Order Service Inventory Service
(MongoDB) (PostgreSQL)
β β
βββββ Kafka ββββ
β
βΌ
Idempotency Store (PostgreSQL)
Redis Cache
Prometheus Metrics
Responsible for order creation, updates, cancellations, persistence in MongoDB, publishing order events via Kafka, and validating inventory availability through the Inventory Service.
Responsible for stock management, reservation and restoration of inventory, persistence in PostgreSQL, and publishing inventory events. It also maintains idempotency records for Kafka event processing.
Acts as the single entry point for all client requests and routes traffic to internal microservices.
Contains shared event models, DTOs, and common utilities used across all services.
Services communicate asynchronously through Kafka by publishing and consuming domain events. Consumers persist processed event identifiers in PostgreSQL to guarantee idempotent processing and prevent duplicate side effects caused by retries or re-delivery.
Redis is used as a distributed cache to improve performance and reduce database load. Frequently accessed data such as orders and inventory items are cached, and cache entries are invalidated or refreshed on write operations.
Stores order data and order lifecycle state.
Stores inventory data and also tracks processed Kafka events for idempotency guarantees.
This demonstrates a polyglot persistence approach where each service owns its data store.
The backend uses JUnit 5 and Mockito for unit and integration testing across controllers, services, Kafka producers/consumers, and caching behavior.
./mvnw clean testThe frontend uses Vitest and React Testing Library.
npm run testRequirements
- Docker
- Docker Compose
Build and start all services:
./start.shSkip image rebuild:
./start.sh --no-build| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| API Gateway | http://localhost:8080 |
| Prometheus | http://localhost:9090 |
./stop.shThis stops and removes all Docker Compose containers and networks.
The project includes a complete Kubernetes deployment using:
- Minikube
- NGINX Ingress Controller
- Kubernetes manifests
- Local DNS via
/etc/hosts
Install:
- Docker
- kubectl
- Minikube
Verify:
docker --version
kubectl version --client
minikube versionBuild images, start Minikube, enable Ingress, deploy all manifests, configure hosts file, and start the Minikube tunnel:
./start.sh k8sUseful when images are already built:
./start.sh k8s --no-build./start.sh k8s --no-hostsOnce deployment completes:
http://ecommerce.local
Traffic flow:
Browser
β
βΌ
Ingress
β
βΌ
API Gateway
β
βββ Order Service
βββ Inventory Service
Delete application resources and stop Minikube:
./stop.sh k8s./stop.sh k8s --no-hosts-removedView pods:
kubectl get pods -n ecommerceView services:
kubectl get svc -n ecommerceView ingress:
kubectl get ingress -n ecommerceView events:
kubectl get events -n ecommerce --sort-by=.lastTimestampView logs:
kubectl logs -f deployment/order-service -n ecommerce
kubectl logs -f deployment/inventory-service -n ecommerce
kubectl logs -f deployment/gateway-service -n ecommerceThe project uses Spring Boot Actuator and Micrometer to expose application and business metrics to Prometheus.
Examples include:
- Order creation metrics
- Order cancellation metrics
- Inventory update metrics
http://localhost:8080/actuator/prometheus
http://localhost:8080/actuator/metrics
Docker deployment:
http://localhost:9090
backend/
βββ gateway_service/
βββ order_service/
βββ inventory_service/
βββ shared_lib/
βββ deploy/
β βββ prometheus/
βββ k8s/
βββ docker-compose.yml
βββ docker-compose.k8s.yml
frontend/
start.sh
stop.sh
Services publish and consume domain events through Kafka to reduce coupling and support asynchronous workflows.
Consumers persist processed event IDs in PostgreSQL to prevent duplicate business operations.
Provides a unified entry point while hiding internal service topology.
MongoDB and PostgreSQL are used based on the requirements of each domain.
Improves performance and reduces database load.
Supports local production-like orchestration through Minikube and Ingress.
Each microservice owns:
- Domain logic
- Persistence
- APIs
- Event publishing
The entire platform can run via:
- Docker Compose (development)
- Kubernetes / Minikube (orchestration)
- Payment Service
- User Service
- Notification Service
- Transactional Outbox Pattern
- Distributed Tracing (OpenTelemetry)
- Grafana Dashboards
- CI/CD Pipeline (GitHub Actions β Kubernetes)
- JWT Authentication
- OAuth2 / OpenID Connect
- Service Discovery
- Circuit Breakers & Resilience Patterns
Some development tasks were assisted by AI coding tools, including GitHub Copilot and OpenAI models.