Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Graphcool, the GraphQL Backend Development Framework

DZone's Guide to

Graphcool, the GraphQL Backend Development Framework

GraphQL allows you to query data in the data-heavy age. It's backed and used by Facebook, but is new and still has tooling gaps. GraphCool aims to solve this.

· Database Zone ·
Free Resource

RavenDB vs MongoDB: Which is Better? This White Paper compares the two leading NoSQL Document Databases on 9 features to find out which is the best solution for your next project.  

GraphQL burst into developer’s public sphere in 2015 and in two short years, the data query language from Facebook that sought to create an alternative to REST APIs gained a massive amount of popularity. My experiments found it promising and interesting, but it was confusing to understand the steps to production and it was lacking in certain tooling.

I had encountered Graphcool around Berlin, as they organize and sponsor the community meetup, and I interviewed their CEO Johannes Schickling about what problem the company intended to solve and how.

A GraphQL Backend Development Framework

Graphcool helps you create and manage a database backend for GraphQL-powered applications, supplying permissions, mapping, subscriptions, a management UI, and a CRUD API for your data. You can use their hosted solution on AWS or self-host using Docker containers.

For example, this GraphQL type definition defines a simple article:

type Post @model {
  id:ID! @isUnique    # read-only(managed by Graphcool)
  createdAt: DateTime! # read-only(managed by Graphcool)
  updatedAt: DateTime! # read-only(managed by Graphcool)

  description:String!
  imageUrl:String!
}

And after a quick graphcool deploy command, Graphcool represents this as:

Your data in the GraphCool backend

Then you can use the Graphcool playground (with the graphcool playground command) to try queries that interact directly with your application and the underlying data.

Get all posts

Create new post

From here, you can use the API endpoints provided and connect applications to it. This means you can switch from endpoint to endpoint, for example, emulating development, staging, and production environments.

Under the hood, Graphcool stores your data in a SQL database. This is AWS Aurora for hosted clusters and MySQL for your own Docker-based installations. Emulating ORM-based frameworks such as Rails and Laravel, Graphcool supports migrations, allowing you to change your GraphQL schema over time. The process is the same as deploying your initial schema, and many of the principles relating to migrations apply, i.e. deleting or changing the field type if they have existing data might be tricky, and consider how this will affect your application.

There are a few other features I’ve not mentioned, so listen to the interview, read the documentation, and see how Graphcool could fit into your next project.

Do you pay to use your database? What if your database paid you? Learn more with RavenDB.

Topics:
graphql ,database ,graph query ,graphcool

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}