Skip to content

hoangtien2k3/ecommerce-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

309 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ecommerce-microservices

Quality Gate Maintainability License Release Stars


πŸ“‹ Overview

ecommerce-microservices is a production-grade, cloud-native e-commerce platform built with a microservice architecture. It consists of 13 Spring Boot 3 backend services, an Apache APISIX API Gateway, a Next.js 16 frontend, and a full suite of infrastructure β€” all deployable on Kubernetes (k3d) with a single command.

⚑ Backend 13 microservices · Java 21 · Spring Boot 3.3.5
πŸšͺ Gateway Apache APISIX 3.9 Β· Rate limiting Β· JWT validation
πŸ—„οΈ Databases PostgreSQL 16 Β· Redis 7 Β· Elasticsearch 8
πŸ“¨ Messaging Apache Kafka 3.9 (KRaft mode, no Zookeeper)
πŸ” Auth Keycloak 26 Β· OAuth2 / OIDC Β· JWT
☁️ Storage RustFS (S3-compatible)
🐳 Deploy Docker Compose · k3d / Kubernetes · ArgoCD

πŸ› οΈ Technology Stack

Backend

Runtime Java 21 (Virtual Threads)
Framework Spring Boot 3.3.5, Spring Security 6, Spring Data JPA
Database PostgreSQL 16, Liquibase migrations
Search Elasticsearch 8, Spring Data Elasticsearch
Messaging Apache Kafka 3.9 (KRaft), Spring Kafka
Security Keycloak 26, OAuth2 / OIDC, JWT, Spring Security Resource Server
Gateway Apache APISIX 3.9 (OpenID Connect, rate limiting, CORS)
Storage RustFS (S3-compatible), AWS SDK v2
Observability Micrometer, Prometheus, Spring Boot Actuator
API Docs Springdoc OpenAPI 3, Swagger UI w/ PKCE
Resilience Resilience4j (circuit breaker, retry)
Build Maven, Jib (Dockerless containerization)

Frontend

Framework Next.js 16.2, React 19.2
State Zustand 5, TanStack Query 5
Styling Tailwind CSS 4, Lucide icons
HTTP Axios

Infrastructure

Local K8s k3d (K3s in Docker), NGINX Ingress Controller
Production Kubernetes, ArgoCD (GitOps)
Registry GitHub Container Registry (ghcr.io)
CI GitHub Actions, SonarCloud

πŸš€ Quick Start

Prerequisites

  • Docker Desktop (macOS / Windows) or Docker Engine (Linux)
  • 8 GB+ RAM allocated to Docker

One-Command Setup (k3d)

git clone https://github.com/hoangtien2k3/ecommerce-microservices.git
cd ecommerce-microservices
bash start-ecommerce.sh

The script automatically:

  1. Installs k3d and kubectl (if missing)
  2. Creates a local Kubernetes cluster
  3. Deploys NGINX Ingress Controller
  4. Applies secrets, config maps, and infrastructure (PostgreSQL, Redis, Kafka, Elasticsearch, RustFS, Keycloak)
  5. Deploys APISIX gateway + all 13 backend services + frontend
  6. Updates /etc/hosts

Wait ~5 minutes for all pods to become ready:

kubectl get pods -n ecommerce -w

URLs

Service URL
🏠 Frontend http://ecommerce.local
πŸšͺ API Gateway http://api.ecommerce.local
πŸ” Keycloak Admin http://keycloak.ecommerce.local
πŸ“¦ RustFS Console http://rustfs.ecommerce.local/rustfs/console

πŸ“ Project Structure

ecommerce-microservices/
β”œβ”€β”€ auth-service/                   # Port 8088
β”œβ”€β”€ common-lib/                     # Shared library
β”‚   β”œβ”€β”€ common-core/                #   Contracts, exceptions, i18n
β”‚   β”œβ”€β”€ common-spring/              #   Auto-configurations
β”‚   β”œβ”€β”€ common-security/            #   JWT / OAuth2 security
β”‚   β”œβ”€β”€ common-keycloak/            #   Keycloak admin client
β”‚   β”œβ”€β”€ common-kafka/               #   Kafka / CDC helpers
β”‚   β”œβ”€β”€ common-logging/             #   AOP performance logging
β”‚   └── common-storage/             #   S3 object storage abstraction
β”œβ”€β”€ deploy/
β”‚   └── apisix/                     # APISIX standalone config
β”œβ”€β”€ docker/
β”‚   β”œβ”€β”€ keycloak/import/            # Keycloak realm configuration
β”‚   └── postgres/init/              # Database creation scripts
β”œβ”€β”€ docker-compose.yml              # Full-stack local orchestration
β”œβ”€β”€ favourite-service/              # Port 8081
β”œβ”€β”€ frontend/                       # Next.js 16 application
β”œβ”€β”€ inventory-service/              # Port 8082
β”œβ”€β”€ k3d-config.yaml                 # k3d cluster definition
β”œβ”€β”€ k3d-setup.sh                    # One-shot K8s deployment script
β”œβ”€β”€ k8s/                            # Kubernetes manifests
β”‚   β”œβ”€β”€ argocd/                     # ArgoCD GitOps configurations
β”‚   β”œβ”€β”€ backend/                    # 13 service deployments
β”‚   β”œβ”€β”€ frontend/                   # Frontend deployment
β”‚   β”œβ”€β”€ gateway/                    # APISIX Ingress CRDs
β”‚   β”œβ”€β”€ infra/                      # Infrastructure deployments
β”‚   β”œβ”€β”€ ingress/                    # NGINX Ingress rules
β”‚   β”œβ”€β”€ configmap.yaml
β”‚   β”œβ”€β”€ namespace.yaml
β”‚   └── secrets.yaml
β”œβ”€β”€ Makefile                        # Build & deploy automation
β”œβ”€β”€ media-service/                  # Port 8083
β”œβ”€β”€ notification-service/           # Port 8090
β”œβ”€β”€ order-service/                  # Port 8084
β”œβ”€β”€ payment-service/                # Port 8085
β”œβ”€β”€ pom.xml                         # Parent POM
β”œβ”€β”€ product-service/                # Port 8086
β”œβ”€β”€ promotion-service/              # Port 8093
β”œβ”€β”€ rating-service/                 # Port 8089
β”œβ”€β”€ search-service/                 # Port 8094
β”œβ”€β”€ shipping-service/               # Port 8087
β”œβ”€β”€ start-ecommerce.sh              # Entry point
└── tax-service/                    # Port 8091

πŸ“Š Observability

Every service exposes:

  • Health: /actuator/health (liveness + readiness on port 9000)
  • Metrics: /actuator/prometheus (Micrometer + Prometheus)
  • Distributed Tracing: Correlation ID (X-Correlation-Id) propagated across all services
  • APISIX Metrics: Prometheus metrics on port 9091

πŸ“ˆ Stats

Star History Chart

Contributing

If you would like to contribute to the development of this project, please follow our contribution guidelines.

Repo analytics

πŸ“„ License

MIT License
Copyright (c) 2026 HoΓ ng Anh TiαΊΏn

About

⚑️ Microservice Architecture with system for e-commerce project! Spring Boot microservices app with πŸŒ€ Spring Cloud, Robust and resilient backend managing e-Commerce app... ❄️ Using Kafka Client, kafka server send message, Reactive Programming with WebFlux - Project Reactor.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages