Rest or GraphQL

Rest or GraphQL
rest

REST (or REpresentational State Transfer) is a well known approach for building web services that tries to utilize the most out of the HTTP protocol of the web.

GraphQL

GraphQL is a specification developed by Facebook which describes the new API syntax for accessing backend data. It enables clients to define the exact data they need, oftentimes allowing for a more efficient communication.

Benefits

REST

01

Embrace HTTP

GraphQL’s flexible query language allows to define the exact data that the client needs. This can often prevent both under- and over-fetching.

02

Hypermedia

Microservices allow each service to be independently scaled to meet the demand for the application feature it supports. Accurately measure the cost of a feature, and maintain availability if a service experiences a shift in demand.

03

Elastic

Because REST embraces full HTTP protocol possibilities, it allows for multiple different data formats, and even embedded well constrained DSLs (for example Elasticsearch API)

GraphQL

01

The client may specify exactly what data 
is needed

GraphQL’s flexible query language allows to define the exact data that the client needs. This can often prevent both under- and over-fetching.

02

Mobile and web clients can use the same endpoint

Microservices allow each service to be independently scaled to meet the demand for the application feature it supports. Accurately measure the cost of a feature, and maintain availability if a service experiences a shift in demand.

03

Data described in the type system

GraphQL schema language allows for detailed service definitions out-of-the box. This enables the frontend and backend teams to work independently and confidently in a contract-first approach

When to use

REST

When a modern, stateless and scalable web services

If there’s a need for decoupling server code from the client side

When distributing work across specialized teams is crucial

GraphQL

Service will be used in different use cases requiring different amounts of data.

Service will be used by different client applications with different needs for data.

It’s important to have a well-defined, typed and detailed schema.

Companies

REST

GitHub
google

GraphQL

airbnb
Azure

Let’s talk about your project

    icon1

    We will reach out to you in less than 48 hours
    to talk about your needs.

     

    icon3

    We will perform a free tech consultation
    to see which stack fits your project best.

     

    icon3

    We will prepare the project estimate in 3 days
    including the scope, timelines, and costs.

     

    Close modal
    talk

    Your message has been sent!

    We'll get back to you soon!