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.
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.
BUN_INSTALL: ./.bun for build caching โ Zerops can only cache paths inside the project tree. Default ~/.bun is outside it and gets lost between builds.
Use bunx instead of npx โ npx may not resolve correctly in the Bun runtime.
bun build --target bun only works with pure-JS dependencies โ The prod setup bundles with bun build which inlines all imports. This works for pure-JS packages (e.g. pg) but silently produces broken bundles for native addons (mysql2, bcrypt, sharp, canvas, etc.). The build exits 0 but the bundle fails at runtime or is empty. If your app uses native dependencies, skip bundling: use deployFiles: [./] and start: bun src/index.ts for both dev and prod setups.
Related Recipes
More recipes with similar technologies and categories.
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.
Java Hello World recipe running on Zerops, backed by a PostgreSQL database. Built with Spring Boot, the recipe demonstrates the full Zerops integration pattern: idempotent schema migration, database-backed health check, and ready-made environment configurations spanning the entire development lifecycle.
A Deno 2 application with a PostgreSQL database, ready to deploy on Zerops. Includes six environment configurations โ from AI agent and remote development workspaces through staged and highly-available production setups โ each with a full build and deploy pipeline.
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.
project:
name: bun-hello-world-small-prod
services:
# Production app โ Zerops pulls source from the 'buildFromGit' repo and uses the 'prod'
# zeropsSetup to bundle TypeScript into standalone files (~300 KB artifact, no node_modules).
# minContainers: 2 ensures at least two containers run at all times โ spreading load
# and keeping the service available if one container is replaced during a deploy.
# Zerops autoscales vertically within the bounds set below.