Project Structure
This document explains the organization and purpose of files and directories in the Eventara codebase.
Repository Overview
eventara/
├── src/ # Backend source code
├── eventara-dashboard/ # Frontend React application
├── target/ # Maven build output
├── docs/ # Documentation website (this site)
├── docker-compose.yaml # Service orchestration
├── Dockerfile # Backend Docker image
├── pom.xml # Maven dependencies
├── mvnw, mvnw.cmd # Maven wrapper scripts
├── LICENSE # License file
└── README.md # Project readmeBackend Structure
Source Code (src/main/java/com/eventara/)
src/main/java/com/eventara/
├── EventaraApplication.java # Main application entry point
├── alert/ # Alert handling
│ ├── entity/
│ │ └── AlertHistory.java # Alert history entity
│ ├── enums/
│ │ └── AlertSeverity.java # Alert severity levels
│ └── service/
│ └── AlertTriggerHandler.java # Process triggered alerts
├── analytics/ # Metrics and analytics
│ ├── controller/
│ │ ├── MetricsController.java # REST endpoints for metrics
│ │ └── MetricsWebSocketController.java # WebSocket broadcast
│ └── service/
│ ├── ComprehensiveMetricsService.java # In-memory metrics aggregation
│ ├── MetricsAggregationService.java # Scheduled aggregations
│ └── MetricsCalculator.java # Metrics calculations
├── common/ # Shared components
│ ├── dto/
│ │ ├── ComprehensiveMetricsDto.java # Metrics data transfer object
│ │ ├── EventDto.java # Event data transfer object
│ │ ├── EventRequest.java # Event creation request
│ │ └── EventResponse.java # Event creation response
│ └── repository/
│ └── EventRepository.java # JPA repository for events
├── drools/ # Drools rule engine integration
│ ├── fact/
│ │ └── MetricsFact.java # Fact object for rule evaluation
│ └── service/
│ └── RuleExecutionService.java # Execute rules against metrics
├── ingestion/ # Event ingestion
│ ├── config/
│ │ ├── KafkaConsumerConfig.java # Kafka consumer configuration
│ │ ├── KafkaProducerConfig.java # Kafka producer configuration
│ │ └── WebSocketConfig.java # WebSocket configuration
│ ├── controller/
│ │ └── EventController.java # REST endpoints for events
│ ├── kafka/
│ │ ├── EventConsumer.java # Kafka consumer
│ │ └── EventProducer.java # Kafka producer
│ ├── mapper/
│ │ └── EventMapper.java # Entity to DTO mapping
│ ├── model/
│ │ └── entity/
│ │ └── Event.java # Event JPA entity
│ └── service/
│ └── EventService.java # Event business logic
├── notification/ # Notification system
│ ├── entity/
│ │ ├── NotificationChannel.java # Notification channel config
│ │ └── NotificationLog.java # Notification delivery log
│ └── service/
│ └── NotificationService.java # Send notifications (planned)
└── rule/ # Alert rule management
├── controller/
│ ├── RuleController.java # Rule CRUD endpoints
│ └── RuleTestController.java # Rule testing endpoints
├── dto/
│ ├── request/
│ │ ├── CreateRuleRequest.java # Create rule request
│ │ ├── TestRuleRequest.java # Test rule request
│ │ └── UpdateRuleRequest.java # Update rule request
│ └── response/
│ ├── RuleResponse.java # Rule response
│ └── RuleTestResult.java # Rule test result
├── entity/
│ ├── AlertRule.java # Alert rule entity
│ └── RuleExecutionLog.java # Rule execution log
├── enums/
│ ├── RuleStatus.java # Rule status enum
│ └── RuleType.java # Rule type enum
├── repository/
│ └── RuleRepository.java # JPA repository for rules
└── service/
├── DrlGeneratorService.java # Generate Drools DRL
├── RuleCompilerService.java # Compile DRL rules
├── RuleService.java # Rule interface
├── RuleServiceImpl.java # Rule implementation
└── RuleValidationService.java # Validate rulesResources (src/main/resources/)
src/main/resources/
├── application.properties # Main configuration file
├── db/
│ └── migration/ # Flyway database migrations
│ ├── V1__create_events_table.sql
│ ├── V2__create_alert_rules_table.sql
│ ├── V3__create_alert_history_table.sql
│ ├── V4__create_notification_channels_table.sql
│ ├── V5__create_rule_execution_log_table.sql
│ └── V6__create_notification_log_table.sql
└── static/ # Static web assets (optional)
└── test-websocket.html # WebSocket test pageTest Code (src/test/java/com/eventara/)
src/test/java/com/eventara/
└── [Test classes mirror main structure]Frontend Structure
Dashboard (eventara-dashboard/)
eventara-dashboard/
├── public/ # Static assets
├── src/
│ ├── App.tsx # Root component
│ ├── App.css # App styles
│ ├── main.tsx # Entry point
│ ├── index.css # Global styles
│ ├── assets/ # Images, fonts, etc.
│ ├── components/ # React components
│ │ ├── alerts/ # Alert components
│ │ │ ├── ActiveAlertsPanel.tsx
│ │ │ ├── ActiveAnomaliesAlert.tsx
│ │ │ ├── ComingSoonBanner.tsx
│ │ │ ├── CriticalErrorsAlert.tsx
│ │ │ └── RecentAlertsPanel.tsx
│ │ ├── cards/ # Metric cards
│ │ │ ├── AlertOverviewCards.tsx
│ │ │ ├── DetailedSourceCard.tsx
│ │ │ ├── ErrorOverviewCards.tsx
│ │ │ ├── EventTypeStatsCard.tsx
│ │ │ ├── HeroMetricCard.tsx
│ │ │ ├── LiveMetricDisplay.tsx
│ │ │ ├── PerformanceInsightsCard.tsx
│ │ │ ├── PerformanceOverview.tsx
│ │ │ ├── QuickStatsGrid.tsx
│ │ │ ├── SLAComplianceCard.tsx
│ │ │ ├── SourceHealthOverview.tsx
│ │ │ ├── SourceStatusCard.tsx
│ │ │ ├── SystemHealthBadge.tsx
│ │ │ ├── UserSegmentsCard.tsx
│ │ │ └── UserStatsOverview.tsx
│ │ ├── charts/ # Chart components
│ │ │ ├── AlertStatisticsCharts.tsx
│ │ │ ├── CircularGauge.tsx
│ │ │ ├── ErrorBreakdownChart.tsx
│ │ │ ├── EventDistributionChart.tsx
│ │ │ ├── EventsBySourceChart.tsx
│ │ │ ├── EventsByTypeChart.tsx
│ │ │ ├── EventsOverTimeChart.tsx
│ │ │ ├── LatencyComparisonChart.tsx
│ │ │ ├── LatencyDistributionChart.tsx
│ │ │ ├── PercentileComparisonChart.tsx
│ │ │ └── [more charts]
│ │ ├── layout/ # Layout components
│ │ │ ├── DashboardLayout.tsx
│ │ │ ├── Header.tsx
│ │ │ └── Sidebar.tsx
│ │ └── tables/ # Table components
│ ├── hooks/ # Custom React hooks
│ │ └── useWebSocket.ts # WebSocket connection hook
│ ├── pages/ # Page components
│ │ ├── AlertsAndAnomalies.tsx
│ │ ├── ComingSoon.tsx
│ │ ├── ErrorAnalysis.tsx
│ │ ├── EventAnalytics.tsx
│ │ ├── Overview.tsx
│ │ ├── PerformanceMetrics.tsx
│ │ ├── RealTimeMonitoring.tsx
│ │ ├── SourceAnalytics.tsx
│ │ └── UserAnalytics.tsx
│ ├── types/ # TypeScript types
│ │ ├── common.ts # Common types
│ │ ├── index.ts # Type exports
│ │ ├── metrics.ts # Metrics types
│ │ └── websocket.ts # WebSocket types
│ └── utils/ # Utility functions
│ └── chartConfig.ts # Chart.js configuration
├── index.html # HTML entry point
├── package.json # Node dependencies
├── tsconfig.json # TypeScript configuration
├── tsconfig.app.json # App TypeScript config
├── tsconfig.node.json # Node TypeScript config
├── vite.config.ts # Vite configuration
├── tailwind.config.js # Tailwind CSS configuration
├── postcss.config.js # PostCSS configuration
├── eslint.config.js # ESLint configuration
└── README.md # Dashboard readmeKey File Purposes
Backend
EventaraApplication.java
- Main Spring Boot application class
- Enables async processing and scheduling
- Entry point for the application
Event.java
- JPA entity representing an event
- Maps to
eventstable in PostgreSQL - Uses JSONB for flexible tags and metadata
EventController.java
- REST API for event ingestion
- Handles POST /api/v1/events
- Query endpoints for retrieving events
- Health and status endpoints
EventConsumer.java
- Kafka consumer for processing events
- Saves events to PostgreSQL
- Updates metrics aggregation
- Manual offset management
ComprehensiveMetricsService.java
- In-memory metrics aggregation
- Tracks events by type, source, severity, user
- Calculates latency percentiles
- Error rate tracking
MetricsWebSocketController.java
- Broadcasts metrics via WebSocket
- Runs every 1 second
- Uses STOMP over SockJS
RuleExecutionService.java
- Loads and executes Drools rules
- Evaluates rules against metrics
- Triggers alerts when conditions match
DrlGeneratorService.java
- Converts JSON rule configs to Drools DRL
- Template-based generation
- Validates generated DRL
Frontend
App.tsx
- Root React component
- Sets up routing with React Router
- Initializes WebSocket connection
useWebSocket.ts
- Custom hook for WebSocket management
- Auto-reconnection logic
- Connection state management
- Broadcasts metrics to components
DashboardLayout.tsx
- Main layout wrapper
- Sidebar navigation
- Header with connection status
- Outlet for page content
Overview.tsx
- Dashboard homepage
- Hero metrics display
- Key charts and visualizations
Configuration
application.properties
- Spring Boot configuration
- Database connection settings
- Kafka configuration
- JPA/Hibernate settings
docker-compose.yaml
- Service orchestration
- PostgreSQL, Kafka, Zookeeper
- Spring Boot application
- React dashboard
pom.xml
- Maven dependencies
- Spring Boot version: 3.5.7
- Java version: 21
- Kafka, Drools, WebSocket dependencies
Build Artifacts
Maven (target/)
target/
├── classes/ # Compiled Java classes
├── generated-sources/ # Generated source code
├── test-classes/ # Compiled test classes
├── maven-status/ # Build metadata
└── ingestion-0.0.1-SNAPSHOT.jar # Executable JARVite (eventara-dashboard/dist/)
dist/
├── assets/ # Bundled CSS and JS
├── index.html # Entry HTML
└── vite.svg # FaviconModule Dependencies
Backend Module Dependencies
EventController
→ EventService
→ EventRepository (PostgreSQL)
→ EventProducer (Kafka)
EventConsumer (Kafka)
→ EventRepository (PostgreSQL)
→ ComprehensiveMetricsService
MetricsWebSocketController
→ ComprehensiveMetricsService
→ SimpMessagingTemplate (WebSocket)
RuleController
→ RuleService
→ RuleRepository (PostgreSQL)
→ DrlGeneratorService
→ RuleCompilerService
→ RuleExecutionService
RuleExecutionService
→ RuleRepository
→ AlertTriggerHandler
→ Drools KIEFrontend Component Dependencies
App
→ DashboardLayout
→ Sidebar
→ Header
→ Outlet (React Router)
→ Overview
→ RealTimeMonitoring
→ EventAnalytics
→ [Other pages]
useWebSocket hook
→ SockJS
→ STOMP client
→ Metrics state managementDatabase Schema
See Flyway migrations in src/main/resources/db/migration/ for complete schema:
- V1: events table
- V2: alert_rules table
- V3: alert_history table
- V4: notification_channels table
- V5: rule_execution_log table
- V6: notification_log table
Naming Conventions
Java
- Classes: PascalCase (e.g.,
EventController) - Methods: camelCase (e.g.,
processEvent) - Constants: UPPER_SNAKE_CASE (e.g.,
MAX_RETRY_ATTEMPTS) - Packages: lowercase (e.g.,
com.eventara.ingestion)
TypeScript/React
- Components: PascalCase (e.g.,
EventAnalytics) - Hooks: camelCase with “use” prefix (e.g.,
useWebSocket) - Variables: camelCase (e.g.,
totalEvents) - Types/Interfaces: PascalCase (e.g.,
MetricsData)
Database
- Tables: lowercase snake_case (e.g.,
alert_rules) - Columns: lowercase snake_case (e.g.,
event_type) - Indexes: prefix with
idx_(e.g.,idx_event_type)
Adding New Features
New REST Endpoint
- Create DTO in
common/dto/ - Add method to controller
- Implement in service layer
- Add repository method if needed
- Write tests
New Database Table
- Create Flyway migration:
V{N}__description.sql - Create JPA entity
- Create repository interface
- Update services as needed
New Dashboard Page
- Create component in
src/pages/ - Add route in
App.tsx - Add navigation in
Sidebar.tsx - Create supporting components in
components/
Last updated on