How opfab/operatorfabric-core works
Project Type and Purpose
• OperatorFabric is a full-stack, microservices-based platform for real-time operational event management in utility control centers.
• It provides REST/Kafka endpoints, templating, calendar/timeline UIs, archives, notifications, and integration with external authentication (OAuth2/Keycloak), Prometheus monitoring, and CLI tooling.
High-Level Architecture Components
a. User Interface Layer
• Angular SPA (“ui/main”) served via Nginx or embedded Angular server
• Provides screens (feed, calendar, archives, admin, external-app iframe) and consumes backend REST/Kafka event streams
b. API & Authentication
• OAuth2 / OpenID Connect via Keycloak (config/keycloak)
• WebSecurityConfiguration in each Spring Boot service enforces JWT-based auth
c. Backend Microservices (Java/Spring Boot)
• users – user/group/permission management, MongoDB storage
• businessconfig – stores UI templates, CSS, i18n bundles in file volumes
• cards-publication – consumes “cardCommand” Avro over Kafka, processes/publishes cards, MongoDB storage, response producer
• cards-consultation – WebFlux service serving live card FF over REST & SSE, MongoDB repository
• external-devices – CRUD on device configs, drivers (Modbus), MongoDB
• supervisor – monitors real-time connections, heartbeat, MongoDB
d. Auxiliary Node.js Services
• cards-reminder – schedule reminders via rrule, interfaces with MongoDB and email
• cards-external-diffusion – controls diffusion rates, routing, mail templating via Handlebars
• common – shared Node.js utilities (event bus client, JWT utils)
e. Eventing & Messaging
• Kafka topics for card commands (Avro)
• RabbitMQ (tools/generic/utilities/eventbus) optionally for inter-service events
f. Data Stores
• MongoDB per microservice (config in docker-volumes under services/*/src/main/docker/volume)
• Avro schemas in client modules (client/cards, etc.)
g. CLI & Tooling
• opfab-docker-cli (cli/src) for scripting admin tasks
• bin/ scripts for local development, CI (startOpfab.sh, launch tests)
• tooling/, tools/ for migrations, testing, swagger generation, monitoring
h. CI/CD & Monitoring
• GitHub Actions workflows under .github/workflows
• Gradle multi-module build (build.gradle, settings.gradle)
• Prometheus configured in bin/monitoring (prometheus.yml)
• Scorecards, WhiteSource, SonarCloud integrations
Interactions & Data Flows
• Users ↔ UI (HTTP/HTTPS)
• UI ↔ Backend services (REST/SSE)
• Backend services ↔ MongoDB (read/write)
• cards-publication ↔ Kafka (consume card commands, produce response cards)
• Node.js reminder/diffusion services ↔ Backend services (HTTP client & DB)
• Services ↔ RabbitMQ event bus (broadcast internal events)
• Services ↔ Keycloak (OAuth2 token introspection)
• bin/ scripts ↔ Docker Compose (spin up all containers)
Architectural Patterns & Principles
• Microservices: each bounded context as independent Spring Boot app
• Event-driven: Kafka for domain events, RabbitMQ for cross-service events
• Hexagonal/Ports & Adapters in services (controllers, services, repositories)
• API Gateway pattern implicit via UI’s direct calls to multiple services
• Shared libraries (tools/generic, tools/spring) for cross-cutting concerns
• Configuration-as-code: YAML in config/services, config/web-ui