A Nestjs application connected to PostgreSQL, running on Zerops with six ready-made environment configurations β from AI agent and remote development to stage and highly-available production.
Lightweight project core
Single dedicated container with balancers (L3/L7), logger and statistics services
After deploying one of the environments and getting to know Zerops, you have two paths forward. 1 Clone our GitHub repositories and use the whole recipe as a template, or if you already have an existing application on a similar stack, 2 integrate the recipe setup with your application.
or
Taking ownership of theenvironment
Small production environment offers a production-ready setup optimized for moderate throughput.
Go to Service Settings > Pipelines & CI/CD Settings in the Zerops Dashboard and connect your repository.
For production, use a trigger on new tags. This keeps deployments intentional and tied to a specific version. You can also add a regex filter, such as ^v[0-9]+\.[0-9]+\.[0-9]+$, if you want to allow only semantic version tags.
Alternatively, add zcli push to your existing CI/CD pipeline if you want full control over when deployments happen.
Pay attention to minFreeRamGB. This value tells Zerops when to scale RAM vertically. Adjust it based on your appβs real memory needs. RAM scales up immediately, while CPU scales after two consecutive measurements below the threshold.
[!TIP]
Run a quick stress test with a tool like hey before real users arrive. This helps you see how your app behaves under load and tune the autoscaling settings.
When changing DNS records for production, start with a low TTL value. Make sure SSL certificates are active before you disable the fallback Zerops subdomain.
Once everything works, you can disable the Zerops subdomain so all traffic goes through your custom domain.
Your application is live in production and the core setup is complete.
The following sections are optional. They cover extra production features such as log forwarding, backups, and diagnostic access. You can stop here and come back later when you need them.
No .env files on Zerops β Zerops injects all environment variables as OS-level env vars. Creating a .env file with empty values will shadow the platform-injected values, causing silent connection failures. Delete any .env file from your deploy.
TypeORM synchronize: true in production β never use synchronize: true in production as it auto-modifies the schema on every startup. Use a separate migration script executed via initCommands with zsc execOnce to ensure safe, one-time schema changes per deploy.
NestJS listens on localhost by default β the app.listen(port) call without an explicit host binds to 127.0.0.1. On Zerops, the L7 balancer routes to the container's VXLAN IP, so you must explicitly pass '0.0.0.0' as the second argument or the container returns 502.
ts-node needs devDependencies β the dev setup uses npx ts-node for migration/seed scripts, which requires TypeScript and ts-node in node_modules. The dev buildCommands uses npm install (not npm ci --omit=dev) specifically for this reason.
Related Recipes
More recipes with similar technologies and categories.
A Node.js application with Express and TypeScript connected to a PostgreSQL database on Zerops, demonstrating idempotent migrations and a health endpoint that proves both connectivity and data integrity.
A Bun application connected to PostgreSQL, running on Zerops with six ready-made environment configurations β from AI agent and remote development to stage and highly-available production.
Go recipe for Zerops β a minimal HTTP server backed by PostgreSQL, showcasing idempotent database migrations, environment-variable-driven configuration, and the complete set of Zerops infrastructure patterns across six ready-to-deploy environment configurations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Small production environment offers a production-ready setup optimized for
# moderate throughput.
# No project-level secrets β NestJS minimal has no encryption or session
# signing that requires a shared key across containers.
project:
name: nestjs-minimal-small-prod
services:
# Small production β minContainers: 2 keeps at least two app containers
# running at all times, spreading load across nodes and maintaining
# availability during rolling deploys when Zerops replaces containers one at a
# time. Vertical autoscaling adjusts RAM within bounds; minFreeRamGB leaves