Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GraphQL proxy #5

Open
asgorobets opened this issue Aug 4, 2023 · 0 comments
Open

Implement GraphQL proxy #5

asgorobets opened this issue Aug 4, 2023 · 0 comments
Assignees

Comments

@asgorobets
Copy link
Collaborator

asgorobets commented Aug 4, 2023

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.

Work has been started in graphql-proxy branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants