Getting started / Tutorial

0. Introduction

Introduction

Welcome to the Nexus tutorial! If you're new to Nexus and want a guided learning journey, this is the place! Through a handful of chapters we're going to be building just enough of a blog to give you an overview of Nexus; what it is and what it can do.

Assumed tools

Throughout this journey, we'll be making a few minor assumptions about your toolchain to keep the content flowing:

  • Using npm as the package manager.
  • Using a *nix OS
  • Using VSCode

If you're using another set of tools, like Yarn on Windows with Sublime Text, that's totally fine and welcome! Just know that at you'll occasionally need to adapt minor instructions to your situation.

Conventions

There's a few conventions used throughout this tutorial that you should know about.

Annotated code blocks

Most Code Blocks are explained with annotations. Take the following for example. Immediately following the codeblock are numbered points. Each corresponds to a line annotated with that number in the code block.

1const a = 1 as const // 1
2
3interface A {} // 2
4interface A {} // 2
5
6const b: any = 1 // 3
  1. Use as const to make TS take the narrowest inference. Here 1 vs number.
  2. Same-named interfaces will merge into one.
  3. Use any to effectively disable type-checking

Auxiliary content

Sometimes content that isn't core to the current flow but related to it will be mentioned. That looks like so:

Hello there, have a nice day!

Copy-pasting

As you progress you'll be writing code, of course. Often you'll have the chance to copy and paste our code, but we strongly suggest if you're just starting out to write the code yourself. This will expose you to experience of writing a Nexus app. Things like autocompletion and letting static safety guide your implementations, e.g. inside a GraphQL resolver. Also if you're new to TypeScript getting used to encountering, understanding, and fixing static type errors is essential practice. That said at no time should you feel frustrated. If things just aren't working, copy-paste our work as needed. Then, once things are working, taking a moment muck around, break things, fix them again, etc. is almost always time well spent.

GitHub Repository

Note that there is a GitHub repository at graphql-nexus/tutorial containing the finished code you will build in this tutorial. You can always check this out if you get stuck during the tutorial.

Wrapping up

Thanks for checking out Nexus, we hope you're as excited to learn about it as we are to show it to you! 🚀

Next →
Edit this page on Github