A full-stack notification system featuring:
- Backend: Spring Boot microservice with JWT security, Kafka integration, WebSocket, and email delivery
- Frontend: Two React apps — Admin UI and User UI — both using JWT authentication and Material UI
- Messaging: Kafka topics for asynchronous, broadcast, and critical notifications
- Real-time: WebSocket channels for instant delivery
- Database: Relational database (H2/PostgreSQL) for persistence
- Email Testing: Email UI for viewing sent emails during development
- Real-time notification delivery to UIs via WebSockets.
- Support for user-specific, broadcast, and critical (email + in-app) notification types.
- Email delivery for critical notifications (viewable with MailCrab in development).
- JWT-based authentication for secure backend and frontend operations.
- Admin UI for sending various notification types and monitoring system statistics.
- User UI for receiving, viewing, and managing personal notifications.
- Asynchronous event processing via Apache Kafka integration.
- Persistence of notifications in a relational database (H2 by default, configurable to PostgreSQL).
- Admin-level statistics on notification volumes and types.
- Search and filtering capabilities in the User UI.
- Backend:
- Java 21, Spring Boot 3.x
- Spring Security (JWT Authentication)
- Spring Data JPA (Hibernate)
- Spring Kafka, Spring WebSocket
- H2 Database (default), PostgreSQL (supported)
- Maven
- Frontend:
- Node.js 20, React 18
- Material UI (MUI)
- Axios (HTTP client)
- StompJS & SockJS (WebSocket communication)
- npm
- Messaging:
- Apache Kafka
- Email Testing (Development):
- MailCrab
- Containerization & Orchestration (Development):
- Docker, Docker Compose
- Admin UI or API clients send notification requests via REST endpoints.
- Notifications can be:
- User-specific
- Broadcast to all users
- Critical (triggers email delivery in addition to in-app)
- NotificationController handles REST API requests.
- NotificationProcessorService:
- Validates input
- Saves notifications to the database
- Notification events can be ingested via Kafka topics (
notifications,broadcast-notifications,critical-notifications) for asynchronous processing. TheNotificationProcessingOrchestratoris then invoked by Kafka consumers. - Sends real-time updates via WebSocket
- Sends emails for critical notifications
- AdminNotificationController provides admin-specific APIs (stats, broadcast, recent notifications).
- Security: JWT-based authentication for all API access.
- Detailed backend API endpoint descriptions, Kafka topics, and WebSocket channels are available in
backend/README.md.
- Kafka topics:
notificationsbroadcast-notificationscritical-notifications
- Kafka consumers process these asynchronously for scalability.
- Notifications stored in the
notificationstable. - Persistence is managed using Spring Data JPA (Hibernate) with the
Notificationentity. - Metadata, tags, and other details persisted.
- Supports querying by user, type, status, and search terms.
- WebSocket topics:
/user/{userId}/notifications(user-specific, typically resolves to/user/{userId}/queue/notificationswith Spring Security STOMP)/topic/broadcasts(broadcast)
- Pushes notifications instantly to connected clients without polling.
- Admin UI:
- Login with admin privileges (JWT)
- Send broadcast, targeted, or critical notifications
- Monitor notification delivery status and view stats
- Built with React, Material UI, React Router
- User UI:
- Login and authenticate (JWT)
- View personal notifications in real-time
- Mark as read, filter, and search notifications
- Built with React, Material UI, React Router
backend/ # Spring Boot notification service
└── src/main/java/com/example/notification
frontend/
├── admin-ui/ # React Admin UI (send & monitor notifications)
└── user-ui/ # React User UI (receive & manage notifications)
scripts/ # All utility shell scripts
├── start_backend.sh # Script to start backend service
├── start_frontend.sh # Script to start both frontends
├── create_kafka_topics.sh # Script to create Kafka topics
└── fix_ui.sh # Script for UI fixes
notification_system.sh # Unified utility script (see below)
docker-compose.yml # Kafka, Zookeeper, DB services
PowerShell versions of the main utility scripts (.ps1) are also available in the root and scripts/ directory.
- Java 21+
- Node.js 20+
- Docker & Docker Compose
- Start Kafka, Zookeeper, and MailCrab using Docker Compose:
The backend service uses an H2 in-memory database by default. The provided
./notification_system.sh docker-up
docker-compose.ymldoes not include a PostgreSQL or other external database service. If you wish to use PostgreSQL, you will need to configure it separately and update the backend'sapplication.properties. - Create Kafka topics:
./notification_system.sh kafka-topics
PowerShell equivalent scripts (e.g., notification_system.ps1) are available for Windows users.
- Open two terminals:
- Terminal 1:
./notification_system.sh backend - Terminal 2:
./notification_system.sh frontend
- Terminal 1:
- This allows you to manage backend and frontend services independently.
- Admin UI: http://localhost:3000
- User UI: http://localhost:3001
- MailCrab (Email UI): http://localhost:1080
The project includes Dockerfiles for building production-ready images of the backend and frontend applications:
- Backend:
backend/Dockerfile - Admin UI:
frontend/admin-ui/Dockerfile - User UI:
frontend/user-ui/Dockerfile
These can be built using standard docker build commands. Deployment will depend on your target environment and may involve pushing these images to a container registry and using orchestration tools like Docker Compose (for simpler setups) or Kubernetes.
notification_system.sh: Run backend, frontend, Kafka topics, and Docker Compose operations. See usage with./notification_system.sh.- All other scripts are now located in the
scripts/directory and referenced bynotification_system.sh. - Note: Stopping services is manual (Ctrl+C in each terminal). For a clean start, ensure no processes are running on ports 3000, 3001, or 8080.
- Admin/User triggers notification via UI or API.
- Backend validates and saves notification.
- Kafka can ingest events for async/broadcast/critical processing by the backend.
- WebSocket pushes real-time updates.
- Email sent for critical notifications.
- If you see "port already in use" errors, kill processes on ports 3000, 3001, and 8080 before starting.
- For log output, see the respective terminal windows running backend or frontend.
- For Docker Compose issues, use
./notification_system.sh docker-downanddocker psto manage containers. - For Kafka issues (e.g., if
start_backend.shhas problems with topics), check the Kafka container logs:docker logs notification-ws-kafka-1(or your specific Kafka container name if different).
PRs welcome. See LICENSE for details. (Note: As of this writing, the LICENSE file is missing and needs to be added to the repository).