GraphQL
Overview
The primary protocol for /GET requests between the frontend application and the backend-for-frontend has been selected as GraphQL. It enables the minimization of endpoints on the server side, and in the case of HotChocolate, efficiently leverages database projections to enhance performance.
Code
But that's not all there is to say about GraphQL in StarterKit. HotChocolate automatically generates a GraphQL Schema, which is accessible at /api/graphql?sdl. When you start Vite in dev mode or simply build the application, our built-in scripts begin automatically updating the schema if any changes occur. This allows for code highlighting and auto completion when writing *.graphql files using extensions such as GraphQL: Language Feature Support.
Additionally, it might be somewhat redundant to manually write TypeScript types for every GraphQL request. This issue is addressed by GraphQL CodeGen, which, using *.graphql files with queries and the schema generated by HotChocolate, automatically creates precise types corresponding to variables sent along with the GraphQL query, as well as the returned values in src/redux/gql/graphql.ts.