nuricanozturk01 / Book-Sales-Platform

Book Sales Platform using microservices, Apache Kafka and Web Socket for SE-4458 Presentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Book-Sales-Platform

Project Architecture Overview

Introduction

This document provides an overview of the architecture for a microservices-based system. The system is designed to handle various services such as user management, book management, order processing, payment processing, and notifications. The architecture leverages Spring Boot for the microservices framework, WebSocket for real-time client-server communication, and Apache Kafka for handling message streams between services.

System Architecture Diagram

diagram

Demo Video

Notification

demo.mp4

UI

log_trace_ui.mp4

Components Description

API Gateway

  • Serves as the entry point for clients.
  • Routes requests to appropriate microservices.
  • Can be implemented using Spring Cloud Gateway.

Discovery Service

  • Manages service instances and routing.
  • Typically implemented with Eureka or Consul.

User Management

  • Handles user information and authentication.
  • Interacts with User DB (PostgreSQL).
  • Implemented using Spring Boot with Spring Security.

Book Service

  • Manages book information and inventory.
  • Interacts with Book DB (PostgreSQL).
  • Implemented with Spring Boot.

Order Service

  • Processes book orders.
  • Interacts with Order DB (PostgreSQL).
  • Implemented using Spring Boot and may use Spring Cloud Stream with Kafka.

Stock Service

  • Manages stock levels of books.
  • Interacts with Stock DB (MongoDB).
  • Implemented using Spring Boot and communicates via Kafka topics.

Payment Service

  • Processes payments for orders.
  • Interacts with Payment DB (PostgreSQL).
  • Uses Spring Boot and Kafka for transaction events.

Notification Service

  • Sends notifications to users about various events such as order status, payment confirmations, etc.
  • Interacts with Notification DB (MongoDB).
  • Implemented with Spring Boot and uses Kafka for receiving notification triggers.

Log Service

  • Centralized logging service for all microservices.
  • implemented for log simulation.

Kafka Broker

  • Apache Kafka used as the messaging backbone.
  • Different topics are defined for various event types.

WebSocket

  • Allows for real-time communication between the server and clients.
  • Can be implemented using STOMP over WebSocket with Spring Boot.

Technologies Used

  • Java 17
  • Spring Framework 6:
  • Spring Boot 3.1.6: Primary framework for creating microservices.
  • WebSocket: For real-time bi-directional communication between client and server.
  • Apache Kafka: For handling distributed streaming of messages.
  • PostgreSQL: For relational databases.
  • MongoDB: For non-relational databases.
  • Apache Kafka: For Message Broker.
  • Spring Cloud Stream: For building highly scalable event-driven microservices connected with shared messaging systems.
  • Spring Cloud Gateway: For API Gateway.
  • Eureka Server: For Service Discovery.
  • Angular: For Frontend.

Running the Services

Instructions on how to run and deploy individual services should be provided, detailing any specific configurations required for Spring Boot applications, WebSocket setup, and Kafka topic initialization.

Conclusion

This architecture is designed to be scalable, resilient, and flexible, capable of handling high-volume data streams and real-time communication with clients. By using Spring Boot, WebSocket, and Apache Kafka, the system ensures a robust backend capable of managing a complex flow of data across various services and databases.

Important Notes

  • This project was made to learn Apache Kafka. Most details other than Kafka have been overlooked (Example: security, etc..). In this project, the basic features of Kafka have been used. A simple log tracking system that will support Kafka has been made. The sole purpose of the Log Tracking system is to send the data coming from Kafka to Angular via websocket and display the logs in real time.
  • The project is not complete. It is still in development. The project will be completed in the future.
  • The project is not suitable for production. It is not recommended to use it in production.
  • I will update the project when I learnt new things about Apache Kafka, Websocket, Reactive Programming, etc..

About

Book Sales Platform using microservices, Apache Kafka and Web Socket for SE-4458 Presentation


Languages

Language:Java 95.0%Language:TypeScript 3.5%Language:CSS 0.9%Language:HTML 0.5%