Real-Time Operations Monitoring Platform / Plataforma de Monitoreo Operacional en Tiempo Real
Monitor is a real-time operations monitoring dashboard that streams live events from a Java/Spring Boot backend to a Next.js/React frontend using Server-Sent Events (SSE).
It provides a single pane of glass for two critical data streams:
- Data events — changes captured from an Oracle database via Debezium CDC (Change Data Capture) and Apache Kafka.
- Infrastructure events — periodic health-check polls of secondary databases and background daemons, with automatic alerting when a target goes DOWN.
Critical events trigger both an instant visual alert in the dashboard (with an audio cue) and an asynchronous email notification to the configured recipients.
| Feature | Details |
|---|---|
| 🔴 Real-time streaming | Server-Sent Events push updates instantly to every connected browser tab — no polling required from the client. |
| 📋 CDC integration | Debezium captures every INSERT into the Oracle log_traza table and forwards it to Kafka, which the backend consumes and rebroadcasts. |
| 🩺 Infrastructure health checks | Scheduled polls (default: every 30 s) monitor databases and daemons, emitting events only on status transitions to reduce noise. |
| 🔔 Email alerts | An async email is sent for every CRITICAL event without blocking the event pipeline. |
| 🔊 Audio cues | The frontend plays a short beep sequence (Web Audio API) when a CRITICAL event arrives. |
| 📊 Live log dashboard | The Next.js UI maintains a rolling log of up to 100 events and a per-source infrastructure status board. |
| 🐳 Docker Compose ready | The full stack (Oracle XE, Zookeeper, Kafka, Debezium, backend, frontend) with healthchecks and dependency ordering. |
The diagram below shows the logical flow of events through the system — how data moves from sources (Oracle, periodic health checks) through the event bus to the frontend. This is not an infrastructure/deployment diagram; see docs/README.md for C4 architecture views and system context diagrams.
Oracle DB
│ (INSERT into log_traza)
▼
Debezium / Kafka Connect ──► Kafka Topic (log_traza)
│
KafkaConsumerService ──► EmailService (CRITICAL only, @Async)
│
EventBus (ConcurrentHashMap + Virtual Threads)
▲
PollingService ──────► EmailService (CRITICAL only, @Async)
(health checks, @Scheduled every 30 s)
│
SseController
GET /api/events/stream
│
Next.js Frontend
useMonitor() hook
EventSource API
Event flow:
- Debezium detects a new row in
log_trazaand publishes a CDC message to Kafka. KafkaConsumerServiceparses the Debezium envelope, builds aUnifiedEvent, and callsEventBus.publish().PollingServiceruns on a fixed schedule, checks each target, and callsEventBus.publish()on status changes.EventBusfans out eachUnifiedEventto all activeSseEmitterinstances using Virtual Threads (one lightweight thread per client).- The browser's
EventSourcereceives the event under its named channel ("data"or"infrastructure") and theuseMonitorhook updates the React state.
| Layer | Technology |
|---|---|
| Backend | Java 21 (Virtual Threads), Spring Boot 3.4.4, Maven |
| Messaging | Apache Kafka 4.2.0 + Debezium 3.5.0.Final (CDC) |
| Database | Oracle XE 11g |
| Spring Mail (SMTP with TLS) | |
| Security | Spring Security, Bucket4j (Rate Limiting) |
| Monitoring | Spring Boot Actuator (/actuator/health) |
| Frontend | Next.js 15, React 18, TypeScript, Tailwind CSS |
| Container | Docker multi-stage builds, Docker Compose |
| CI/CD | GitHub Actions |
| Tool | Minimum version |
|---|---|
| Java (JDK) | 21 |
| Maven | 3.9 |
| Node.js | 20 |
| npm | 9 |
| Docker & Docker Compose | 20 / 2 |
git clone https://github.com/careb36/Monitor.git
cd MonitorCreate a .env file at the project root (see .env.example if available):
ORACLE_PASSWORD=your_oracle_password
MONITOR_APP_USER=monitor_app
MONITOR_APP_PASSWORD=your_app_passwordThen start everything:
docker compose up -dThis starts Oracle XE, Zookeeper, Kafka, Debezium, the backend, and the frontend — with health-based dependency ordering. The frontend waits for the backend to be healthy, and the backend waits for Kafka and Oracle.
Open http://localhost:3000 and click "Start Monitoring" to open the SSE connection.
Backend:
mvn --batch-mode clean verify
mvn spring-boot:run -Dspring-boot.run.profiles=devThe backend starts on http://localhost:8080.
Frontend:
cd frontend
npm install
npm run devThe dashboard opens on http://localhost:3000. The next.config.js rewrites proxy /api/* requests to localhost:8080 automatically.
Both services use multi-stage builds to minimize image size:
- Backend —
maven:3.9.9-eclipse-temurin-21-alpine(build) →eclipse-temurin:21-jre-alpine(runtime, ~200 MB). Runs as non-rootmonitoruser. - Frontend —
node:20-alpine(build) →node:20-alpinewith Next.js standalone output (runtime, ~100 MB). Runs as non-rootnextjsuser.
Docker Compose healthchecks:
| Service | Health check | Start period |
|---|---|---|
| Oracle | healthcheck.sh |
— |
| Kafka | kafka-topics --list |
— |
| Debezium | curl to REST API |
60 s |
| Backend | wget /actuator/health |
40 s |
| Frontend | wget http://localhost:3000 |
20 s |
Dependency chain: Oracle + Kafka (healthy) → Backend (healthy) → Frontend
Networking: All services communicate over a dedicated monitor-net bridge network. The frontend reaches the backend using Docker DNS (http://backend:8080) via a build-time BACKEND_URL argument baked into Next.js rewrites.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/events/stream |
MONITOR_USER role |
SSE stream with data and infrastructure named events. |
GET |
/actuator/health |
Public | Application health status for Docker/load balancer probes. |
UnifiedEvent payload:
{
"type": "DATA | INFRASTRUCTURE",
"severity": "INFO | WARNING | CRITICAL",
"source": "string",
"message": "string",
"timestamp": "2025-06-01T12:00:00Z"
}- Authentication: HTTP Basic (stateless, no session CSRF needed for GET-only SSE).
- Authorization: SSE stream requires
MONITOR_USERrole; admin endpoints requireMONITOR_ADMIN. - Rate limiting: Bucket4j throttles requests per time window (configurable).
- Headers: HSTS, CSP, X-Frame-Options (deny), X-Content-Type-Options, Referrer-Policy.
- Health endpoint:
/actuator/healthis publicly accessible (no sensitive details exposed). - Containers: Both images run as non-root users.
- Scanning: OWASP Dependency-Check in Maven (fail on CVSS ≥ 8.0).
# Backend: all unit tests
mvn --batch-mode test
# Backend: full build + test + security scan
mvn --batch-mode clean verify
# Frontend: lint
cd frontend && npm run lintMonitor/
├── src/main/java/com/monitor/
│ ├── App.java # Main class
│ ├── config/ # CORS, Security, Jackson
│ ├── controller/SseController.java # SSE endpoint
│ ├── model/ # EventType, Severity, UnifiedEvent
│ ├── security/ # Rate limiting
│ └── service/
│ ├── EmailService.java # Async CRITICAL alerts
│ ├── EventBus.java # SSE fan-out hub
│ ├── KafkaConsumerService.java # CDC consumer
│ ├── PollingService.java # Health-check poller
│ └── persistence/ # Outbox entities & repos
├── src/main/resources/application.yml # All config (profiles: dev, staging, prod)
├── src/test/java/com/monitor/ # JUnit 5 + Mockito tests
├── frontend/
│ ├── src/app/ # Next.js pages
│ ├── src/hooks/useMonitor.ts # SSE hook
│ ├── src/lib/types.ts # TypeScript types
│ ├── next.config.js # Standalone output + API rewrites
│ └── Dockerfile # Multi-stage (node:20-alpine)
├── docker/
│ ├── oracle/init.sql # DB init + Debezium setup
│ └── debezium/connector-log-traza.json
├── docs/ # Architecture, ADRs, runbooks, diagrams
├── Dockerfile # Backend multi-stage (temurin-21-alpine)
├── docker-compose.yml # Full stack with healthchecks
├── AGENTS.md # AI agent guardrails
├── CONTRIBUTING.md # Contribution workflow
└── CHANGELOG.md # Release history
| Branch | Purpose |
|---|---|
main |
Production-ready code (protected) |
develop |
Integration branch (protected) |
feature/* |
New features — from develop |
bugfix/* |
Non-critical fixes — from develop |
release/* |
Release preparation — merges into main + develop |
hotfix/* |
Emergency fixes — from main |
All changes to main and develop go through Pull Requests with CI approval.
| Workflow | Trigger | Purpose |
|---|---|---|
ci.yml |
Push/PR to develop, feature/*, bugfix/* |
Build & test |
release.yml |
Push/PR on release/*, hotfix/* |
Build, test & tag |
deploy.yml |
Push to main |
Build & deploy |
lint.yml |
Pull Requests | Conventional Commits & branch naming |
- CONTRIBUTING.md — workflow, commit conventions, PR expectations
- AGENTS.md — guardrails for AI coding agents
- docs/README.md — detailed architecture diagrams (C4 views, sequence diagrams, system context), ADRs (architectural decisions), and operational runbooks
- CHANGELOG.md — release history
Architecture Diagram Types:
- Logical Flow (this README, "Architecture" section) — shows how events move through services
- C4 System Context — high-level actors and system boundaries
- C4 Container — major components (Backend, Frontend, Kafka, Oracle)
- C4 Component — Java services and event bus internals
- Sequence Diagrams — SSE streaming and critical alert flows at runtime
This project is licensed under the Apache License 2.0.
Monitor es un panel de monitoreo de operaciones en tiempo real que transmite eventos en vivo desde un backend Java/Spring Boot a un frontend Next.js/React utilizando Server-Sent Events (SSE).
Proporciona una única vista centralizada de dos flujos de datos críticos:
- Eventos de datos — cambios capturados desde una base de datos Oracle mediante Debezium CDC (Change Data Capture) y Apache Kafka.
- Eventos de infraestructura — sondeos periódicos de salud a bases de datos secundarias y demonios en segundo plano, con alertas automáticas cuando un objetivo cae.
Los eventos críticos activan simultáneamente una alerta visual en el panel (con señal de audio) y una notificación por correo electrónico asíncrona a los destinatarios configurados.
| Característica | Detalle |
|---|---|
| 🔴 Streaming en tiempo real | Los Server-Sent Events empujan actualizaciones instantáneamente a cada pestaña del navegador conectada, sin necesidad de polling desde el cliente. |
| 📋 Integración CDC | Debezium captura cada INSERT en la tabla Oracle log_traza y lo reenvía a Kafka, que el backend consume y retransmite. |
| 🩺 Verificaciones de salud | Sondeos programados (por defecto: cada 30 s) monitorean bases de datos y demonios, emitiendo eventos solo en transiciones de estado para reducir el ruido. |
| 🔔 Alertas por correo | Se envía un correo asíncrono por cada evento CRITICAL sin bloquear el pipeline de eventos. |
| 🔊 Señales de audio | El frontend reproduce una secuencia corta de pitidos (Web Audio API) cuando llega un evento CRITICAL. |
| 📊 Panel de log en vivo | La interfaz Next.js mantiene un log rotativo de hasta 100 eventos y un tablero de estado de infraestructura por fuente. |
| 🐳 Docker Compose listo | Stack completo (Oracle XE, Zookeeper, Kafka, Debezium, backend, frontend) con healthchecks y orden de dependencias. |
El diagrama de abajo muestra el flujo lógico de eventos a través del sistema — cómo se mueven los datos desde las fuentes (Oracle, verificaciones de salud periódicas) a través del event bus hasta el frontend. Esto no es un diagrama de infraestructura/despliegue; ver docs/README.md para vistas arquitectónicas C4 y diagramas de contexto del sistema.
Oracle DB
│ (INSERT en log_traza)
▼
Debezium / Kafka Connect ──► Kafka Topic (log_traza)
│
KafkaConsumerService ──► EmailService (solo CRITICAL, @Async)
│
EventBus (ConcurrentHashMap + Hilos Virtuales)
▲
PollingService ──────► EmailService (solo CRITICAL, @Async)
(verificaciones de salud, @Scheduled cada 30 s)
│
SseController
GET /api/events/stream
│
Frontend Next.js
hook useMonitor()
EventSource API
Flujo de eventos:
- Debezium detecta una nueva fila en
log_trazay publica un mensaje CDC en Kafka. KafkaConsumerServiceanaliza el envelope de Debezium, construye unUnifiedEventy llama aEventBus.publish().PollingServicese ejecuta en intervalos fijos, verifica cada objetivo y llama aEventBus.publish()en cambios de estado.EventBusdistribuye cadaUnifiedEventa todos losSseEmitteractivos mediante Hilos Virtuales (un hilo ligero por cliente).- El
EventSourcedel navegador recibe el evento en su canal nombrado ("data"o"infrastructure") y el hookuseMonitoractualiza el estado de React.
| Capa | Tecnología |
|---|---|
| Backend | Java 21 (Hilos Virtuales), Spring Boot 3.4.4, Maven |
| Mensajería | Apache Kafka 4.2.0 + Debezium 3.5.0.Final (CDC) |
| Base de datos | Oracle XE 11g |
| Correo | Spring Mail (SMTP con TLS) |
| Seguridad | Spring Security, Bucket4j (Rate Limiting) |
| Monitoreo | Spring Boot Actuator (/actuator/health) |
| Frontend | Next.js 15, React 18, TypeScript, Tailwind CSS |
| Contenedores | Docker multi-stage builds, Docker Compose |
| CI/CD | GitHub Actions |
| Herramienta | Versión mínima |
|---|---|
| Java (JDK) | 21 |
| Maven | 3.9 |
| Node.js | 20 |
| npm | 9 |
| Docker y Docker Compose | 20 / 2 |
git clone https://github.com/careb36/Monitor.git
cd MonitorCrear un archivo .env en la raíz del proyecto (ver .env.example si está disponible):
ORACLE_PASSWORD=tu_password_oracle
MONITOR_APP_USER=monitor_app
MONITOR_APP_PASSWORD=tu_password_appLuego levantar todo:
docker compose up -dEsto inicia Oracle XE, Zookeeper, Kafka, Debezium, el backend y el frontend — con orden de dependencias basado en healthchecks. El frontend espera a que el backend esté healthy, y el backend espera a Kafka y Oracle.
Abrir http://localhost:3000 y hacer clic en "Start Monitoring" para abrir la conexión SSE.
Backend:
mvn --batch-mode clean verify
mvn spring-boot:run -Dspring-boot.run.profiles=devEl backend se inicia en http://localhost:8080.
Frontend:
cd frontend
npm install
npm run devEl panel se abre en http://localhost:3000. El next.config.js redirige las peticiones /api/* a localhost:8080 automáticamente.
Ambos servicios usan multi-stage builds para minimizar el tamaño de imagen:
- Backend —
maven:3.9.9-eclipse-temurin-21-alpine(build) →eclipse-temurin:21-jre-alpine(runtime, ~200 MB). Ejecuta como usuario no-rootmonitor. - Frontend —
node:20-alpine(build) →node:20-alpinecon standalone output de Next.js (runtime, ~100 MB). Ejecuta como usuario no-rootnextjs.
Healthchecks en Docker Compose:
| Servicio | Health check | Start period |
|---|---|---|
| Oracle | healthcheck.sh |
— |
| Kafka | kafka-topics --list |
— |
| Debezium | curl a REST API |
60 s |
| Backend | wget /actuator/health |
40 s |
| Frontend | wget http://localhost:3000 |
20 s |
Cadena de dependencias: Oracle + Kafka (healthy) → Backend (healthy) → Frontend
Red: Todos los servicios se comunican sobre una red bridge dedicada monitor-net. El frontend llega al backend usando DNS de Docker (http://backend:8080) mediante un argumento de build BACKEND_URL incorporado en los rewrites de Next.js.
| Método | Endpoint | Auth | Descripción |
|---|---|---|---|
GET |
/api/events/stream |
Rol MONITOR_USER |
Stream SSE con eventos nombrados data e infrastructure. |
GET |
/actuator/health |
Público | Estado de salud para probes de Docker/balanceador. |
Payload UnifiedEvent:
{
"type": "DATA | INFRASTRUCTURE",
"severity": "INFO | WARNING | CRITICAL",
"source": "string",
"message": "string",
"timestamp": "2025-06-01T12:00:00Z"
}- Autenticación: HTTP Basic (stateless, sin CSRF para API de solo GET).
- Autorización: SSE requiere rol
MONITOR_USER; endpoints admin requierenMONITOR_ADMIN. - Rate limiting: Bucket4j limita peticiones por ventana de tiempo (configurable).
- Headers: HSTS, CSP, X-Frame-Options (deny), X-Content-Type-Options, Referrer-Policy.
- Health endpoint:
/actuator/healthes público (sin detalles sensibles expuestos). - Contenedores: Ambas imágenes ejecutan como usuarios no-root.
- Escaneo: OWASP Dependency-Check en Maven (falla en CVSS ≥ 8.0).
# Backend: todos los tests unitarios
mvn --batch-mode test
# Backend: build completo + tests + escaneo de seguridad
mvn --batch-mode clean verify
# Frontend: lint
cd frontend && npm run lintMonitor/
├── src/main/java/com/monitor/
│ ├── App.java # Clase principal
│ ├── config/ # CORS, Security, Jackson
│ ├── controller/SseController.java # Endpoint SSE
│ ├── model/ # EventType, Severity, UnifiedEvent
│ ├── security/ # Rate limiting
│ └── service/
│ ├── EmailService.java # Alertas CRITICAL async
│ ├── EventBus.java # Hub de fan-out SSE
│ ├── KafkaConsumerService.java # Consumidor CDC
│ ├── PollingService.java # Poller de health-checks
│ └── persistence/ # Entidades y repos del Outbox
├── src/main/resources/application.yml # Config (perfiles: dev, staging, prod)
├── src/test/java/com/monitor/ # Tests JUnit 5 + Mockito
├── frontend/
│ ├── src/app/ # Páginas Next.js
│ ├── src/hooks/useMonitor.ts # Hook SSE
│ ├── src/lib/types.ts # Tipos TypeScript
│ ├── next.config.js # Standalone output + API rewrites
│ └── Dockerfile # Multi-stage (node:20-alpine)
├── docker/
│ ├── oracle/init.sql # Init DB + setup Debezium
│ └── debezium/connector-log-traza.json
├── docs/ # Arquitectura, ADRs, runbooks, diagramas
├── Dockerfile # Backend multi-stage (temurin-21-alpine)
├── docker-compose.yml # Stack completo con healthchecks
├── AGENTS.md # Guardrails para agentes IA
├── CONTRIBUTING.md # Flujo de contribución
└── CHANGELOG.md # Historial de cambios
| Rama | Propósito |
|---|---|
main |
Código listo para producción (protegida) |
develop |
Rama de integración (protegida) |
feature/* |
Nuevas funcionalidades — desde develop |
bugfix/* |
Correcciones no críticas — desde develop |
release/* |
Preparación de versiones — se fusiona en main + develop |
hotfix/* |
Correcciones urgentes — desde main |
Todos los cambios a main y develop pasan por Pull Requests con aprobación de CI.
| Flujo de Trabajo | Disparador | Propósito |
|---|---|---|
ci.yml |
Push/PR a develop, feature/*, bugfix/* |
Compilar y probar |
release.yml |
Push/PR en release/*, hotfix/* |
Compilar, probar y etiquetar |
deploy.yml |
Push a main |
Compilar y desplegar |
lint.yml |
Pull Requests | Conventional Commits y nomenclatura de ramas |
- CONTRIBUTING.md — flujo de trabajo, convenciones de commits, expectativas de PR
- AGENTS.md — guardrails para agentes de IA
- docs/README.md — diagramas detallados de arquitectura (vistas C4, diagramas de secuencia, contexto del sistema), ADRs (decisiones arquitectónicas) y runbooks operacionales
- CHANGELOG.md — historial de cambios
Tipos de diagramas de arquitectura:
- Flujo Lógico (este README, sección "Arquitectura") — muestra cómo se mueven los eventos a través de servicios
- C4 System Context — actores de alto nivel y límites del sistema
- C4 Container — componentes principales (Backend, Frontend, Kafka, Oracle)
- C4 Component — servicios Java e internals del event bus
- Sequence Diagrams — flujos de SSE y alertas críticas en tiempo de ejecución
Este proyecto está bajo la Licencia Apache 2.0.