Data Dash is a server-rendered analytics application with two backend-facing responsibilities:
- Aggregate and transform market data for dashboard rendering
- Relay alert payloads to external webhook destinations
Core flow:
- UI requests dashboard data (server-rendered page or
/api/arena). lib/live-analytics.tsfetches market + chart data from CoinGecko.- Domain transformations compute sentiment, signals, heatmaps, and wallet flows.
- If provider calls fail, fallback dataset is returned with
source: "fallback". - UI components render typed dashboard sections from the normalized payload.
- Frontend + API routes run in the same Next.js application.
- No database dependency in current architecture.
- No queue or background worker in current architecture.
app/page.tsx- SSR entry point for dashboard shell
- Fetches initial dashboard data and watchlist
app/api/arena/route.ts- API endpoint for interval/id-filtered analytics snapshots
app/api/alerts/webhook/route.ts- API endpoint for outbound webhook forwarding
lib/live-analytics.ts- Domain and integration layer:
- provider fetches
- series sampling
- derived signal scoring
- fallback orchestration
- Domain and integration layer:
components/dashboard/*- Presentational and container components for dashboard views
- Primary provider: CoinGecko public endpoints
- Strategy:
- Request live data with Next.js revalidation hints
- Fail closed into static fallback payload
- Preserve contract shape regardless of source
This ensures UI continuity and demo reliability under provider degradation.
app/page.tsxexportsrevalidate = 300(5 minutes) for page-level ISR behavior.- Upstream fetches in
lib/live-analytics.tsusenext: { revalidate: 300 }. /api/arenaadds response caching headers:max-age=60s-maxage=60stale-while-revalidate=240
- App-level security headers in
next.config.ts - Webhook URL validation enforces HTTPS scheme
- No inbound authentication layer yet for API routes (explicit risk)
See docs/SECURITY.md for hardening priorities.
- No persistence layer for historical analytics snapshots
- No authn/authz for API consumers
- No formal rate limiting for webhook relay endpoint
- No automated test suite committed yet
- Introduce provider abstraction with retry policy + circuit breaker.
- Add request authentication and per-route rate limits.
- Add structured logs + request IDs for traceability.
- Add integration tests for route contracts and fallback behavior.