You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A production-ready REST API for a real-time chat system built with Java 17 and Spring Boot 3.2.5. Supports user authentication, chat rooms (direct & group), messaging with file attachments, and real-time WebSocket communication.
Technology Stack
Technology
Purpose
Java 17
Programming language
Spring Boot 3.2.5
Application framework
Spring Data JPA
Data access layer
Spring Security
Authentication & authorization
JWT (jjwt 0.12.5)
Token-based authentication
H2 Database
Development/testing database
PostgreSQL
Production database
Spring WebSocket
Real-time messaging
SpringDoc OpenAPI 2.5
API documentation (Swagger UI)
Lombok
Boilerplate code reduction
JUnit 5 + Mockito
Testing framework
Features
Mandatory Features ✅
JWT authentication with refresh tokens
Role-based access control (USER, ADMIN)
CRUD operations on 5 entities with relationships
DTOs with Bean Validation
Global exception handling with @ControllerAdvice
Normalized database schema with indexes
Swagger/OpenAPI documentation
Additional Features ⭐
Pagination & Sorting — All list endpoints paginated with configurable size/sort
Soft Delete — Messages use logical deletion with admin restore
Audit Trail — Automatic createdAt, updatedAt, createdBy, updatedBy on all entities
File Upload/Download — Attachments with file type and size validation
Advanced Security — Account lockout after 5 failed login attempts
Bonus
WebSocket support for real-time messaging via STOMP
Setup Instructions
Prerequisites
Java 17+ installed (java -version)
Maven 3.8+ installed (mvn -version) OR use the included Maven wrapper
Run the Application
# Clone the project
git clone <repository-url>cd chat-backend
# Run with dev profile (H2 in-memory database)
mvn spring-boot:run -Dspring-boot.run.profiles=dev
# OR using Maven wrapper (if present)
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev