In-app notifications and optional email delivery for the Library Booking System. Creates user-scoped messages from booking, resource, and policy events on RabbitMQ and exposes an inbox API through the gateway.
flowchart TB
RMQ[(RabbitMQ)] -->|booking / resource / policy events| NOTIF[notification-service]
NOTIF --> PG[(notification_db)]
NOTIF --> MAIL[SMTP optional]
Client --> GW[api-gateway] --> NOTIF
NOTIF --> USER[user-service]
Base path: http://localhost:8080/api/notifications
| Method | Path | Description |
|---|---|---|
| GET | / |
Notifications for the authenticated user |
| GET | /unread/count |
Unread count |
| PUT | /{id}/read |
Mark one notification read |
| PUT | /read-all |
Mark all read |
Ownership is enforced per notification (users only see their own messages).
- Java 17, Spring Boot 3.5
- JPA (PostgreSQL), AMQP, Spring Mail, Spring Security, AOP
- common-aspects
| Variable | Default (Compose) | Purpose |
|---|---|---|
DB_* |
notification_db |
Persistence |
RABBITMQ_* |
broker in Compose | Event consumption |
USER_SERVICE_URL |
user-service | Enrichment when needed |
MAIL_ENABLED |
false |
Toggle outbound email |
MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_FROM |
— | SMTP when enabled |
JWT_SECRET, JWT_EXPIRATION |
shared with stack | API auth |
HTTP port 3006.
cd docker-compose
docker compose up -d notification-serviceEmail stays off in the default Compose profile; enable MAIL_* when testing SMTP.
- booking-service — booking event source
- catalog-service — resource events
- frontend-web — notification UI