Documentation menu

Deploy Express on Light Cloud - detected from package.json, run as a Node.js container on port 8080, scaling to zero when idle.

Deploy Express

Express is detected from your package.json and runs as a Node.js container on port 8080. No Dockerfile needed - one is generated on Node 22, installing with your lockfile's package manager.

Serve it#

Listen on the routed port - PORT is set to it:

const app = require('express')();

app.listen(process.env.PORT || 8080, () => {
  console.log('up');
});

app.listen binds all interfaces by default - correct for containers. Log with console.log/console.error; both land in runtime logs.

Configuration and database#

Read environment variables from process.env at startup. For a database, set DATABASE_URL from the Credentials tab - pg, mysql2, Prisma, and Drizzle all take it. Connect lazily so cold starts stay short.

Scaling#

Defaults fit a typical I/O-bound API: concurrency 80, scale to zero when idle. Set min instances to 1 on production if the first request after quiet must be fast.