Skip to main content
ProductsDesktop toolsTASTECADDrawing reviewTASTEFILESFile managementTASTEFTPFile transferTASTESSHRemote workspaceTASTEZIPCompression and extractionTASTEWINMFile managementDeveloper toolsTASTECODERust integrated development environmentTASTESTUDIOIntegrated development and test environmentTASTEETLData integration (ETL)ServersTASTEREMOTERemote desktop serverTASTEGEOGeospatial serverTASTEMAILMail workspaceInvestingTASTESTOCKStock auto-trading desktop appGet startedDownloadsDocumentationBuyAll products
Marketplace
News
TechNewsToday's dev newsDeveloper docsProgramming languagesRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp & desktop frameworksTauriFlutterReact NativeElectronAlgorithmsAlgorithm basicsCore algorithmsAdvanced algorithmsPractical algorithms
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcaseCommunity guide
Work with usTech transferWebsite buildDesktop app buildRelease and payment pipelineSales partnerContact
ServicesRemote desktopCustom installer packages
TASTEDEV
Products

Desktop tools

TASTECADComplex drawings, opened with easeTASTEFILESJust the files you need, as fast as possibleTASTEFTPThe tidiest path for your filesTASTESSHA stronger link between you and your serversTASTEZIPPack faster, unpack saferTASTEWINMA keyboard-first file manager with two panes

Developer tools

TASTECODEEdit, build, debug and test Rust apps in one windowTASTESTUDIOFrom editing to remote tests and approved AI fixesTASTEETLMove data while you watch the values

Servers

TASTEREMOTEA remote desktop you run on your own serverTASTEGEORebuilding a GeoServer-compatible geospatial server in RustTASTEMAILTake back control of your email

Investing

TASTESTOCKStock auto-trading that follows the rules you set: when, and what

Get started

DownloadsLatest builds of every productDocsHow to use each productBuySubscriptions and perpetual licencesAll productsEvery product at a glance
All products
MarketplaceNews
Tech

News

Today's dev newsOfficial announcements on languages, frameworks, GitHub and AIDeveloper docsGuides to languages, frameworks and algorithms

Programming languages

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web front-end frameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server frameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App & desktop frameworksTauriFlutterReact NativeElectron

Algorithms

Algorithm basicsComplexity analysis · Sorting · Searching · Basic data structures · Trees and heapsCore algorithmsGraph traversal · Shortest paths & minimum spanning trees · Dynamic programming · Greedy algorithms · Divide and conquer · BacktrackingAdvanced algorithmsString algorithms · Math and number theory · Bit manipulation · Segment trees · Union-findPractical algorithmsCoding interview strategy · LRU cache · Rate limiting · Consistent hashing
All development docs
Community
ProjectsDiscover builders and their workDevelopment logsDecisions and lessons learnedPromptsReusable instructionsAI tool issuesProblems and workarounds for Claude, Codex, GeminiShowcaseFinished resultsCommunity guideHow we build in the open
Work with us
Tech transferNative apps in Rust and eguiWebsite build10 languages, accounts, docs and downloadsDesktop app buildRust and egui, no WebViewRelease and payment pipelineSigning, MSI, deb, rpm, AppImage, hashesSales partnerRecommend us and earn 30%ContactBuilds, partnerships and investment
Services
Remote desktopReach your computer from a browserCustom installer packagesOnly the features you need, settings preloaded
Buy
EN
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Log in
Log in
TASTEDEV

From small tools to better development.

support@tastedev.netSupport TASTEDEV
ProductsProduct lineupBuyDocsDownloadsMarketplaceSupport
CommunityProjectsDevelopment logsPromptsAI tool issuesShowcase
PoliciesAbout usPrivacy policyTerms of serviceSubscription termsRefund policyCommunity guidelines
AccountLog inSign up
Visitors
Today
Yesterday
Total views
Company
GXSOFT
Representative
CHOI YOUNG GU
Business registration number
853-44-00368
Address
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Phone
+82-10-4404-1523
Email
whitecalvin@tastedev.net
Privacy officer
CHOI YOUNG GU

