Server code generation 🛠️
Learn how to generate typesafe code for your GraphQL server.
We're using TypeScript here to take full advantage of our type-safe GraphQL schema. But GraphQL and TypeScript are two separate things. So we need a way to connect them.
That's where code generation comes in.
We'll configure a simple tool called graphql-codegen to generate typesafe code for our server.
Codegen is just a way of generating code from one source of truth. In this case, our source of truth is the schema.
With codegen, we can create all of our TypeScript types with a single command.
Check out the codegen docs for more information.