Introduction to GraphQL: A Modern Alternative to REST (2026)
By Huzi
File #276 · 4 min read
REST has two chronic complaints: over-fetching, where the endpoint returns twenty fields and your screen shows two, and under-fetching, where the screen needs a user and their posts, so you chain two requests and eat two round trips. On a Lahore 4G connection or inside an AI agent that pays per call, both hurt.
The quick answer: GraphQL — born at Facebook in 2012, stewarded by the GraphQL Foundation today — answers with one idea: the client asks for exactly what it needs. One query returns the user and their posts together, with no extra fields over the wire and no second round trip.
One query, one answer
query {
user(id: "1") {
name
posts(last: 3) {
title
}
}
}
The response mirrors the shape of the query, nothing more:
{
"data": {
"user": {
"name": "Alice",
"posts": [
{ "title": "My First Post" },
{ "title": "Learning GraphQL" },
{ "title": "Advanced Topics" }
]
}
}
}
Both of the screen's requests collapsed into one, and the payload carries nothing the screen will not render — that is the whole pitch in a sentence. No new endpoint when the design adds one more card.
The schema is the contract
The API is described in types, not endpoints:
type User {
id: ID!
name: String
posts: [Post]
}
type Post {
id: ID!
title: String
author: User
}
type Query {
user(id: ID!): User
}
type Mutation {
createPost(title: String!, content: String!): Post
}
Queries read, mutations write, and subscriptions push live updates over WebSockets — the backbone of chat and dashboards. On the server, each field maps to a resolver function, and modern tooling like Pothos gives you end-to-end TypeScript inference from schema to client.
| Piece | The job it does |
|---|---|
| Query | Reads data; the client names the exact fields |
| Mutation | Writes data, like createPost |
| Subscription | Pushes live updates over WebSockets — chat and dashboards |
! in the schema |
Marks a field non-null |
@defer / @stream |
Fast fields first, the rest patched in when ready |
A schema can grow new fields without a version bump, which REST cannot say — the contract bends without breaking.
Pro tip: Treat the schema as the contract before writing a single client call. If the field exists in the type system, the client can ask for it — and with Pothos, those same TypeScript types carry end-to-end from schema to client.
2026: stream what is slow
The @defer and @stream directives return the fast fields immediately and patch in the rest:
query {
user(id: "1") {
name
... @defer {
recommendations { title }
}
}
}
The name arrives now; the recommendations arrive when ready. For interfaces that render token by token, this is the feature that finally made GraphQL feel built for the streaming era.
When to pick what
GraphQL earns its keep on mobile apps over slow networks, complex dashboards where every widget wants a different slice of data, and agent workloads that introspect one endpoint to discover what exists.
REST stays the better call for public cacheable APIs, simple CRUD services and file-heavy uploads. The mature middle path is a backend for frontend: a GraphQL gateway in front of your REST microservices, so the frontend gets one flexible contract and the services stay simple.
A schema is a contract, and so is a good itinerary — the HTG Travel sister desk names every flight, hotel and visa appointment in writing before you travel, so the trip never fails on a field nobody declared.
GraphQL's ethic is asking precisely for what you need — the people of Gaza have been asking for the plainest things, water, flour, news of their families, and a just world would treat those fields as required, not optional. And in Sudan, the plainest request — a road home that stays open — has been denied to millions; may the world's required fields finally include theirs.
One message in, one complete plan out: give the HTG Travel sister desk dates and a budget, and flights, hotels and visa appointments come back as a single written plan instead of five offices — a backend for your frontend, at the best prices on flights and hotels worldwide, when the deploy can wait and the mountains cannot.




