gql tagged template literal for query definition.
Query Structure
GraphQL queries are written using thegql tag from graphql-tag:
Using Fragments
Fragments are defined on components and reused across queries to ensure consistency and avoid duplication.Defining Fragments
Components can define fragments as static properties:Composing Fragments in Queries
Fragments are composed into queries using template literal interpolation:src/pages/anime/[animeSlug]/index.tsx:196-207
The fetchData Function
ThefetchData function is the primary method for executing GraphQL queries on the server.
Server-Side Usage
src/pages/index.tsx:226-243
How It Works
ThefetchData function is built using buildFetchData from @/lib/common:
src/lib/server/index.ts:15
Return Value
The function returns an object with:data: The query result dataapiRequests: Number of API requests made (for performance tracking)
src/lib/common/index.ts:6-9
Real Query Examples
Anime Detail Query
src/pages/anime/[animeSlug]/index.tsx:196-207
Artist Detail Query
src/pages/artist/[artistSlug]/index.tsx:530-541
List Query for Static Paths
src/pages/anime/[animeSlug]/index.tsx:231-239