Levelrail
Skip to content

Self-host Next.js

Run Next.js on a server you own, without the glue scripts

Build from your Dockerfile, get HTTPS, preview environments per pull request, a managed database and one-click rollback, all from a git push.

curl -fsSL https://levelrail.com/install.sh | sudo sh

What you get for a Next.js app

Build and deploy

Connect GitHub, GitLab, Bitbucket or Gitea. Pushes build a Dockerfile with BuildKit and cut traffic over only when the readiness probe passes.

Environment and build-time vars

Env vars are encrypted per app. NEXT_PUBLIC_* values are inlined at build time, so set them before the build, which the migration runbook covers.

Database next to the app

Create Postgres or Redis as a managed resource with scheduled, verified backups and link it to the app.

Self-hosting Next.js, honestly

What changes when you leave a managed platform.

Managed platformLevelrail on your server
Cost modelUsage and seat basedYour server cost
Edge networkIncludedNot provided: put a CDN in front
Serverless functionsIncludedNot provided: long-lived containers
Previews and rollbackIncludedIncluded

From repo to HTTPS

  1. 1

    Add a Dockerfile

    A standard multi-stage Next.js Dockerfile with output set to standalone keeps the image small.

  2. 2

    Connect the repo and set env vars

    Set build-time variables first, then runtime secrets.

  3. 3

    Add your domain

    Point DNS at the server and Caddy issues and renews the certificate.

  4. 4

    Open a pull request

    A preview environment deploys and is torn down when the pull request closes.

Frequently asked questions

Does it support the App Router and server components?

It runs your container, so anything that runs in a Node container works. Levelrail does not run a separate Next.js-specific runtime.

How do preview environments work?

A pull request opened or updated deploys a preview. Closing the pull request tears it down, whether or not it merged.

Can I run it on one small VPS?

Yes. A single node is the best tested path.

Is there a migration guide?

Yes, a runbook for moving a Vercel-hosted Next.js app, with an inventory, a cutover plan and the gaps.

Deploy your Next.js app to your own server

Start with a side project and move the rest when you trust it.

Released under the Apache 2.0 License.