Dashboard Domain
This domain covers the main dashboard page implemented under
frontend/src/pages/dashboard.
1️⃣ Domain Purpose
The Dashboard domain provides a “front door” overview: - shows a small set of KPIs (items, suppliers, low stock) - shows a compact 90-day stock movement chart - provides navigation shortcuts into primary workflows (Inventory, Suppliers, Analytics)
The dashboard is intentionally resilient: partial API failures should degrade to placeholders instead of breaking the page.
2️⃣ Scope & Boundaries
Included: - Page orchestration in Dashboard.tsx
- KPI metrics query via useDashboardMetrics
(analytics hook) - Compact chart block in
blocks/MonthlyMovementMini.tsx - Navigation actions
to domain routes
Excluded: - Full analytics visualizations and filtering — see Analytics domain - API caching/normalization and HTTP client semantics — see Data Access - Global routing/guard behavior — see Routing - Shell layout/chrome — see App Shell
3️⃣ High-Level Diagram
4️⃣ Domain Notes (Implementation-facing)
- KPIs are fetched through a single hook that aggregates backend calls.
- The movement mini-chart reuses the analytics API and uses a fixed 90-day window.
- Dashboard queries use their own query keys (dashboard-scoped) so cache entries don’t collide with analytics views.
5️⃣ Domain Map (Deep-dives)
- KPI metrics (caching + failure tolerance)
- Movement mini chart (90d window + query)
- Navigation shortcuts + help integration
Related ADRs
- ADR-0003: Page model and domain separation
- ADR-0002: API layer abstraction (httpClient + domain modules)
- ADR-0006: Global state with Context modules (Help/Settings)