TypeScript Environment Setup
This setup is suited for Fastify, it can be adjusted for other frameworks.
npm init -ynpm i -D @types/node @tsconfig/node18 nodemon ts-node typescriptnpm i fastify @sinclair/typebox
tsconfig.json:
{ "extends": "@tsconfig/node18/tsconfig.json", "compilerOptions": { "rootDir": "src", "outDir": "dist", }}
package.json scripts:
"scripts": { "start": "nodemon index.ts", "build": "tsc --project ./"}
Or, if the app is not supposed to run continuously:
"scripts": { "start": "ts-node .src/index.ts", "build": "tsc --project ./"}