πŸ’¬ Chat System

Github: github.com/le-minh-duc-dev/chat-system.git

This project is a full-featured chat platform built using Spring Boot microservices, designed for real-world system simulation and backend learning.
It supports:

  • 1-to-1 and group messaging
  • User authentication and authorization
  • Real-time communication via WebSocket
  • Kafka for asynchronous message handling
  • Service discovery, centralized configuration, and API gateway routing

πŸ“‘ Microservices

  1. API Gateway Service
  2. Auth Service
  3. User Service
  4. Chat Service
  5. Message Service
  6. Config Service
  7. Eureka Server
  8. Chat System Frontend

🧱 System Overview

System Design

This project is divided into multiple microservices:

ServiceDescriptionGitHub
πŸ›‘οΈ Auth ServiceHandles user registration, login, and JWT token issuanceauth-service
πŸ” API GatewayCentral entry point for all services: JWT authentication, request routing, rate limiting, and circuit breakingapi-gateway
πŸ‘₯ User ServiceManages user profiles, including profile updates and public info exposureuser-service
πŸ’¬ Chat ServiceManages WebSocket authentication, chat rooms, real-time messaging, user presence tracking, per-room read tracking and Snowflake ID generationchat-service
πŸ“¨ Message ServicePersists chat messages; supports infinite scroll, message historymessage-service
πŸ”§ Config ServerProvides centralized and version-controlled configuration management for all microservicesconfig-server
πŸ” Eureka ServerEnables service discovery, instance registration, and health monitoringeureka-server
πŸ–₯️ FrontendReact-based SPA client with chat UI, client-side routing via Tanstack Router, and optimized virtual list rendering for scalable message panelsfrontend

πŸš€ Technologies Used

This project is built with a cloud-native microservices architecture, focusing on scalability, modularity, and real-time interaction.


🧠 Core Backend Technologies

  • Java 17+ – Modern Java language features and strong typing
  • Spring Boot – Framework for developing microservices with embedded servers
  • Spring Security – Authentication and authorization framework
  • JWT (JSON Web Token) – Stateless, token-based authentication
  • Spring Cloud Gateway – Reactive gateway for routing and filtering
  • Spring WebSocket (STOMP protocol) – Enables full-duplex real-time communication

πŸ“¨ Messaging and Communication

  • Apache Kafka – Distributed event streaming platform

  • Spring for Apache Kafka – Kafka integration with Spring Boot

  • Kafka Topics:

    • chat-messages – Chat message delivery and persistence
    • presence-messages – Online status broadcasts
    • command-messages – System commands to clients

πŸ’Ύ Caching, Rate Limiting & Session State

  • Redis – Used for:

    • Caching
    • Presence tracking
    • WebSocket session tracking
    • Redis Rate Limiter (via Spring Cloud Gateway)

πŸ—„οΈ Databases

  • PostgreSQL – Relational database for structured data persistence (e.g., messages, users)
  • Spring Data JPA – Object-Relational Mapping (ORM) framework for PostgreSQL

πŸ” Service Discovery & Configuration

  • Eureka Server – For service registration and load balancing
  • Spring Cloud Netflix Eureka Client – Enables microservices to register with Eureka
  • Spring Cloud Config Server – Centralized and Git-based external configuration

πŸ“¦ Containerization & Deployment

  • Docker – Containerize each microservice for portability
  • Docker Compose – Define and run multi-container environments (ideal for local development)

πŸ› οΈ Developer Tools and Frameworks

  • Lombok – Simplifies Java boilerplate (e.g., getters, constructors)
  • Spring Cloud OpenFeign – Declarative REST clients for inter-service communication
  • Hibernate Validator – Bean validation for request DTOs

πŸ–₯️ Frontend (React SPA)

  • React + TypeScript – Strongly typed component-based UI development
  • TanStack Router – Modern routing library for single-page apps
  • TanStack Query (React Query) – Data fetching with intelligent caching and refetching
  • TanStack Virtual – Efficient list virtualization (infinite scroll support)
  • Redux Toolkit – Global state management (auth, UI, etc.)
  • HeroUI – Headless UI component library with accessibility
  • STOMP over WebSocket – Real-time chat via @stomp/stompjs
  • Axios – Promise-based HTTP client with JWT interceptor for refresh token logic

πŸ§ͺ Monitoring & Observability

  • Spring Boot Actuator – Exposes health checks, metrics, and runtime endpoints
  • Resilience4j – Circuit breaker pattern integration for Gateway fault tolerance
  • Custom KeyResolvers – Used for user/IP-specific rate limiting

🧱 Architecture

  • Domain-driven Microservices Architecture – Clear separation of concerns and scalability
  • Stateless Services – Built to scale horizontally with no local state
  • Event-Driven Communication – Kafka-based asynchronous processing
  • WebSocket Scaling with Kafka – Cross-instance message fan-out

πŸ™‹β€β™‚οΈ About the Developer

This project is built by @le-minh-duc-dev as a learning project and portfolio showcase demonstrating modern backend engineering techniques.
It highlights:

  • Service communication patterns (Kafka and REST)
  • Stateless JWT-based security
  • Horizontal scalability practices
  • Microservice isolation for fault tolerance

Feel free to explore each repository for detailed implementations and design choices.


πŸ’¬ "Turning ideas into scalable code."

Β© 2025 LΓͺ Minh Đức. Stay curious.