You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The REST API serves campaign data well for simple CRUD, but integrators building complex dashboards (e.g. 'give me all active campaigns with their stats and the last 5 audit log entries in one request') suffer from N+1 request patterns. A GraphQL layer enables efficient data fetching for complex queries.
Problem
Frontend must make 3+ round trips to get campaign + stats + audit logs
No subscription mechanism for real-time updates
Third-party integrators building analytics tools cannot query exactly what they need
Acceptance Criteria
Add graphql + graphql-yoga (or apollo-server-express) to backend/package.json
Mount GraphQL at /graphql with GraphiQL explorer (enabled in dev via env flag)
Schema: Campaign, AuditLog, Stats, Config types with all existing REST fields
Summary
The REST API serves campaign data well for simple CRUD, but integrators building complex dashboards (e.g. 'give me all active campaigns with their stats and the last 5 audit log entries in one request') suffer from N+1 request patterns. A GraphQL layer enables efficient data fetching for complex queries.
Problem
Acceptance Criteria
graphql+graphql-yoga(orapollo-server-express) tobackend/package.json/graphqlwithGraphiQLexplorer (enabled in dev via env flag)Campaign,AuditLog,Stats,Configtypes with all existing REST fieldscampaigns(filter, sort, limit, cursor),campaign(id),stats,configcreateCampaign,updateCampaign,deleteCampaign(API key auth)backend/openapi.yaml(note: separate schema at/graphql)References
backend/src/index.jsbackend/src/dal/