Member-only story
How to set up a powerful API with GraphQL, Koa, and MongoDB
Building an API is fun!

Building an API is fun! Especially when you can leverage modern technologies such as Koa, GraphQL, and MongoDB.
Koa is a Node framework, just like Express is a Node framework. We’ll replace Express with Koa since Koa uses async/await syntax over callbacks.
Note; If you’re new to APIs, I recommend reading through this book to get up and running. Kindle version here.
Getting started
The prerequisites for building our API are:
- Node installed
- Text Editor (I use Visual Studio Code)
- Terminal
- Browser
If you have everything you need, please proceed — if not, please install them.
Open your terminal and create a node project, like so:

So far we have created our project folder and initialized a fresh Node project. Now we have the NPM packages available which we can use to install Koa, Mongo, and GraphQL.