> For the complete documentation index, see [llms.txt](https://docs.hostinger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hostinger.com/node.js/overview-1/nest.md).

# NestJS

Run NestJS apps in server mode on Hostinger Node.js hosting, with nest build script, dist output, main.ts PORT binding, and static file serving notes.

Progressive TypeScript framework built on top of Express (or Fastify). Opinionated, uses decorators and dependency injection. Hostinger runs Nest apps in server mode.

**`app_type`:** `nest`

## Server mode

NestJS is server-only.

### `package.json`

```json
{
  "scripts": {
    "build": "nest build",
    "start": "nest start",
    "start:prod": "node dist/main"
  },
  "dependencies": {
    "@nestjs/core": "^10.0.0",
    "@nestjs/common": "^10.0.0",
    "@nestjs/platform-express": "^10.0.0"
  }
}
```

### `src/main.ts`

Make sure your bootstrap listens on `process.env.PORT`:

```ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
```

### hPanel settings

| Field            | Value          |
| ---------------- | -------------- |
| Application type | `nest`         |
| Build script     | `build`        |
| Output directory | `dist`         |
| Entry file       | `dist/main.js` |

## Static mode

Not applicable. Nest can serve static files via `ServeStaticModule`:

```ts
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';

@Module({
  imports: [
    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'public'),
    }),
  ],
})
export class AppModule {}
```

## Notes

* **Bind to `process.env.PORT`.** Don't hardcode a port number.
* For Fastify as the underlying HTTP adapter, use [Fastify](/node.js/overview-1/fastify.md)'s notes too — switch via `NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter())`.
* TypeScript config (`tsconfig.json`) should emit to `dist/` to match the entry file path.

***

*Last updated: July 21, 2026*
