Dashboard/Analytics System
System design for real-time dashboard with charts and widgets
Design a real-time dashboard with charts, widgets, customizable layout, and data visualization.
R - Requirements
Key Questions:
- How many widgets? (5, 10, 20+)
- Real-time updates? (yes, live data)
- Update frequency? (1s, 5s, 30s)
- Customizable layout? (drag & drop)
- Export data? (CSV, PDF)
- Time range filters? (last hour, day, week, month)
Common Answers:
- 10-20 widgets
- Real-time updates (5-30s)
- Drag & drop layout
- Multiple chart types
A - Architecture
Dashboard Data Flow:
Widget Lifecycle:
Architecture Decisions:
- Widget-based architecture (independent components) - Each widget loads independently
- Real-time data (WebSocket/SSE for live updates) - Live metrics, 5-30s updates
- Drag & drop (react-dnd, dnd-kit) - Customizable layout, persist preferences
- Code splitting (lazy load widgets) - Only load widgets user sees
Relevant Content:
- Real-Time Architecture - WebSocket/SSE
- Code Splitting - Widget splitting
- Plugin Architecture - Extensible widgets
D - Data Model
State Management:
- Widget data (time-series, aggregated)
- Filter state (time range, filters)
- Layout state (widget positions, sizes)
- Real-time subscriptions (per widget)
Caching:
- Data aggregation (cache computed metrics)
- Time-series data (cache recent data)
- Layout persistence (localStorage)
Relevant Content:
- Data Fetching Strategies - Real-time, caching
- Persistence Strategies - Layout storage
- Polling and Real-Time Sync - Updates
I - Interface
Features:
- Chart components (line, bar, pie, area)
- Filter controls (time range, dimensions)
- Widget grid (drag & drop)
- Loading states (skeleton, spinners)
- Empty states
- Error states
- Responsive grid
Accessibility:
- Keyboard navigation
- Screen reader support (chart descriptions)
- High contrast mode
- Focus management
Relevant Content:
- Accessibility Patterns - Chart accessibility
- Design Systems - Component consistency
O - Optimizations
Performance:
- Chart rendering (canvas vs SVG, optimize for data size)
- Data pagination (for large time-series)
- Real-time throttling (don't update on every data point)
- Code splitting (lazy load widgets)
- WebSocket connection management (pool, reconnect)
Visual:
- Animation performance (60fps chart updates)
- Paint optimization (reduce repaints)
Relevant Content:
- Animation Performance - Smooth updates
- WebSocket Management - Connection handling
- Code Splitting - Widget splitting
- Paint Optimization - Reduce paint
Implementation Checklist
- Widget-based architecture
- Real-time data (WebSocket/SSE)
- Drag & drop layout
- Chart components (multiple types)
- Time range filters
- Data pagination
- Layout persistence
- Code splitting (lazy load widgets)
- Real-time throttling
- Accessibility (keyboard, screen readers)
Common Pitfalls
❌ Updating on every data point → Performance issues
✅ Throttle updates (5-30s), batch multiple updates
❌ Rendering all data → Slow, memory issues
✅ Paginate time-series, aggregate for charts
❌ No code splitting → Large bundle, slow load
✅ Lazy load widgets, split by widget type
❌ Poor WebSocket management → Connection issues
✅ Connection pooling, reconnect logic, error handling