Skip to main content

ADR-130: Business Intelligence Dashboard Architecture

Status

ACCEPTED - 2026-01-28

Context

CODITECT needs a comprehensive business intelligence solution to:

  1. Visualize Project Progress - Track status across 14+ tracks with drill-down capability
  2. Monitor Resource Allocation - Identify agent bottlenecks and workload distribution
  3. Analyze Token Economics - Cost attribution, usage trends, budget tracking
  4. Generate Reports - Export analytics as Markdown/PDF for stakeholders
  5. Enable Local-First Operation - Work offline with local databases

Requirements

RequirementPriorityRationale
Real-time track progress visualizationP0Core project management need
Token economics dashboardP0Cost control and billing prep
Resource allocation viewP1Capacity planning
Export to Markdown/PDFP1Stakeholder communication
Local-first architectureP0Offline capability, privacy
Browser-based UIP0Cross-platform accessibility
Auto-launch capabilityP1Developer experience

Constraints

  1. Must integrate with existing four-tier database architecture (ADR-118)
  2. Must leverage existing component-viewer infrastructure
  3. Must support offline operation with local SQLite databases
  4. Must provide immediate value with mock data when databases unavailable

Decision

Implement a local React-based BI dashboard using the following architecture:

Technology Stack

LayerTechnologyRationale
FrontendReact 18 + Vite 6Matches component-viewer, fast HMR
StylingTailwind CSS 3.4Consistent with existing tools
ChartsRechartsReact-native, lightweight
IconsLucide ReactConsistent with component-viewer
CLINode.js ESMAuto-launch, browser open
DataSQLite (existing DBs)Local-first, existing infrastructure

Architecture Diagram

┌─────────────────────────────────────────────────────────────────┐
│ /bi Command │
│ │ │
│ ▼ │
│ ┌──────────────────┐ │
│ │ CLI (cli.js) │ │
│ │ • Port config │ │
│ │ • Browser launch │ │
│ │ • Data paths │ │
│ └─────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Vite Development Server │ │
│ │ (localhost:5174) │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ React Application │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Overview │ │ Tracks │ │ Resources │ │ │
│ │ │ View │ │ View │ │ View │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Analytics │ │ Export │ │ Config │ │ │
│ │ │ View │ │ Module │ │ Panel │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Data Service Layer │ │
│ │ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ API Client │ │ Mock Data │ │ │
│ │ │ (when avail) │ │ (fallback) │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ sessions.db │ │ org.db │ │ platform.db │ │
│ │ (Tier 3) │ │ (Tier 2) │ │ (Tier 1) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ TRACK Files │ │
│ │ (Tier 0) │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Data Flow

TRACK Files (MD) ──parse──▶ Track Progress Data
sessions.db ──query──▶ Token Economics
org.db ──query──▶ Decisions, Learnings
platform.db ──query──▶ Component Stats


┌──────────────────┐
│ Data Service │
│ (dataService.js)│
└────────┬─────────┘


┌──────────────────┐
│ React App State │
│ (useState) │
└────────┬─────────┘

┌───────────┼───────────┐
▼ ▼ ▼
Overview Tracks View Analytics
│ │ │
▼ ▼ ▼
┌─────────────────────────────────┐
│ Export Module │
│ • Markdown generation │
│ • JSON export │
│ • PDF (via browser print) │
└─────────────────────────────────┘

View Components

ViewPurposeData Source
OverviewExecutive KPIs, summaryAll sources
TracksTrack-by-track progressTRACK files
ResourcesAgent allocation, workloadTrack assignments
AnalyticsToken economics, trendssessions.db

Export Capabilities

FormatMethodUse Case
MarkdownexportAsMarkdown()Documentation, session logs
JSONexportAsJSON()Data exchange, API integration
PDFBrowser print dialogStakeholder reports

Alternatives Considered

1. Server-Side Dashboard (Python Flask)

Pros:

  • Direct SQLite access
  • No frontend build step

Cons:

  • Additional runtime dependency
  • Slower iteration cycle
  • Less interactive UI

Decision: Rejected - Frontend-focused approach matches existing tools

2. Static Site Generator

Pros:

  • No server required
  • Easy deployment

Cons:

  • No real-time updates
  • Limited interactivity
  • Requires rebuild for data changes

Decision: Rejected - Need real-time data refresh

3. Electron App

Pros:

  • Native app experience
  • Direct SQLite access

Cons:

  • Large binary size
  • More complex distribution
  • Overkill for local dashboard

Decision: Rejected - Browser-based approach simpler

4. VS Code Extension

Pros:

  • Integrated with development workflow
  • Rich UI capabilities

Cons:

  • Limited to VS Code users
  • Complex development model
  • Different from existing patterns

Decision: Rejected - Browser approach more universal

Consequences

Positive

  1. Consistent Architecture - Matches component-viewer patterns
  2. Fast Development - Vite HMR enables rapid iteration
  3. Offline Capable - Local databases, mock data fallback
  4. Export Ready - Built-in Markdown/JSON export
  5. Extensible - Easy to add new views and data sources

Negative

  1. Browser Dependency - Requires modern browser
  2. No Real Backend - Limited to local data (acceptable for local-first)
  3. Mock Data Gap - Initial version uses mock data

Neutral

  1. Port Usage - Uses port 5174 (configurable)
  2. NPM Dependencies - Requires npm install on first run

Implementation

Phase 1: Foundation (J.17.1) ✅

  • Create tool directory structure
  • Set up package.json with dependencies
  • Create CLI for server launch
  • Implement Vite configuration
  • Create basic React app shell
  • Implement overview dashboard

Phase 2: Data Integration (J.17.2)

  • Create data service layer
  • Implement TRACK file parser
  • Connect to sessions.db queries
  • Implement real-time refresh

Phase 3: Export & Reports (J.17.3)

  • Markdown export function
  • JSON export function
  • Print-friendly CSS for PDF
  • Scheduled report generation

Phase 4: Advanced Features (J.17.4)

  • Historical trend charts (Recharts)
  • Drill-down to individual tasks
  • Custom date range selection
  • Comparison views (week-over-week)
ADRRelationship
ADR-118Four-tier database architecture (data source)
ADR-116Track-based plan architecture (track data)
ADR-054Track nomenclature (task IDs)
ADR-089Component database separation (platform.db)

References


Author: senior-architect Reviewers: frontend-react-typescript-expert Approved: 2026-01-28