--- title: "NestJS" --- Prerequisites: - Set up and add envars to [Infisical Cloud](https://app.infisical.com) - [Install the CLI](/cli/overview) ## Initialize Infisical for your [NestJS](https://nestjs.com) app ```bash # move to your Next.js app cd /path/to/project # initialize infisical infisical init ``` ## Modify the start script in your `package.json` ```json ... "scripts": { "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "infisical run -- nest start", "start:dev": "infisical run -- nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json" } ... ``` ## Start your server with environment variables injected ```bash npm run start # or start development server npm run start:dev ```