Max Rozen

Setting up your own GraphQL Backend Resolvers

February 11, 2018 • ☕️ 1 min read

If you’re anything like me and spent years working with REST Frameworks, you’ll probably be confused by this crazy GraphQL thing everyone seems to be talking about. Why would you even want to work with a graph database? (Just kidding - GraphQL is not a graph database, for clarity see here)

I’m going to show you how you can use Terraform (see my previous blog to get started with Terraform on a Mac) to setup your own GraphQL server.


  • Your own AWS account with beefy access rights (you’re going to be adding API Gateway, Lambda, Cloudfront, Route53 entries, so you’ll want a pretty decent IAM role for this)
  • A Domain (in the end, you’ll have serving your API)

A GraphQL backend can consist of just a few files:

  • schema.js
  • schema.graphql
  • index.js
  • resolvers.js
  • package.json (optional, in production I would have my dependencies in the client/root project package.json)
  • webpack.config.babel.js

The most complicated part of GraphQL in my opinion is setting up your infrastructure to run.

GraphQL has the potential to be infinitely scalable (bound by whichever data source you put behind it), so we’ll be setting up a Cloudfront CDN in front of an API Gateway, which will point to our Lambda containing our GraphQL function.

TODO: Add Github link to each step/commit with:

  • Setup Cloudfront
  • Setup API Gateway
  • Setup Lambda
  • Setup S3 to temporarily keep our zip file

If this post helped you, I'd really appreciate a share on Twitter.

Max Rozen

Thoughts on the Web.