Developer-first cloud platform

Node.js

Author Zerops Team

This is the most bare-bones example of Node.js app running on Zerops — as few libraries as possible, just a simple endpoint with connnect, read and write to a Zerops PostgreSQL database.

Recipe features

  • Node.js / Express.js app running on a load balanced Zerops Node.js service
  • Zerops PostgreSQL 16 service as database
  • Healthcheck setup example
  • Utilization of Zerops' built-in environment variables system
  • Utilization of Zerops' built-in log management

Production vs. development

Base of the recipe is ready for production, the difference comes down to:

  • Use highly available version of the PostgreSQL database (change mode from NON_HA to HA in recipe YAML, db service section)
  • Use at least two containers for the Node.js service to achieve high reliability and resilience (add minContainers: 2 in recipe YAML, api service section)

Further things to think about when running more complex, highly available Node.js production apps on Zerops:

  • Containers are volatile - use Zerops object storage to store your files
  • Use Zerops Redis (KeyDB) for caching, storing sessions and pub/sub messaging
  • Use more advanced logging lib, such as winston

Can we help you figure something out?

If you need more tips how to utilize Zerops to the fullest, or get stuck, get in touch with our dev team on Discord or our support forum.

New version of Zerops GUI (v4.13.43) was released, please reload your browser as soon as possible.