All templates

Deploy Next.js on Rebasable

Next.js 16 app router site rendered on the server, with a health check route.

Runtime: node Free instance nodereacttypescript

How it works

The build runs npm ci && npm run build and the service starts with next start, which reads PORT. Route handlers, server components and middleware all run in the same Node process. src/app/healthz/route.ts is the health check used for zero-downtime deploys.

Run it locally

npm install
npm run dev   # http://localhost:3000

Use it as your own repository

Copy the nextjs folder of the templates repository into a new repo (the files at the root, rebasable.yaml included) and push it. Then add a Deploy button to its README, or create it from Blueprints, New blueprint in the dashboard. From then on, every push deploys, and pull requests get preview environments.

Good to know

  • Only static export? Set output: 'export' in next.config.ts, change the service to runtime: static with staticPublishPath: out, and it is served free from the edge.
  • Environment variables that the browser needs must start with NEXT_PUBLIC_ and exist at build time. Rebasable passes service env vars to the build.