# Deployment — नेस्टजेएस

Source: https://www.geekswithgeeks.com/hi/nestjs/nestjs-deployment

> NestJS apps को production में deploy करें—build, optimize, और run करें।

## Production के लिए build करें

TypeScript को JavaScript में compile करें; unused code को tree-shake करें।

```bash
npm run build
ls dist/  # compiled JS output
```

## Production में run करें

`NODE_ENV=production` को dist/ folder में point करें; optionally PM2 जैसे process manager का उपयोग करें।

```bash
NODE_ENV=production node dist/main.js

# or with PM2
pm2 start dist/main.js --name "nestjs-app"
```

## Health check endpoint

Load balancers और orchestrators को poll करने के लिए `/health` या `/ping` endpoint जोड़ें।