© 2026 TASTEDEVProduct information is based on verified development sources.Released · improving

NestJS · Express docs
NestJS · Express
Getting Started with NestJS and ExpressProject StructureCore ConceptsValidation, Configuration and DatabasesTestingDeployment
Discussions

NestJS · Express guide · 6/6

Deployment

A Nest application is an ordinary Node.js server: you compile TypeScript to JavaScript and run dist/main.js with Node. This chapter covers production builds, environment configuration, and deploying with a process manager or containers. Express apps deploy the same way.

Production build

npm run build runs nest build, compiling src into dist. The output runs on plain Node.js without the Nest CLI.

npm ci
npm run build
NODE_ENV=production node dist/main
# or the generated script
npm run start:prod

Production servers do not need dev dependencies: remove them after building with npm prune --omit=dev, or install with npm ci --omit=dev. Avoid running production with ts-node or nest start. An Express app without a compile step simply runs as node src/server.js.

Production configuration

Keep configuration out of code and pass it as environment variables: the port via PORT, database URLs and secrets via your platform's secret store or environment settings. Never bake a .env file into an image or repository. A production main.ts typically adds the following.

// src/main.ts
import { ValidationPipe } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import helmet from "helmet";
import { AppModule } from "./app.module";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(helmet()); // security-related HTTP headers
  app.enableCors({ origin: process.env.CORS_ORIGIN });
  app.useGlobalPipes(new ValidationPipe({ whitelist: true }));
  app.enableShutdownHooks(); // clean up on SIGTERM
  await app.listen(process.env.PORT ?? 3000, "0.0.0.0");
}
bootstrap();

helmet (installed with npm i helmet) is Express middleware, and Nest uses it as is through app.use(). With enableShutdownHooks(), lifecycle hooks such as onModuleDestroy run when the container sends a termination signal, so database connections close cleanly. Behind a reverse proxy, enable Express's trust proxy setting to read the real client IP and protocol; in Nest, create the app with NestFactory.create<NestExpressApplication>() and call app.set("trust proxy", 1).

Running under a process manager

On a VM or bare server, you need something that restarts the process if it dies. PM2 is a popular Node.js process manager and can run one process per CPU core in cluster mode.

npm i -g pm2
pm2 start dist/main.js --name api -i max
pm2 logs api
pm2 save      # remember the current process list
pm2 startup   # start automatically after a reboot

A systemd service running node dist/main.js is another common choice. Put a reverse proxy such as Nginx in front to handle TLS and static files.

Deploying with containers

Containers let the same image run anywhere. A multi-stage Dockerfile separates the build from the runtime and keeps the image small.

FROM node:lts-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev

FROM node:lts-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/package*.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
USER node
EXPOSE 3000
CMD ["node", "dist/main.js"]

List node_modules, dist, .env and .git in .dockerignore to keep the build context small and secrets out of the image. Inside a container, run node directly rather than PM2, and leave restarts and replicas to Docker, Kubernetes or your cloud's container service.

docker build -t my-api .
docker run -p 3000:3000 -e DATABASE_URL="postgres://user:pass@db:5432/app" my-api

Pre-deployment checklist

  1. Make sure npm run build and the test suites pass in CI.
  2. Validate required environment variables at startup, for example with the validate option of ConfigModule.forRoot.
  3. Run database migrations as part of the release and keep synchronize off.
  4. Expose a health check endpoint for load balancers and orchestrators (Nest offers @nestjs/terminus).
  5. Log to standard output and let the platform collect the logs.

Summary

  • Build dist with npm run build, run it with node dist/main, and ship only production dependencies.
  • Supply configuration through environment variables and add production settings such as Helmet, CORS and shutdown hooks in main.ts.
  • Use PM2 or systemd on servers, and a multi-stage Dockerfile for containers.
  • Express apps follow the same principles: environment variables, process management and containers.

Official documentation

  • NestJS Documentation
  • NestJS First steps
  • Nest CLI
  • NestJS Deployment
  • Express
  • Express production best practices
Questions about this chapter?
Previous chapterTesting

0 comments

Top commentsNewest first

Sign in · Sign in to leave a comment.