Careeroza
Building for Production
Build and Run
Example
npm ci
npm run build
NODE_ENV=production node dist/main.jsExample output
> [email protected] build > nest build [Nest] 1 - LOG [NestFactory] Starting Nest application... [Nest] 1 - LOG [NestApplication] Nest application successfully started +38ms
nest buildcompiles TypeScript todist/(tsc or SWC with"builder": "swc"in nest-cli.json, which is much faster).- Run database migrations as a separate step before starting the new version (
npx prisma migrate deployortypeorm migration:run). - Call
app.enableShutdownHooks()so the app closes DB connections and finishes requests on SIGTERM.