Service type
Node.js service
Runtime service for Node.js APIs, workers, and custom application workloads.
This service runs your code: its image is built from a Git repository, and each build is deployed to an app environment.
On this page
Technical profile
Versions, source repository, and Helm chart.
Stacks that use it
Public stacks that include this service.
Source builds and CI/CD
Boilerplates, Git providers, CI, and container registries.
Service configuration
Links to other services.
Services based on it
Catalog services that inherit from this one.
On Wodby
How Node.js runs on Wodby
How the application is started
The image built by the service's Dockerfile starts the application with npm run start, from /usr/src/app. package.json must define a start script.
- The application must listen on port 3000, on all interfaces. That is the port of the service's HTTP endpoint. The service sets
NODE_PORTto that number; it does not setPORT. ReadNODE_PORT, or default to 3000. NODE_ENVisdevelopmentin environments of typedevandproductionin every other type.
Build
The service's Dockerfile only copies the build context to /usr/src/app. It does not run npm install. Dependencies, and any compiled output, must be produced by the pipeline before the image is built, for example with wodby ci run -- npm ci, so that node_modules is part of what is copied. An image built without node_modules cannot load the application's dependencies.
A pipeline that passes a Dockerfile from the repository (wodby ci build node -f Dockerfile) uses that file instead.
The service declares no volume of its own: files written inside the container are lost when it is replaced.
Linked services
Links to other services reach the application as environment variables. Nothing in the image reads them: the application reads them itself. Do not hardcode hosts or credentials.
| Link | Variables |
|---|---|
| Database (MariaDB, MySQL or PostgreSQL) | DB_HOST, DB_PORT, DB_NAME (also DB_DATABASE), DB_USERNAME, DB_PASSWORD, DB_DRIVER (also DB_CONNECTION) |
SMTP_HOST, SMTP_PORT | |
| Redis or Valkey | REDIS_HOST, REDIS_PORT, REDIS_PASSWORD |
| OpenTelemetry Collector | OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL (http/protobuf), OTEL_EXPORTER_OTLP_HEADERS (the Collector's ingest token) |
All links are optional. A variable is present only while its link exists and the linked service is enabled. The mail link carries no credentials. The OpenTelemetry variables are the standard SDK settings: an application or agent that uses an OpenTelemetry SDK exports to the Collector without further configuration; set OTEL_SERVICE_NAME to name the application in traces.
Environment
WODBY_HOSTSis a JSON array of the environment's hosts, not a comma-separated string.WODBY_PRIMARY_HOSTandWODBY_PRIMARY_URLare the canonical ones for links generated outside a request.WODBY_APP_SERVICE_NAMEis this service's host name inside the environment. Other services reach the application at that name on port 3000.WODBY_ENV_TYPEtells a development environment from a production-like one.
In a development workspace
- The checkout is mounted at
/usr/src/appand served as it is on disk. - Workspace setup installs dependencies with
workspace-node prepare. The package manager is taken frompackageManagerinpackage.json, otherwise from the lockfile:pnpm-lock.yamlmeans pnpm,yarn.lockmeans Yarn, anything else npm. Installs follow the lockfile exactly (npm ci,--frozen-lockfile,--immutable), with development dependencies. Run it again after changing dependencies. - The application is started with the
devscript ofpackage.jsonwhen there is one, otherwise withstart.WORKSPACE_NODE_COMMANDon the service replaces that command. NODE_ENVis alwaysdevelopmenthere, whatever the environment type.PORTis set, toNODE_PORTunless given, andHOSTto0.0.0.0.- A saved file is picked up without a restart or a deployment. A
devscript is expected to watch the files itself. Astartscript runs the application once, so the checkout is watched for it: when a file changes, the application is stopped and started again in the same container, within a few seconds.node_modules,.git,.pnpm-store,.next,dist,buildandcoverageare not watched. A command set withWORKSPACE_NODE_COMMANDis run as it is, without that watcher;WORKSPACE_NODE_WATCH=0turns the watcher off. For scripts with their own watcher,CHOKIDAR_USEPOLLING,CHOKIDAR_INTERVALandWATCHPACK_POLLINGare set, because a checkout on network storage needs polling.WORKSPACE_POLL_INTERVALchanges the interval,WORKSPACE_POLLING=0turns this off. node_modules/and/.pnpm-store/are kept out of Git status without touching.gitignore.- A change to variables or linked services still needs a deployment of the environment.
Check the result
curl -s -o /dev/null -w '%{http_code}' "localhost:$NODE_PORT"from the container shows whether the application answers on the expected port.printenv | grep -E '^(DB|SMTP|REDIS)_' | cut -d= -f1lists the link variables that are present.
Overview
Technical profile of Node.js
Stacks
Stacks that include Node.js
CI/CD
Build Node.js from a Git repository
Express.js boilerplate
Use it as it is, or clone it into your own Git account.
wodby/expressjs-boilerplateGit providers
You connect a repository through an integration with its Git provider.
CI providers
Wodby CI is built in: the pipeline is the file .wodby/pipeline.yml in the repository. For a repository you connect, an external CI provider can run the same steps with Wodby CLI.
Container registries
Built images go to Wodby Registry by default, or to an external registry that you connect as an integration.
Environment variables from integrations
A variable integration stores the credentials of a third-party service once. Attach it to Node.js and Wodby passes them to the container as environment variables at runtime, not during the image build.
Configuration
Node.js service configuration
Technical domains
Service links
Each link is a connection from Node.js to another service. A stack sets which service a link points to. The cards list the public services that can satisfy each link.
db
Services that can satisfy this link
sendmail
Services that can satisfy this link
redis
Services that can satisfy this link
otel
Services that can satisfy this link
Based on this service