# 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](/platform/deployments/builds#dockerfiles-generated-or-your-own) 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](/create/build-settings#port):

```js
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](/platform/deployments/builds#when-a-build-fails).

## Configuration and database

Read [environment variables](/platform/environment-variables#build-time-and-runtime) from `process.env` at startup. Set `DATABASE_URL` from the [Credentials tab](/platform/databases/connect); Fastify's logger writes JSON to stdout, which [runtime logs](/platform/observability#runtime-logs) pick up as-is.

## Scaling

Fastify's throughput pairs well with the default [concurrency](/create/scaling#concurrency) of 80 or higher; [scale to zero](/create/scaling#min-instances) covers idle time.

## Related

- [Connect an app](/platform/databases/connect): DATABASE_URL, TLS, per-environment databases.
- [Builds](/platform/deployments/builds): The generated Node image, step by step.
- [Scaling](/create/scaling): Instances, concurrency, CPU target.
