Skip to main content
API Design

API Design: REST vs GraphQL — When to Choose Which

A pragmatic guide to choosing between REST and GraphQL for your API. Covers performance, developer experience, caching, and real-world trade-offs.

Author

Robert Baker

Published

Read time

3 min read

REST and GraphQL are both mature, battle-tested approaches to API design. The right choice depends on your specific use case, team, and constraints.

REST: The Default Choice

REST is simple, well-understood, and works with every HTTP client ever made. For most applications, it’s the right starting point.

REST Strengths

  • Caching is trivial. HTTP caching, CDN caching, browser caching — they all work out of the box with GET requests.
  • Tooling is universal. Every language, every framework, every monitoring tool understands REST.
  • Easy to reason about. One endpoint, one resource, predictable behavior.
// Clean REST endpoint
GET    /api/projects          // List projects
GET    /api/projects/:id      // Get one project
POST   /api/projects          // Create project
PUT    /api/projects/:id      // Update project
DELETE /api/projects/:id      // Delete project

REST Weaknesses

  • Over-fetching. The /api/users endpoint returns everything about a user, even if you only need the name.
  • Under-fetching. Displaying a dashboard might require 5 separate API calls.
  • Versioning overhead. API changes often require /v2/ endpoints or breaking changes.

GraphQL: When You Need Flexibility

GraphQL solves the fetching problem by letting the client specify exactly what data it needs.

GraphQL Strengths

  • Precise data fetching. Request only the fields you need.
  • Single request. Fetch related data across multiple resources in one query.
  • Strongly typed schema. The schema is self-documenting and enables powerful tooling.
# One query, exact data needed
query DashboardData {
  currentUser {
    name
    avatar
  }
  projects(limit: 5) {
    id
    title
    status
    lastActivity
  }
  notifications(unread: true) {
    id
    message
  }
}

GraphQL Weaknesses

  • Caching is hard. No HTTP-level caching for POST-based queries. You need a client-side cache (Apollo, urql).
  • Complexity overhead. Schema definition, resolvers, dataloaders — there’s more code to maintain.
  • N+1 query problem. Without dataloaders, nested queries can hammer your database.
  • File uploads are awkward. GraphQL wasn’t designed for multipart uploads.

Decision Framework

Choose REST When

  • Your API is resource-oriented (CRUD operations)
  • Caching is important for performance
  • Your team is small and wants simplicity
  • You’re building a public API for third-party developers
  • Your clients are diverse (mobile, web, CLI, IoT)

Choose GraphQL When

  • Your frontend needs vary significantly across views
  • You have deeply nested or related data
  • Multiple frontend teams consume the same API
  • You’re building a complex dashboard with many data requirements
  • You want a strongly typed contract between frontend and backend

The Pragmatic Middle Ground

Many successful applications use both:

  • REST for simple CRUD — user management, file uploads, webhooks
  • GraphQL for complex reads — dashboards, search, data exploration

You can also get most of GraphQL’s benefits in REST by supporting sparse fieldsets and compound documents (JSON:API style), or by using tRPC for type-safe APIs without the GraphQL overhead.

Our Take

Start with REST. Move specific endpoints to GraphQL only when the over-fetching or under-fetching pain becomes real. Premature GraphQL adoption is one of the most common sources of unnecessary complexity in modern web applications.

Let’s design your API together →

Topics covered API DesignRESTGraphQLBackendArchitecture
Need dev help?

Get expert development help fast

Our engineering team turns complex ideas into production-ready software tailored to your business.

Book a consult
Next up

Continue leveling up your engineering skills

Dive deeper with related guides chosen to complement this topic and accelerate your next project.

Stay connected

Get engineering insights every week

Subscribe for framework updates, architecture patterns, and deep dives tailored to busy engineering teams.

Subscribe to Our Newsletter

Get tech tips, special offers, and updates delivered to your inbox.