Event Notification Service is a business-oriented distributed application that simplifies event organization and internal communication. Administrators create events via a web client; employees connect using a Telegram bot (by username) and receive automatic notifications about events targeted to them.
The system consists of three cooperating services:
- Backend Service 1 — authentication, event creation and storage (PostgreSQL), publishes event messages to Kafka.
- Backend Service 2 — hosts the Telegram bot, subscribes to Kafka topics, filters events by user, and sends Telegram notifications.
- Frontend Service — React web client for administrators to create and manage events and send event topics to the backend.
Message flow:
- Admin creates an event in the frontend.
- Frontend calls Backend Service 1 (authenticated).
- Backend Service 1 persists the event and publishes a message to Kafka (topic:
events). - Backend Service 2 consumes
events, matches recipients, and sends messages via the Telegram Bot API.
- Java & Spring Boot
- Spring Security
- React (JavaScript)
- PostgreSQL
- Apache Kafka
- Docker & Docker Compose
- Telegram Bot API
- Maven (build)
- Docker and Docker Compose (recommended)
- Java 17+
- Maven
- Node.js + npm (for frontend development)
- Kafka (can be run via
docker-compose) - PostgreSQL (can be run via
docker-compose)
Common variables (examples):
POSTGRES_DB— database namePOSTGRES_USER— DB userPOSTGRES_PASSWORD— DB passwordKAFKA_BOOTSTRAP_SERVERS— Kafka broker addressesTELEGRAM_BOT_TOKEN— Telegram bot token (Backend Service 2)JWT_SECRET— authentication secret (Backend Service 1)SERVER_PORT— service port overrides
Place service-specific settings in application.properties / application.yml for each backend service and supply secrets via environment variables or a secret manager.
A single docker-compose.yml can orchestrate PostgreSQL, Zookeeper, Kafka, both backends and the frontend for local testing.
Example:
- Fill
.envwith required variables (DB, Kafka, Telegram token). - Start: docker compose up --build
- Visit frontend at
http://localhost:3000(or configured port). Backend APIs default to ports set in service configs.
Backend (each service): cd backend-service-1 mvn clean package mvn spring-boot:run
Frontend: cd frontend npm install npm start
- Topic used:
events - Producer: Backend Service 1 (publishes event payloads)
- Consumer: Backend Service 2 (filters and routes notifications)
Ensure KAFKA_BOOTSTRAP_SERVERS points to your Kafka cluster.
- Create a bot with BotFather and obtain
TELEGRAM_BOT_TOKEN. - Employees must share their Telegram username with the system (web UI or registration flow).
- Backend Service 2 maps usernames to Telegram chat IDs (store mapping on first interaction or via explicit registration).
- Backend Service 2 sends notifications using the Bot API.
- Use HTTPS & secure networking for production.
- Keep
JWT_SECRET,TELEGRAM_BOT_TOKENand DB passwords out of source control. - Use role-based access controls via Spring Security for admin endpoints.
POST /api/auth/login— authenticate admin users (returns JWT)POST /api/events— create event (admin, authenticated)GET /api/events— list events (admin)- Websocket / push endpoints or Kafka for internal notifications between services
Adjust endpoints according to the actual implementation.
- Collect logs from each service (Docker / ELK / Tempo).
- Monitor Kafka consumer lag and DB health.
- Configure Spring Boot actuator endpoints for health checks.