Create a GraphQL server with Queries, Mutations & Subscriptions

Tom Nagle
The Startup
Published in
7 min readOct 31, 2019

--

In this post, you will learn how to set up a GraphQL server using TypeScript.

If you’re not familiar with TypeScript, keep reading, you will still understand the concepts and most of the syntax.

The post assumes you have yarn and MongoDB set up and running correctly on your machine. It also assumes you have at least a basic level of knowledge of JavaScript.

The guide is broken up into four parts, each part has its own folder in the repository that can be found here: https://github.com/tomanagle/apollo-graphql-server

⭐️Step 1 — Basic Setup

The finished repository for step 1: https://github.com/tomanagle/apollo-graphql-server/tree/master/1-basic-setup

In this step, we will clone a TypeScript starter pack and follow the basic setup guide from the official Apollo documentation.

Add nodemon globally so we can use it to restart the server every time we make a change:

yarn global add nodemon

Clone this TypeScript starter repository to bootstrap the project setup:

git clone https://github.com/tomanagle/typescript-starter.git apollo-graphql-server

--

--

Tom Nagle
The Startup

I am a full stack JavaScript developer, living in Melbourne, Australia. My preferred stack is Mongoose, TypeScript, Node.js, React & GraphQL.