Setting up a GraphQL Backend without GraphCool

This article is part of a series on building an MVP of a Data-driven cross-platform app with the following stack: React Native, Apollo GraphQL, and on the backend Node JS with Express and a MySQL Database.

GraphCool is great but it kinda traps you. With this simple guide, I want to argue that it's actually not THAT hard to set up your own backend! And after you scale it, it's muuuuuuuch cheaper!

Please note! This is still a work in progress. It were actually just my own notes, so if something is unclear, just contact me.

In this post, you will read how to do the following:

1) Start with a basic server setup, GraphQL, Express, Sequelize, SQLite, Dev mode, Git
2) Explain how I spin it up a 5$ Linode
3) Explain all domain stuff too? But https is necessary for sure! iOS needs it.

1) GraphQL Server locally

  • git init whole project, create git repo, set remote, commit, push
  • code .gitignore server/dist node_modules , client .... 1 git for all
  • folder server
  • yarn init, yarn add -D nodemon, babel-cli, babel-preset-env, eslint, prettier-eslint
  • zorg dat prettier plugin en eslint plugin in VSCode werken en controlleer dit
  • add typescript
  • ./node_modules/.bin/eslint --init with airbnb preset
  • create scripts in package.json - dev: nodemon --exec babel-node --presets=env --plugins=transform-runtime lib - build: babel lib -d dist --presets env - serve pm2 start dist/index.js
  • leg ook uit wat deze commandos precies doen en wanneer je ze gebruikt
  • create index:
    • connectors (sequelize docs)
    • schema, resolvers, server execution (apollo graphql docs)
  • test it with GraphiQL, SQLite, en DB Browser for SQLite

2) Remote server

  • Create secure linode server: reference to other article
  • Git push
  • set up nginx, pm2, git, node, mysql, etc
  • create mysql database with proper name
  • git pull
  • yarn, yarn build, yarn serve
  • test with GraphiQL

1) add name servers of preferred domain pointing to cloudflare (dana&
2) setup CloudFlare DNS
- Point CNAME record www and @ to - Point A record to server IP - Crypto —> Origin certificate, save these values!

3) use any static website project but probably the React Bootstrap App theme that I modified, build it, and upload it using “surge ./build/”

4) setup a server with Ubuntu 16.04 and Nginx that has this in /etc/nginx/sites-enabled/default

server {
listen 80;
listen 443 ssl;

ssl_certificate /ssl/cert.pem;
ssl_certificate_key /ssl/key.key;

accesslog /var/log/nginx/nginx.vhost.access.log;
log /var/log/nginx/nginx.vhost.error.log;

location /yourlocation {
proxy_pass http://localhost:3045/graphql;


5) restart nginx: sudo systemctl restart nginx

6) Make sure the process indeed runs on this location and port using pm2

Todo Extra: Add TypeScript, how? zoek online voor zekerheid: Typescript with node or express server
1) Yarn add -D typescript
2) Yarn add tslib
3) TSconfig.json --> see online
4) figure out how to compile and build and stuff.