π¬ 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
- API Gateway Service
- Auth Service
- User Service
- Chat Service
- Message Service
- Config Service
- Eureka Server
- Chat System Frontend
π§± System Overview
This project is divided into multiple microservices:
Service | Description | GitHub |
---|---|---|
π‘οΈ Auth Service | Handles user registration, login, and JWT token issuance | auth-service |
π API Gateway | Central entry point for all services: JWT authentication, request routing, rate limiting, and circuit breaking | api-gateway |
π₯ User Service | Manages user profiles, including profile updates and public info exposure | user-service |
π¬ Chat Service | Manages WebSocket authentication, chat rooms, real-time messaging, user presence tracking, per-room read tracking and Snowflake ID generation | chat-service |
π¨ Message Service | Persists chat messages; supports infinite scroll, message history | message-service |
π§ Config Server | Provides centralized and version-controlled configuration management for all microservices | config-server |
π Eureka Server | Enables service discovery, instance registration, and health monitoring | eureka-server |
π₯οΈ Frontend | React-based SPA client with chat UI, client-side routing via Tanstack Router, and optimized virtual list rendering for scalable message panels | frontend |
π 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 persistencepresence-messages
β Online status broadcastscommand-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.