GraphQL with HotChocolate 16: Projections, DataLoaders, and FederationMixed sources3 sources, drawn from a mix of official docs, project repositories and research.This rates where the sources come from. It doesn't prove every claim.
When GraphQL beats REST and when it does not, HotChocolate 16 on .NET with [UseProjection] + source-generated DataLoaders, persisted operations, cost analysis, Apollo Federation v2 with @key fields.
By Amit UpadhyayPublished Updated 16 minArticle 7 of 8 in API Design
AI assistant · answers from this article
1 of 6
Screens map onto resources
Nothing to add yet
REST caches at the edge and every tool understands it. While screens match resources, it is the simpler choice.
On this page
GraphQL, in one sentence
GraphQL lets a client ask for exactly the data one screen needs in a single request, and moves the work of fetching it efficiently onto the server.
You reach for it when clients, especially mobile apps, need data from several resources in one screen, each in a slightly different shape. Not before: it costs a more complex server, caching that is harder than with REST, and query limits to maintain.
The cheat sheet
What to use when
You do not need all of this on day one. Each row is one signal and the piece that answers it. Stop at the row your system has reached, or pick one to see it in the picture above.
Where you areThe signalWhat to useWhat it costs
None. Each screen needs a resource or two.Nothing. REST endpointsNothing
The order-history screen makes five requests, and downloads twelve fields to use three.A GraphQL schema: the client asks for exactly what it needsStep 1 ↓Harder caching, and a single URL to rate-limit
One GraphQL query triggers four hundred SQL statements.DataLoader: batch the lookups made within a requestStep 3 ↓A loader to write for each relation
A deeply nested query does an enormous amount of work, and apps send 50 KB of query text on every render.Depth and cost limits, and persisted queries for your own appsStep 5 ↓A build step that registers each query
A resolver fails on every request, and every response is still HTTP 200.Measure errors per operation and per resolver, with stable codesErrors behind a 200 ↓Metrics and traces at resolver level
A field must be removed, and nobody knows which apps still read it.Deprecate it, watch field-level usage, then remove itEvolving the schema ↓A schema check to run in CI
Start With REST
If each screen maps onto a resource or two, REST is the simpler choice. It caches at the edge, and every tool understands it. GraphQL earns its place when one screen needs data from several resources, each in a slightly different shape, and the round trips start to show.
GraphQL solves two real problems REST is bad at: over-fetching (mobile downloads 12 fields, uses 3) and under-fetching (one screen needs 5 round trips). The trade is operational complexity — N+1 query risk, harder caching, harder rate limiting. In 2026 the ecosystem has matured around Apollo Federation v2.x for subgraph composition, persisted queries for bandwidth + security, and HotChocolate 16 on .NET (with built-in DataLoader, projection, and federation support).
The right question in 2026 is no longer "REST or GraphQL?" but "where does each fit?" — GraphQL for product/aggregation graphs (BFFs, mobile, partner APIs); REST for resource CRUD, webhooks, and anything cacheable at the edge.
If your screens need many round trips
Your single GraphQL query triggers 400 SQL statements
Clients send 50KB queries on every render
You can't rate-limit because every request hits one URL
Your federated graph composition fails on every deploy
DataLoader for N+1, persisted queries for bandwidth + security, and field-level cost analysis for limits.
Pro deep dive16 min full read
Keep reading with Pro
This is one of our advanced production deep dives. Pro unlocks the rest of it, every other deep dive, and the See, Animate, Test and Build modes on every topic.
What it covers
When GraphQL beats REST and when it does not, HotChocolate 16 on .NET with [UseProjection] + source-generated DataLoaders, persisted operations, cost analysis, Apollo Federation v2 with @key fields.
Level: advanced
6 code samples, 6 machine-checked, none run
3 cited sources
What's inside
02
How GraphQL Works, and What It Costs
03
Building a Production GraphQL Server
04
Errors: Why Your Dashboard Says Everything Is Fine