Skip to content

OsamaNuserat/ecommerce-microservices

Repository files navigation

🛒 Ecommerce Microservices (Spring Boot)

This monorepo contains a fully modularized eCommerce backend system built with Spring Boot and a microservices architecture.


📦 Architecture Overview

This project is designed following microservices best practices. It includes:

  • API Gateway: Central entry point for all client requests.
  • Service Discovery (Eureka): Allows services to find and communicate with each other.
  • Config Server: Centralized configuration management for all services.
  • Product Service: Manages products and catalog.
  • User Service: Manages authentication, registration, and user data.
  • Order Service: Manages order creation, cart functionality, and checkout process.

📁 Folder Structure

ecommerce-microservices/
│
├── README.md
├── .gitignore
├── docker-compose.yml (optional)
│
├── config-server/         # Spring Cloud Config Server
├── discovery-server/      # Eureka Server
├── api-gateway/           # Spring Cloud Gateway
├── product-service/       # Product microservice
├── user-service/          # User/Auth microservice
└── order-service/         # Order/Checkout microservice

🧪 Tech Stack

  • Java 17+
  • Spring Boot
  • Spring Cloud (Eureka, Config, Gateway)
  • Spring Security
  • Spring Data JPA / Hibernate
  • MySQL
  • Docker & Docker Compose (optional)
  • Lombok

🚀 Getting Started

1. Clone the repository

git clone https://github.com/OsamaNuserat/ecommerce-microservices.git
cd ecommerce-microservices

2. Run services

Each microservice is a Spring Boot application. You can run them individually using:

cd discovery-server
./mvnw spring-boot:run

Repeat this for:

  • config-server
  • api-gateway
  • product-service
  • user-service
  • order-service

ℹ️ You must run discovery-server and config-server before other services.


⚙️ Configuration

  • Each service gets its configuration from the config-server
  • Properties are stored in a Git repo or inside config-server/src/main/resources

📌 API Endpoints (Example)

  • http://localhost:8080/products → Product APIs via Gateway
  • http://localhost:8080/users → User APIs via Gateway
  • http://localhost:8080/orders → Order APIs via Gateway

The actual ports and endpoints depend on the gateway and service routes.


🔐 Authentication

  • Spring Security (initially with basic auth or in-memory users)
  • JWT-based authentication can be added later

🐳 Docker (Optional)

You can use docker-compose.yml to orchestrate services locally:

docker-compose up --build

💡 Future Enhancements

  • JWT Authentication
  • Inventory Service
  • Payment Gateway Integration
  • Notification Service (Email/SMS)
  • Admin Dashboard with Role Management

👨‍💻 Author


📜 License

This project is open source and free to use under the MIT License.

About

Microservices-based eCommerce backend system using Spring Boot and Spring Cloud.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages