Skip to content

The architecture of Product Order System is designed using microservices principles, ensuring scalability, fault tolerance, and modularity.

Notifications You must be signed in to change notification settings

edsonwade/product_order_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product Order System 🌟

Overview πŸ“–

ProductOrderSystem is a microservice-based backend system designed to manage products and orders efficiently. This service enables administrators to manage a catalog of products and process orders placed by customers. The architecture is designed to be scalable, fault-tolerant, and event-driven, leveraging modern cloud technologies.


Features ✨

User Management πŸ‘€

  • Secure registration and login for customers.
  • Role-based access control (e.g., ADMIN, CUSTOMER).

Product Management πŸ›’

  • Admins can create, update, delete, and view products.
  • Customers can view available products.

Order Management πŸ“¦

  • Customers can place orders for products.
  • Admins can view and manage orders.

System Design πŸ› οΈ

This service is built with a focus on:

  • Scalability: Easily handle increased load by scaling horizontally.
  • Fault Tolerance: High availability with failover mechanisms.
  • Event-Driven Architecture: Asynchronous communication using Apache Kafka.
  • Cloud Deployment: Leveraging containerization and Kubernetes for seamless deployment.

Tech Stack πŸ–₯️

Backend

  • Java 17: Core programming language.
  • Spring Boot 3: Framework for rapid development.
  • Spring Data JPA: For database interaction using Hibernate ORM.
  • Spring Security: Authentication and role-based authorization.
  • Spring Cloud Gateway: API gateway for routing and load balancing.

Database πŸ—„οΈ

  • PostgreSQL: Relational database for structured data.
  • Redis: In-memory cache for improving query performance.

Messaging πŸ“©

  • Apache Kafka: Event-driven communication between services.

Other Tools πŸ› οΈ

  • Docker: Containerization for consistent environments.
  • Kubernetes: Orchestrating containerized services.
  • Prometheus + Grafana: Monitoring and visualization.

Services 🧩

User Service πŸ‘€

Handles user registration, authentication, and role management.

Product Service πŸ›’

Manages product catalog, including CRUD operations for products.

Order Service πŸ“¦

Handles order creation, management, and retrieval.


API Documentation πŸ“‹

Detailed API specifications will be provided using Swagger for easy testing and visualization.


System Architecture πŸ—οΈ

The architecture of ProductOrderSystem is designed using microservices principles, ensuring scalability, fault tolerance, and modularity. Below is a high-level overview of the architecture:

Components πŸ“¦

  1. API Gateway (Spring Cloud Gateway):

    • Handles incoming requests and routes them to the appropriate microservice.
    • Provides load balancing, request throttling, and authentication.
  2. User Service:

    • Manages user data and authentication.
    • Handles secure login, registration, and role management.
  3. Product Service:

    • Manages product catalog, including CRUD operations for products.
    • Includes Redis caching for fast product retrieval.
  4. Order Service:

    • Handles order creation, status updates, and retrieval.
    • Uses event-driven communication to process orders asynchronously.
  5. Apache Kafka:

    • Manages asynchronous communication between services.
    • Ensures reliable and scalable event handling.
  6. PostgreSQL Database:

    • Stores relational data, such as user accounts, product details, and orders.
  7. Redis:

    • Provides caching to improve system performance.
  8. Prometheus and Grafana:

    • Provides caching to improve system performance.
  9. Docker and Kubernetes:

    • Ensures consistent environments and scalable deployments.

System Workflow πŸ”„

  1. A user sends a request (e.g., login, view products, or place an order) via the API Gateway.
  2. The request is routed to the respective service (User Service, Product Service, or Order Service).
  3. Services communicate asynchronously using Kafka for tasks like order processing.
  4. Responses are sent back to the user through the API Gateway.

System Diagram πŸ–ΌοΈ

Below is a representation of the system architecture (replace with the actual diagram later)

Usage Examples πŸ› οΈ

Example 1: View Products

  1. User sends a GET /products request via the API Gateway.
  2. The request is forwarded to the Product Service.
  3. The Product Service retrieves data from the cache or PostgreSQL and sends the response back.

Example 2: Place an Order

  1. User sends a POST /orders request with the product details.
  2. The Order Service processes the request and emits an event using Kafka.
  3. Other services (e.g., Inventory Service) consume the event to update stock.

How to Run πŸš€

Prerequisites βœ…

  1. Java 17 installed.
  2. Docker and Docker Compose installed.
  3. Access to a PostgreSQL instance.

Steps πŸ› οΈ

  1. Clone the repository:
    git clone https://github.com/your-repo/ProductOrderSystem.git
    cd ProductOrderSystem
  2. Start the services using Docker Compose:
    docker-compose up
  3. Access the Swagger UI for API testing:
    • http://localhost:8080/swagger-ui.html

Contributing 🀝

  1. Fork the repository.
  2. Create a new branch for your feature:
    git checkout -b feature-name
  3. Commit your changes and push them.
  4. Create a pull request.

License πŸ“œ

This project is licensed under the MIT License.

About

The architecture of Product Order System is designed using microservices principles, ensuring scalability, fault tolerance, and modularity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published