HEADLESS – Story about REST and GraphQL

For years the default was simple: one big application where the backend (PHP, Java, .NET, Ruby…) generated full HTML pages on the server and sent them to the browser. It was fast to build, easy to deploy, and worked perfectly… until it stopped working.

Everything started cracking around 2013–2016 when three things happened at once:

  • Users began expecting real mobile apps, not just a responsive website.
  • JavaScript frameworks (React, Angular, Vue) exploded and suddenly the frontend became a real, complex application on its own.
  • Companies wanted to publish the same content and functionality on web, iOS, Android, smart TVs, kiosks, chatbots, and watches — all at the same time.

The monolithic model collapsed under that pressure:

  • Changing one line of HTML required a full backend deployment.
  • Mobile teams had to wait for backend developers to expose new API endpoints.
  • Reusing the same server-rendered templates on a native app or a voice device was basically impossible.
  • Development speed slowed to a crawl because two completely different disciplines (server-side rendering vs modern frontend) were chained together.

So the industry did the obvious thing: cut the rope.

Separate the “content and business logic” (backend) from the “experience and presentation” (frontend). Let the backend become a pure data service (headless) and give every channel its own specialized frontend.


Now ask yourself:

  • Why should a mobile app wait weeks for a new API field when the data already exists in the database?
  • Why deploy the entire monolith just to change a button color?
  • Why force React Native, SwiftUI, and a kiosk screen to consume the same HTML meant for Chrome?
  • Why keep backend and frontend teams blocking each other when they could move independently?

Once you answer those questions honestly, the old monolith doesn’t stand a chance.

The split isn’t a trend — it’s the only logical way forward.

“You would not want your food preparation and food serving in the same place […] In the same way it would make sense to have separation of front and backend.”

Mofi Rahman (software engineer, Medium, 2017)

Headless Architecture Explained: From REST to BFF and Why GraphQL Wins in 2025

1. What “Headless” Really Means

A headless architecture completely decouples the backend (business logic, data, APIs) from the frontend (the presentation layer the user actually sees and touches).

  • The backend is “headless” – it has no built-in UI and doesn’t know anything about HTML, CSS, or layouts.
  • It only exposes data through APIs (almost always JSON).
  • The frontend is a completely separate application – it can be a React/Vue/Next.js web app, a native iOS/Android app, a smart TV interface, a kiosk, a watch app, a voice skill, etc.

Why has headless become the default choice for modern projects?

  • One backend, many frontends (omnichannel made real)
  • Frontend and backend teams can work independently and choose their own stacks
  • Total freedom: React, Vue, Svelte, Angular, Flutter, SwiftUI – whatever fits best

2. The Classic Pain Point: A Product Page in E-commerce

Imagine a typical product detail page. To render it properly, the frontend needs all of these at the following at the same time:

  • product details & description
  • pricing, discounts, stock
  • customer reviews
  • related/recommended products
  • category tree and breadcrumbs
  • cart summary (if the user is logged in)

In a classic REST setup this usually means 6–10 separate HTTP requests:

GET /api/products/42
GET /api/products/42/reviews
GET /api/products/42/related
GET /api/products/42/categories
GET /api/cart
GET /api/user
...

Result → request waterfall, higher latency, content flashing, poor Core Web Vitals.

3. REST in Monolith vs Headless World

Traditional MonolithHeadless + REST
RenderingBackend renders HTML (Twig, Razor…)Backend returns raw JSON
Role of RESTOften secondaryThe only way to get data
Who decides response shape?BackendBackend (often over- or under-fetching)

REST works perfectly fine in a monolith, but in a headless world its limitations become painful very quickly.

4. First Aid: Backend for Frontend (BFF)

The most popular workaround between ~2016 and 2022.

A BFF is a thin aggregation layer (often one per platform) that sits between your frontend and the core backend services.

Example endpoint:

GET /bff/web/product-page/42

It returns one big, perfectly-shaped payload containing everything the specific screen needs.

Pros:

  • Only one round-trip from the browser/app
  • Lower latency
  • Much cleaner frontend code

Cons:

  • You end up writing and maintaining separate BFFs (or separate endpoints) for web, mobile, TV, kiosk…
  • Logic gets duplicated across platforms
  • Every new screen or platform = more backend work

BFF solves the immediate performance problem, but it doesn’t scale well in a true multi-channel world.

5. The Real Game-Changer: GraphQL

GraphQL was created at Facebook for exactly the problems we just described.

Key differences that change everything:

FeatureClassic RESTGraphQL
Who decides the shape of data?BackendFrontend (the client)
Requests per screenManyUsually one
Over-/under-fetchingVery commonVirtually eliminated
Single endpointNoYes – usually just /graphql
Adding new fields/viewsRequires new backend endpointJust change the query (99 % of cases)

Real-world example – the same product page in GraphQL

graphql

GraphQL
query GetProductPage($id: ID!) {
  product(id: $id) {
    id
    name
    price
    currency
    inStock
    images
    description
    reviews(first: 10, sort: NEWEST) {
      rating
      author
      text
      date
    }
    relatedProducts {
      id
      name
      price
      thumbnail
    }
    categories {
      id
      name
      slug
    }
  }

  currentUser {
    cart {
      itemCount
      total
    }
  }
}

The server executes all resolvers (often in parallel) and returns exactly what was asked for – no more, no less.

Why GraphQL feels like “getting everything at once”

  • The client explicitly declares every field and every relationship it needs
  • One query can span multiple domains (products + reviews + recommendations + cart + user profile)
  • No more “please create a new endpoint” tickets – frontend teams become autonomous
  • The same endpoint powers web, mobile, watch, voice, kiosk – each client just asks for what it actually needs

Summary – Why GraphQL Dominates New Headless Projects in 2025

Problem with classic RESTHow GraphQL fixes it
Too many round-tripsSingle request
Over-fetching & under-fetchingYou get exactly the data you asked for
New screen = new backend endpointNew screen = new query (no backend changes needed)
Tight coupling between teamsFrontend gains full control over the data contract

GraphQL isn’t magic. It’s simply a much smarter contract between frontend and backend that puts the power where it belongs in a headless world – in the hands of the client.

If you’re starting a new headless project today (e-commerce platform, content site, SaaS product, omnichannel experience), GraphQL is no longer just “a nice alternative” – it’s usually the most reasonable default choice.

Leave a Reply

Your email address will not be published. Required fields are marked *