# Deployment — NestJS: Scalable Node.js APIs बनाना

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

> NODE_ENV, process manager और health-check endpoints के साथ production में NestJS app build, configure और run करें।

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

Nest build से TypeScript को JavaScript में compile करें; output `dist/` में जाता है। अंतिम image में केवल production dependencies install करें।

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

## Production में run करें

`NODE_ENV=production` सेट करें और compiled `dist/main.js` चलाएँ; वैकल्पिक रूप से 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 जोड़ें।
