A distributed chat application built with Spring Boot using a microservice architecture.
- JWT authentication
- Backend-for-Frontend (BFF)
- Multiple microservices
- REST communication between services
- Event-driven architecture with RabbitMQ
- Bot service consuming message events
Handles external REST requests and validates JWT tokens before forwarding requests to internal services.
Handles login and JWT generation.
Handles user data and user endpoints.
Handles messages and publishes message-published events to RabbitMQ.
Consumes events from RabbitMQ.
- Java
- Spring Boot
- Spring Security
- RabbitMQ
- JWT
- RestClient
| Service | Port |
|---|---|
| BFF | 8080 |
| AuthService | 9000 |
| UserService | 9001 |
| MessageService | 9002 |
| BotService | 9003 |
| RabbitMQ UI | 15672 |
docker start rabbitmq-chatStart the following services in IntelliJ:
- AuthService
- UserService
- MessageService
- BotService
- BFF
POST http://localhost:8080/api/login
Content-Type: application/json
{
"username": "demo",
"password": "demo"
}GET http://localhost:8080/api/users
Authorization: Bearer TOKENGET http://localhost:8080/api/messages
Authorization: Bearer TOKENPOST http://localhost:8080/api/messages
Authorization: Bearer TOKEN
Content-Type: application/json
{
"content": "Hello from demo"
}- Client sends request to BFF
- BFF validates JWT
- BFF forwards request to MessageService
- MessageService publishes
message-published - RabbitMQ distributes the event
- BotService consumes the event
Edvin Karlsson
