Self-host Node.js API + PostgreSQL with Levelrail
A minimal Node HTTP service wired to a Postgres database, the most common backend pairing.
- Memory256 MiB
- Archarm64
- Services2
How to self-host Node.js API + PostgreSQL
-
Pull the images
2 images are pulled on your server.
Show images
postgres:16-alpinenode:22-alpine
-
Create the app
2 services start in a single Compose app, with 1 named volume mount for your data, on port 3000.
-
Fill in the secrets
2 secrets are generated and stored encrypted, 3 settings are preset, you do not have to fill in anything.
-
Open it
Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.
Node.js API + PostgreSQL requirements
- Memory
- About 256 MiB
- Architectures
- amd64 image published, arm64 image published
- Ports
- 3000
- Domain
- Optional, an sslip.io address is used without one
- Settings
- none to fill in
- License
- not yet recorded
- Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.
- Host ports. It publishes port 3000 on the host, so open them in the VPS firewall only if you want that.
Install Levelrail first
On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then Node.js API + PostgreSQL. New to Levelrail? Install it on a fresh VPS first.
docker pull ghcr.io/glincker/levelrail:latest Then levelrail-cli login --device. See Getting started and the Node.js API + PostgreSQL docs page.
Deploy Node.js API + PostgreSQL your way
Every format below deploys the same pinned images. Pick the one that fits how you work.
Deploy Node.js API + PostgreSQL from the CLI
levelrail-cli templates deploy node-postgres-starter --name my-node-postgres-starter Deploy Node.js API + PostgreSQL with the API
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://levelrail.example.com/api/v1/service-templates/node-postgres-starter/deploy Node.js API + PostgreSQL configuration
Node.js API + PostgreSQL services
| Service | Image | Ports | Volumes |
|---|---|---|---|
| db | postgres:16-alpine | none | node_postgres_db_data -> /var/lib/postgresql/data |
| web | node:22-alpine | 3000 | none |
Node.js API + PostgreSQL environment variables
| Variable | Service | Value |
|---|---|---|
| POSTGRES_DB | db | Preset by the template |
| POSTGRES_PASSWORD | db | Generated at deploy |
| POSTGRES_USER | db | Preset by the template |
| DATABASE_URL | web | Generated at deploy |
| NODE_ENV | web | Preset by the template |
Ports and volumes
- Ports
- 3000
- Volumes
- 1 named mount: node_postgres_db_data -> /var/lib/postgresql/data
Node.js API + PostgreSQL FAQ
How much memory does Node.js API + PostgreSQL need?
The catalog lists about 256 MiB of memory for Node.js API + PostgreSQL across its 2 services.
Does Node.js API + PostgreSQL run on arm64?
For Node.js API + PostgreSQL, an arm64 image is published; amd64 is image published.
Does Node.js API + PostgreSQL need configuration before it starts?
No. The template fills in its own defaults and generates secrets at deploy time.
Which database does Node.js API + PostgreSQL bundle?
The template includes Postgres, running as its own service.
Which ports does Node.js API + PostgreSQL use?
Node.js API + PostgreSQL listens on port 3000 inside the stack.
Where does Node.js API + PostgreSQL keep its data?
In a named volume: node_postgres_db_data mounted at /var/lib/postgresql/data.
Can I deploy Node.js API + PostgreSQL on Dokploy or Dokku?
The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Node.js API + PostgreSQL, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image postgres:16-alpine, node:22-alpine is what you deploy there.