Build a Node.js Server With Fastify and TypeScript
If you’re setting up a Node.js server, your main options are mostly the built-in http module delivered by Node.js itself or the minimal Express framework. However, there’s a third option you can choose from — Fastify. Fastify is a very actively maintained project for setting up a web server. What makes Fastify shine compared to other options is its highly performant framework being able to handle up to 30,000 requests per second! You can check out the benchmarks to get a better idea of the possible traffic load. To sweeten the deal even more, Fastify supports TypeScript and logging right out of the box. So let’s get started with this web framework and see how we can set up a simple project with Fastify.
Get Started
Instration
$ npm i
Build
$ npm run build
Start Server
$ npm run start
DB migrate
$ npm run migrate:dev
Generate Schema
$ npm run generate