Skip to content

sahil-me/UserService

🛒 E-Commerce Platform 🛍

Infrastructure

Spring Cloud | Service Discovery Spring Cloud | API Gateway

Business Services

Microservice | User Service Microservice | Product Service Microservice | Payment Service Microservice | Email Service

User.Service.-.Demo.mp4

🎥 User Service Demonstration!


Table of Contents


Introduction

A scalable and modular e-commerce platform built using a microservices architecture. The system is designed to handle core e-commerce functionalities such as product management, cart operations, order processing, payment integration, and user management through independently deployable backend services.

The project demonstrates real-world backend engineering concepts including RESTful APIs, database design, asynchronous communication, scalability, service abstraction, caching, payment gateway integration, and microservices-based system design using Spring Boot and related technologies.


Architecture Diagram

Client
   │
   ▼
API Gateway
   │
   ▼
Service Discovery
   │
   ├── User Service
   ├── Product Service
   ├── Payment Service
   └── Email Service

Project Structure

E-Commerce-Platform/
│
├── ServiceDiscovery/   # Eureka Service Registry
├── ApiGateway/         # API Gateway
├── UserService/        # User Management
├── ProductService/     # Product Catalog Management
├── PaymentService/     # Payment Integration
└── EmailService/       # Email Notifications      

Tech Stack

Technology Purpose
Java 21 Programming Language
Spring Boot 3.4.6 Backend Framework
Spring Web REST API Development
Spring Data JPA ORM & Database Access
MySQL Relational Database
Spring Security Authentication & Authorization
Spring Authorization Server OAuth 2.1 Authorization Server & Token Management
Apache Commons Lang 3 Utility Library
Lombok Boilerplate Code Reduction
Spring Kafka Event-Driven Messaging & Asynchronous Communication
Spring Cloud Netflix Eureka Client Service Discovery & Service Registration
Spring Boot DevTools Development Productivity & Automatic Restart
Maven Dependency Management & Build Tool
JUnit 5 Unit & Integration Testing
IntelliJ IDEA Development Environment

Product Requirements Document (PRD)

Functional Requirements

1️⃣ User Management

  • Registration: Allow users to register via email or social media profiles.
  • Login: Secure user login with credentials.
  • Profile Management: Enable users to view and edit their profiles.
  • Password Reset: Allow password resets through secure email links.

2️⃣ Product Catalog

  • Browsing: Users can browse products by category.
  • Product Details: Product pages include images, descriptions, specifications, and more.
  • Search: Provide search functionality with keyword-based queries.

3️⃣ Cart & Checkout

  • Add to Cart: Users can add products to their cart.
  • Cart Review: View selected items with price, quantity, and totals.
  • Checkout: Seamless process to finalize purchases, including delivery details and payment options.

4️⃣ Order Management

  • Order Confirmation: Confirm orders with details after purchase.
  • Order History: Allow users to view past orders.
  • Order Tracking: Provide delivery status tracking.

5️⃣ Payment

  • Multiple Payment Options: Support credit/debit cards, online banking, and other methods.
  • Secure Transactions: Ensure secure payment handling.
  • Payment Receipt: Generate receipts for successful payments.

6️⃣ Authentication

  • Secure Authentication: Protect user data during login and active sessions.
  • Session Management: Allow users to stay logged in until they log out or after a specified duration.

High-Level Design (HLD)

Architecture Components

1️⃣ Load Balancers (LB): Distribute traffic across servers for high availability (e.g., AWS ELB).

2️⃣ API Gateway: Entry point for routing requests, managing rate limits, and handling authentication (e.g., Kong).

3️⃣ Microservices: Separate services for modular and scalable architecture.

4️⃣ Databases: MySQL and MongoDB for structured and unstructured data.

5️⃣ Message Broker (Kafka): Enable asynchronous inter-service communication.

6️⃣ Caching (Redis): Boost response times for frequently accessed data.

7️⃣ Search & Analytics (Elasticsearch): Efficient product searches with advanced capabilities.

Typical Flow

Part 1: Product Search

1️⃣ User logs in and searches for a product.

2️⃣ Request passes through the Load Balancer to the API Gateway.

3️⃣ API Gateway routes the search request to the Product Catalog Service.

4️⃣ Product Catalog Service queries Elasticsearch for results.

Part 2: Add to Cart

1️⃣ User adds a product to the cart.

2️⃣ Cart Service stores the item in MongoDB and produces a Kafka message.

Part 3: Checkout

1️⃣ User checks out.

2️⃣ Order Management Service processes the order and sends a Kafka message.

3️⃣ Payment Service consumes the message to handle payment.


Resources

Spring Security BCrypt Auth0 Auth0 JWT BCrypt MDN AWS Spring Authorization Server Spring Authorization Server JWT


Contributing

Contributions are welcome. Before submitting changes, please review:


License

This project is licensed under the Apache 2.0 License.


Author

Sahil Sharma

Thank you for exploring this project. If you find it helpful, consider giving the repository a ⭐ to support its continued development.

About

User Service for a Microservices-Based E-Commerce Platform supporting user management, authentication, authorization, and RESTful APIs using Spring Security and OAuth 2.0.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages