Architecture

Route, contract, and projection structure used to keep UI behavior deterministic and auditable.

Owner
Platform + Frontend
Status
Stable contract surface
Last updated
2026-03-15

Key points

  • App routes consume typed API responses sourced from projection helpers.
  • Shared contracts reduce drift between route handlers and page-level assumptions.
  • Dashboard payloads include confidence and recommended actions, not just raw scores.
  • Error handling remains structured for debug traceability in demo conditions.

System view

Next.js PagesAPI Route HandlersProjection LayerContracts + Snapshot

API route matrix

MethodRoutePrimary consumerResponse contract
GET/api/profile/[id]Profile pageProfileResponse
GET/api/fundraisers/[id]Fundraiser pageFundraiserResponse
GET/api/communities/[id]Community pageCommunityResponse
GET/api/dashboard/overviewDashboard KPI gridDashboardOverviewResponse
GET/api/dashboard/fraudFraud explainability cardsDashboardFraudResponse
GET/api/dashboard/alerts/topAlert queueDashboardAlertsResponse

Payload summary

SurfacePayload highlightsLatency targetFailure envelope
Entity pagesIdentity, momentum, integrity signals, and deep-link refs.p75 <= 250msTyped ApiError with request_id.
Dashboard overviewPerformance + engagement + philanthropy KPI cards.p75 <= 250msFallback cards + explicit empty states.
Fraud and alertsBucketed fraud cards, confidence, reasons, recommended_action.p75 <= 250msQueue still renders with partial data.

Risk and mitigation

  • Risk: contract drift. Mitigation: centralized TypeScript interfaces in `contracts`.
  • Risk: hidden coupling. Mitigation: explicit route-to-consumer mapping table.
  • Risk: opaque failures. Mitigation: standardized error shape with `request_id` traceability.