Documentation menu

Deploy Fastify on Light Cloud - a Node.js container on port 3000, with the host binding Fastify needs to be reachable in a container.

Deploy Fastify

Fastify is detected from your package.json and runs as a Node.js container on port 3000. No Dockerfile needed - one is generated on Node 22.

Serve it - and bind the host#

Fastify's default host is 127.0.0.1, which is unreachable from outside a container. Bind 0.0.0.0 explicitly, on the routed port:

const fastify = require('fastify')({ logger: true });

fastify.listen({ port: Number(process.env.PORT) || 3000, host: '0.0.0.0' });

A green deploy that never answers is almost always this bind - see When a build fails.

Configuration and database#

Read environment variables from process.env at startup. Set DATABASE_URL from the Credentials tab; Fastify's logger writes JSON to stdout, which runtime logs pick up as-is.

Scaling#

Fastify's throughput pairs well with the default concurrency of 80 or higher; scale to zero covers idle time.