The Definitive TypeScript GraphQL Stack

The Definitive TypeScript GraphQL Stack

Wassup guys. This post will be short and crisp and will show you the awesome world of TypeGraphQL. So before I explain this tech stack, it is recommended that you know JavaScript, TypeScript and PostgreSQL. Now you don't need to know SQL but should definitely have PostgreSQL installed and know how to use it.

So this stack involves the following tech:

  1. Express.js: Express isn't used much. It is only needed as a server or a base so that your backend works. You won't be dealing with routes or templates in this stack so Express would be minimal.

  2. Apollo Server: This is the main GraphQL server. Apollo Server is used as a middleware so that your GraphQL schemas can work nicely. Apollo Server is nice and useful. Though there are some other GraphQL servers like Prisma as well.

  3. TypeGraphQL: As the name suggests this is the main tech used in this stack. TypeGraphQL allows you to generate GraphQL schemas using decorators meaning that your code will be clean, awesome, readable and much more organized. The TypeGraphQL documentation also has a comprehensive guide which tells you how to implement this stack I'm talking about in code (it will be shared below).

  4. PostgreSQL: Postgres is used as the database because it is free, open sourced, popular and has major support from TypeORM, the ORM we will be using.

  5. TypeORM: TypeORM is a famous TypeScript ORM. This is used to interact with Postgres and because of this we don't need to write SQL queries and run them on our own. Another ORM is MikroORM which you could try and use.

  6. Redis: Redis is not used as a database here but instead as a caching storage. We are caching our auto-generated tokens and instances. This isn't part of the TypeGraphQL guide but is pretty cool when you implement this in your projects.

  7. Nodemailer: Okay this isn't part of the stack but is a pretty useful library when it comes to emailing and authentication. This allows you to send mails when your user signs up or when they forget their password.

The above tech is used in this stack which I (and everyone) call TypeGraphQL Stack. To get started with this stack check out this link. Here you can follow each step in their Docs to create a fullstack GraphQL API backend.

Comment down below whether I should actually use this stack and build a simple application. And don't forget to like and react with a ton of other emojis as well.