Summary
The analytics route at apps/backend/src/routes/analytics.ts currently returns JSON view/click data. Extend it with a CSV export endpoint so card owners can download their analytics data.
Context
Product doc section 5.5 specifies an 'Analytics Dashboard' feature. An export endpoint is a natural next step for power users and aligns with DevCard's privacy-first philosophy (data portability).
Tasks
Acceptance Criteria
Difficulty
medium — involves HTTP file streaming, CSV serialization, and authorization boundary checks.
Summary
The analytics route at
apps/backend/src/routes/analytics.tscurrently returns JSON view/click data. Extend it with a CSV export endpoint so card owners can download their analytics data.Context
Product doc section 5.5 specifies an 'Analytics Dashboard' feature. An export endpoint is a natural next step for power users and aligns with DevCard's privacy-first philosophy (data portability).
Tasks
GET /api/analytics/exportinanalytics.ts— authenticated, owned data only.fast-csvor manual string builder).Content-Type: text/csvandContent-Disposition: attachment; filename=devcard-analytics.csvheaders.Acceptance Criteria
date,platform,event_type,count.Difficulty
medium— involves HTTP file streaming, CSV serialization, and authorization boundary checks.