Implement a GraphQL server in a Route Handler in NextJS that would make use of enhancements to data fetching techniques.
Roadmap
Doable:
Ability to fetch any page with a single getPageBySlug() query rather than specifying all page types (pageCollection, articleCollection, etc) and iterating on what matched. This will enabled a simpler API when used in [[...slug]] type of catch-all routes when a page slug is fully defined by CMS and we don't want to override it or guess it based on prefix in nextjs routing
Ability to tackle page entries as they belong to a single interface, for example there is no easy GraphQL type that covers all pages (for example you can't extract just the slug field on all page types, you actually have to create separate fragments for each). This will allow simple query editing and simplified type definitions.
Ambitious:
Ability to slice-n-stitch queries that exceed Maximum Query Complexity in Contentful. In case a user wants to retrieve too complex of a query, instead of letting client code handle the chunking, place the chunking and stitching on the API layer. For example GraphQL gateway/proxy could read the query complexity based on query AST and recursively split this into subrequests, after waiting on those subrequests to resolve, it can stitch the query back. Additionally, to avoid this being a "surprise" one day and cause too many subrequests or delays, make use of Next Cache (Vercel Cache) and store the stiched response there.
Update: Contentful has added ability to bump query complexity limits via their support channels, so having chunking/stitching in GraphQL becomes less important.
Implement a GraphQL server in a Route Handler in NextJS that would make use of enhancements to data fetching techniques.
Roadmap
Doable:
Ambitious:
Work has been started in graphql-proxy branch