Skip to content

Gimi818/OrderManagementSystem

Repository files navigation

Project in progress

This project is a microservice-based e-commerce system designed to enhance the shopping experience through an efficient and scalable service architecture. Utilizing Apache Kafka for inter-service communication ensures real-time data synchronization and event-driven processing. The system comprises several key services:

  • User Service: Manages user registration and account details, providing functionalities such as account creation and user authentication.
  • Product Service: Handles the product catalog, allowing for the addition, browsing, and searching of products within the store.
  • Cart Service: Creates shopping carts for users and supports adding products to carts. It leverages Kafka to maintain consistent cart states across the system.
  • Order Service: Manages order placement and verification of product availability. It coordinates with the Delivery Service for shipping arrangements and uses the EmailSender Service for sending order * confirmations to customers.
  • EmailSender Service: Automates customer communication via email for registration confirmations, order updates, and other notifications. Built on Spring Boot for ease of deployment and PostgreSQL for reliable data storage.

Configuration:

  • API Gateway: Acts as an intermediary layer between various microservices, allowing communication with different services through a single port or endpoint.
  • Database: PostgreSQL is used to manage data relationships, containerized using Docker.
  • Monitoring and Tracing: Zipkin traces HTTP requests passing through various microservices in the application.
  • Service Registration: Eureka Server registers microservices and informs about their availability.
  • Configuration Management: ConfigServer is responsible for centralized storage and distribution of configuration for microservices.
  • Inter-Service Communication: Microservices communicate with each other over HTTP by exposing endpoints and using Feign Client.

Application is developed using following technologies:

java spring docker java git mysql docker java java java java java

Microservice Architecture

To run the application, follow these steps :

  • Install IntelliJ IDEA and Docker Desktop on your computer.
  • Run Docker Desktop.
  • Clone the repository in IntelliJ IDEA using the link https://github.com/Gimi818/OrderManagementSystem
  • Run docker-compose up in the terminal.
  • Run the ConfigServer, DiscoveryServer, and Gateway in IntelliJ IDEA.
  • Run the other services: user, product, cart, order, and emailSender in IntelliJ IDEA.
  • Try the applications in Postaman, the steps on how to do it are below.

How to use the application in Postman:

Step 1 :
POST localhost:8222/api/v1/users/registration
Enter your data.
JSON:
{
 "email":"[email protected]",
 "fullName":"Wojciech Gmiterek",
 "password":"password",
 "repeatedPassword" :"password"
}

Step 2 :
Get all available products
GET localhost:8222/api/v1/products/all

You can use other queries to sort the products
localhost:8222/api/v1/products/sorted/price/desc
localhost:8222/api/v1/products/sorted/price/asc
localhost:8222/api/v1/products/category?category=PHONE
localhost:8222/api/v1/products/search/range/by-price?priceMin=3000&priceMax=3555

Step 3 :
POST localhost:8222/api/v1/products/1/addToCart/5/?stock=1
Enter the user ID, product id, and product stock into the URL to add the product to the cart

Step 4 :
GET localhost:8222/api/v1/carts/1/contents
Enter the user ID to get the contents of your cart.

Step 5 :
POST localhost:8222/api/v1/carts/order/1
Enter the user ID to place an order. 
JSON:
{
 "city": "Kraków",
 "postcode": "30-001",
 "street": "Rynek Główny",
 "houseNumber": "12"
}

Step 6 :
Check the email to which the order confirmation email was sent