- Next.js 16.0.0 - React framework with App Router
- React 19.2.0 - UI library
- TypeScript 5.x - Type-safe JavaScript
- Tailwind CSS 4.1.9 - Utility-first CSS framework
- Radix UI - Accessible component primitives (26+ components)
- Accordion, Alert Dialog, Avatar, Checkbox, Dialog, Dropdown Menu, etc.
- Lucide React 0.454.0 - Icon library
- class-variance-authority 0.7.1 - Component variant management
- tailwind-merge 2.5.5 - Tailwind class merging utility
- next-themes 0.4.6 - Theme management
- D3.js (latest) - Force-directed graph visualization
- Recharts 2.15.4 - Chart components
- Vanta.js - Animated background effects
- React Hook Form 7.60.0 - Form state management
- Zod 3.25.76 - Schema validation
- @hookform/resolvers 3.10.0 - Form validation integration
- WebSocket - Native WebSocket API for real-time updates
- Custom
useWebSockethook with auto-reconnection
- Vitest 4.0.8 - Unit testing framework
- @testing-library/react 16.3.0 - React component testing
- @testing-library/jest-dom 6.9.1 - DOM matchers
- @testing-library/user-event 14.6.1 - User interaction simulation
- MSW 2.12.1 - API mocking
- jsdom 27.1.0 - DOM implementation
- ESLint 9.39.1 - Code linting
- TypeScript ESLint - TypeScript-specific linting
- Autoprefixer 10.4.20 - CSS vendor prefixing
- @vercel/analytics 1.3.1 - Analytics integration
Total Dependencies: 50+ production dependencies Total Dev Dependencies: 20+ development dependencies
- date-fns 4.1.0 - Date formatting
- cmdk 1.0.4 - Command menu
- sonner 1.7.4 - Toast notifications
- vaul 0.9.9 - Drawer component
- embla-carousel-react 8.5.1 - Carousel component
- react-resizable-panels 2.1.7 - Resizable panel layouts
- input-otp 1.4.1 - OTP input component
- REST API Base URL:
http://localhost:8000(configurable viaNEXT_PUBLIC_API_URL) - WebSocket URL:
ws://localhost:8000/ws(configurable viaNEXT_PUBLIC_WS_URL)
Query Parameters:
severity- Filter by severity (critical, high, medium, low)facility- Filter by facility IDstatus_filter- Filter by status (new, acknowledged, resolved, false-positive)search- Full-text search querytime_range- Time range filterpage- Page number for paginationlimit- Items per page
Response:
{
alerts: Alert[],
total: number,
page: number,
pages: number,
limit: number
}Response:
{
total: number,
critical: number,
unresolved: number,
false_positives: number
}Body:
{
status: string
}Response: Updated Alert object
Response: Current FL round object or null
Response: Array of FL client objects
Response:
{
epsilon: number,
delta: string,
data_size: string,
encryption: string,
privacy_budget_remaining: number
}Response: New FL round object
Query Parameters:
limit- Number of predictions to returnoffset- Pagination offset
Response: Latest prediction object
Response:
{
nodes: TechniqueNode[],
links: TechniqueLink[]
}Response: Array of all technique details
Response: Detailed technique information
Action: subscribe
Payload:
{
action: "subscribe",
room: string // e.g., "alerts", "fl_status", "predictions"
}Action: unsubscribe
Payload:
{
action: "unsubscribe",
room: string
}alert_created- New alert createdalert_updated- Alert status/data updateddashboard_update- Dashboard statistics updatedfl_round_update- FL round progress updatedprediction_update- New prediction available
File: components/force-directed-graph.tsx
Algorithm: D3.js Force Simulation
- Force Link: Connects nodes with configurable distance (150px)
- Force Charge: Repulsion between nodes (strength: -300)
- Force Center: Centers graph in viewport
- Force Collide: Prevents node overlap (radius: 40px)
Features:
- Interactive drag-and-drop node positioning
- Zoom and pan capabilities
- Real-time physics simulation
- Click handlers for node selection
- Dynamic styling based on node type (current vs predicted)
Implementation Details:
const simulation = d3
.forceSimulation<Node>(nodes)
.force("link", d3.forceLink<Node, Link>(links).id((d) => d.id).distance(150))
.force("charge", d3.forceManyBody().strength(-300))
.force("center", d3.forceCenter(width / 2, height / 2))
.force("collide", d3.forceCollide(40))File: lib/useWebSocket.ts
Algorithm: Auto-reconnection with exponential backoff
- Max Reconnection Attempts: 5 (configurable)
- Reconnection Interval: 3000ms (configurable)
- Connection States: connecting, connected, disconnected, error
Features:
- Automatic reconnection on disconnect
- Message parsing and error handling
- Room-based subscription system
- Graceful degradation to REST API on failure
Implementation:
// Reconnection logic
if (reconnectAttemptsRef.current < maxReconnectAttempts) {
reconnectAttemptsRef.current++
reconnectTimeoutRef.current = setTimeout(() => {
connect()
}, reconnectInterval)
}File: app/alerts/page.tsx
Algorithm: Multi-dimensional filtering with pagination
- Severity Filter: critical, high, medium, low, all
- Facility Filter: Filter by specific facility or all
- Time Range Filter: Configurable time windows
- Full-Text Search: Search across alert titles and descriptions
- Pagination: 10 items per page (configurable)
Features:
- Real-time filter updates
- Debounced search queries
- State synchronization with URL params (potential)
- Automatic page reset on filter change
Files: app/alerts/page.tsx, contexts/WebSocketContext.tsx
Algorithm: Event-driven state updates
- WebSocket Events: Subscribe to specific data rooms
- State Merging: Merge real-time updates with existing data
- Duplicate Prevention: Check for existing items before adding
- Optimistic Updates: Update UI immediately on actions
Implementation:
switch (lastMessage.type) {
case 'alert_created':
setAlerts((prev) => {
if (prev.some((a) => a.id === lastMessage.data.id)) return prev
return [lastMessage.data, ...prev]
})
break
case 'alert_updated':
setAlerts((prev) =>
prev.map((alert) =>
alert.id === lastMessage.data.id ? lastMessage.data : alert
)
)
break
}File: utils/attack-graph-data.ts
Data Structure:
- Nodes: Technique ID, name, type (current/predicted), probability
- Links: Source-target relationships with probability scores
Algorithm: Graph traversal and probability propagation
- Current techniques marked with probability 1.0
- Predicted techniques have probability scores (0.0-1.0)
- Links represent attack progression paths
- Visual encoding: color (red=current, amber=predicted), opacity (probability)
Techniques Tracked:
- T1190: Exploit Public-Facing Application
- T1133: External Remote Services
- T1078: Valid Accounts
- T1059: Command and Scripting Interpreter
- T1486: Data Encrypted for Impact
- T1565: Data Manipulation
Files: utils/mock-data.ts, API client
Metrics Tracked:
- Round Progress: Percentage completion (0-100%)
- Training Phase: distributing, training, aggregating, complete
- Client Status: active, delayed, offline
- Privacy Budget: Epsilon (ε) and Delta (δ) values
- Model Performance: Loss and accuracy per client
Algorithm: Aggregated metrics calculation
- Track individual client progress
- Calculate overall round progress
- Monitor privacy budget consumption
- Track model accuracy improvements across rounds
Multi-Layer Detection System:
- LSTM Model - Deep learning-based anomaly detection
- Isolation Forest - Statistical outlier detection
- Physics Model - Domain-specific rule-based detection
- System Monitor - Infrastructure health monitoring
Correlation Algorithm:
- Multiple sources can detect the same alert
- Confidence scores aggregated across sources
- Evidence collection from each detection layer
- Attack type correlation and naming
app/ # Next.js App Router pages
├── alerts/ # Alert management page
├── attack-graph/ # Attack visualization page
├── fl-status/ # Federated learning status page
└── page.tsx # Dashboard home
components/ # React components (40+ components)
├── ui/ # Radix UI base components
└── *.tsx # Feature-specific components
lib/ # Core libraries
├── api-client.ts # REST API client
├── useWebSocket.ts # WebSocket hook
└── utils.ts # Helper utilities
utils/ # Utility functions
├── attack-graph-data.ts # MITRE ATT&CK data
├── mock-data.ts # Development mock data
└── format-time.ts # Time formatting
contexts/ # React contexts
└── WebSocketContext.tsx # WebSocket provider
hooks/ # Custom React hooks
├── use-mobile.ts # Mobile detection
└── use-toast.ts # Toast notifications
- Real-Time Monitoring - WebSocket-based live updates
- Multi-Layer Security Detection - 4 detection sources
- MITRE ATT&CK Integration - Attack technique visualization
- Federated Learning - Privacy-preserving ML training
- Advanced Filtering - Multi-dimensional alert filtering
- Interactive Visualizations - D3.js force-directed graphs
- Responsive Design - Mobile-friendly UI
- Dark Theme - Cybersecurity-focused design
- Accessibility - ARIA labels and keyboard navigation
- Type Safety - Full TypeScript coverage
- Code Splitting - Next.js automatic code splitting
- Image Optimization - Next.js image component (disabled in config)
- Lazy Loading - Dynamic imports for heavy components
- Memoization - useCallback and useMemo hooks
- Pagination - Efficient data loading (10 items/page)
- WebSocket Fallback - Graceful degradation to REST API
- Environment Variables - API URLs configurable via env vars
- Type Validation - Zod schema validation
- CORS - Backend CORS configuration required
- Input Sanitization - Form validation with React Hook Form
- Error Handling - Comprehensive error boundaries
- Authentication - Not yet implemented (TODO)