GraphQL BaaS – Backend as a Service

GraphQL BaaS – Backend as a Service
graphql-baas

Creating the next big mobile app is an expensive and time-consuming process. Taking your idea to life demands time, energy, and financial resources. I will explore how new technologies like GraphQL will reduce your time to market and speed up your app development process.

This article will explain the benefits of using GraphQL together with Backend as a Service platform, and here is a summary of what you will learn:

GraphQL Overview

Many of you have heard of GraphQL for some time but have not yet known why you should consider it into your development stack. Maybe it is an excellent choice for your project, up to your app development process.

Shall we understand a little more?

GraphQL started on Facebook, as follows:

  • Displaying a list of posts required access to an API.
  • Each post had to show a list of users who liked it.
  • Each user object had to show a name, profile photo, link to the profile if the user is already your friend, etc.

At least, that’s what we can see when we access Facebook through the browser. But when we’re in the mobile app, we don’t have all this information. We have a list of likes and a link to their profile.

But how to prevent servers from sending unwanted data?

This simple measure will make the mobile apps work faster, save data transfer for mobile users, and save millions of dollars in data transfer out costs to Facebook.

Rather than creating an API for each different data structure, manually making queries for each database, and then gathering the data, Facebook decided to use a different approach. Create a new query language to solve this problem.

This query language is GraphQL and allows developers to specify what they need every time a query is performed.

GraphQL is NOT…

  • GraphQL is not a database.
  • GraphQL is not a substitute for SQL.
  • GraphQL is not a server-side tool.
  • GraphQL is not React specific.

What is GraphQL?

Here is the definition from GraphQL Organization.

GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. GraphQL isn’t tied to any specific database or storage engine and is instead backed by your existing code and data.

Mutations, Queries, and Subscriptions

The GraphQL schema is straightforward and formed with three main types that support distinct sets of actions:

  • Mutations are used to create, update, and delete data
  • The client utilizes queries to request the data from the backend
  • Subscriptions are a way to build and have a real-time relationship with the server

GraphQL vs. REST

An excellent way to understand GraphQL is to say that it is between SOAP and REST, taking pieces from each one. Here is a quick overview of the main differences between GrapQL and REST APIs.

Description GraphQL REST
Endpoint Single Multiple
HTTP Semantics Query, Mutation, Subscription GET, POST, PUT, DELETE
Error Codes Single 200 status codes Multiple status codes
Cacheable No Yes
Stateless Yes Yes
Overfetching No Yes
Underfetching No Yes

Why use GraphQL?

GraphQL solves several problems NOT addressed by REST, including:

  • API versioning
  • Overfetching/Underfetching
  • Slow performance of large mobile apps

Advantages and Disadvantages of GraphQL

All right! Now you understand GraphQL and why Facebook created it, but what are the benefits to your app? Here is a list of how GraphQL will benefit you.

Benefits of GraphQL

  • Reduce data transfer costs, both on the server-side (transfer out) and on the client-side (5G/4G bandwidth).
  • Guarantee faster response times even on slow connections.
  • Faster load times for your mobile app.
  • Simplicity leads to a more stable backend.

Drawbacks of GraphQL

  • Learning curve. You already know REST and will need to learn GraphQL.
  • Caching. It’s harder with GraphQL.
  • Queries always return status code 200.

When to use a GraphQL?

Here are some use cases that you will benefit from using GraphQL.

  • Projects that require to process data quickly.
  • Applications with high data throughput.
  • Projects that need to recover information from multiple databases.
  • Collect data from different stacks.
  • Integration with 3rd party services.
  • Multiplatform implementations (web, mobile, IoT)

Deploying GraphQL with a BaaS

Using a BaaS will provide you with the following benefits:

  • Let you concentrate on your core product without reinventing the wheel.
  • Automation regarding managing databases, running infrastructure, etc.
  • Reduce the total cost of development.

You will put together the advantages of a backend as a service with the flexibility and simplicity GraphQL delivers. This setup allows developers to create their schemas and automatically deploy them on a ready-to-use infrastructure environment.

GraphQL BaaS providers

Here is a list of backend as a services providers that support GraphQL. Some companies will deliver managed GraphQL backend hosting. The others will only provide self-hosting options. Here is the list with GraphQL backend as a service providers:

Back4App

Summary: Easy-to-use, flexible, and scalable backend based on GraphQL and other open-source technologies

Production Ready: Yes

Pricing: Free plan available. Paid plans start at $25/month.

Hosting Options: Cloud hosting with Back4App (shared hosting and private instances) or AWS, Azure, Google Cloud

Parse

Summary: Open-source NodeJS backend framework.

Production Ready: No.

Pricing: Free download only. No support or paid plans are available.

Hosting Options: It can pretty much be deployed in any cloud. Standard options are AWS, Digital Ocean, and Azure.

AWS Amplify

Summary: A declarative JavaScript library for application development using cloud services.

Production Ready: Yes.

Pricing: Pay by the use at AWS. Free download option available.

Hosting Options: It can pretty much be deployed in any cloud. Common options are AWS, Digital Ocean, and Azure.

Hasura

Summary: Instant Realtime GraphQL on Postgres

Production Ready: Yes

Pricing: Free plan available. Paid plans start at $99/month.

Hosting Options: Integrated with Heroku. Deployment is also available at AWS, Azure, and Google Cloud.

Prisma

Summary: This is a database abstraction layer that turns your databases into GraphQL APIs with creating, read, update, and delete procedures and realtime capacities.

Production Ready: Yes

Pricing: Free plans available. Paid plans start at $15/user.

Want to learn more about BaaS platforms? Please read:

BaaS | Backend as a Service

General FAQ

 

What are the BaaS GraphQL providers?

The list includes Back4App, Parse, AWS Amplify, Hasura, Prisma, and others.
 

Why use GraphQL?

Here are some benefits of GraphQL:
– API versioning
– No more Overfetching/Underfetching
– Better performance of large mobile apps

When to use a GraphQL?

– Projects that require to process data quickly.
– Applications with high data throughput.
– Projects that need to recover information from multiple databases.

What are some GraphQL as a service providers?

– Back4app
– Parse
– Hasura
– Prisma


Leave a reply

Your email address will not be published.