Node.js framework NestJS project for performance
If you focus on the performance or features of the module, you can consider using another module as an alternative in NestJS.
In this example, the changed modules are as follows.
- Fastify instead of
Express - MikroORM with @mikro-orm/nestjs instead of
TypeORM - SWC instead of
TypeScript compiler - ESM instead of
CommonJS - Oxlint instead of
ESLint - Oxfmt instead of
Prettier - pnpm instead of
npm
- Create a
.envfile- Rename the .env.sample file to
.envto fix it.
- Rename the .env.sample file to
- Edit env config
- Edit the file in the config/envs folder.
default,development,production,test
# 1. node_modules
pnpm install
# 2. When synchronize database from existing entities
pnpm entity:sync
# 2-1. When import entities from an existing database
pnpm entity:loadpnpm start:devpnpm test # exclude e2e
pnpm test:e2e # only e2e# define NODE_ENV and PORT
pnpm build
# NODE_ENV=production PORT=8000 node dist/app.js
node dist/app.js# https://docs.nestjs.com/openapi/cli-plugin#swc-builder
# Update the metadata before running the swagger server.
pnpm esm bin/generate-metadata.ts
# API, Swagger - src/swagger.ts
pnpm doc:api #> http://localhost:8000/api