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.
What Levelrail covers, and what it does not
Each row says what Levelrail does today. Rows marked “not yet verified on a real host” are documented behavior that has no recorded live run.Deploy a Next.js app in about 10 minutes
The time depends mostly on your first build. Plan for the install and build of your own project, then a few minutes for the rest.1
Detect and create the app
Connect the repository. When
next is in package.json, the Next.js preset is picked: port 3000, a Railpack build and a start command based on your output setting. Check the proposed start command before you create the app. Details are in Next.js. Use your own Dockerfile if you want a smaller image or run a monorepo.2
Set build-time variables, then deploy
NEXT_PUBLIC_* values are inlined at build time, so set them before the first build. Push to your branch. The new release takes traffic only after the readiness probe passes.
3
Add your domain
levelrail-cli apps domains add web app.example.com. Point DNS at the server, or connect Cloudflare as the DNS provider and Levelrail creates the record. See Domains and ingress.4
Put Cloudflare in front
Run
levelrail-cli cdn setup web --dry-run first. It checks the provider, the zone SSL mode, DNS-01, the client address preset and the DNS plan, and prints the fix command for anything that is off. It never changes zone settings. Then run levelrail-cli cdn setup web to apply the DNS plan, turn on the proxy and verify it. Deploys and rollbacks purge the Cloudflare cache for the app’s hostnames. A build started by a git push does not purge yet, and purge history resets when the control plane restarts. See Cloudflare in front. This was not yet verified on a live proxied record.5
Open a pull request
levelrail-cli apps previews enable web. Each pull request gets a preview that is torn down when it closes. See Preview environments.6
Practice a rollback
levelrail-cli apps deploys rollback-to web <deploy-id> puts the exact image of an earlier deploy back without a rebuild. The dashboard has a Rollback button per deploy.What to expect for build time and cache
- The first build is the slowest. Later builds reuse BuildKit cache steps, and the Deploys page shows median build time and cache hit rate. See Build performance.
- Next.js writes its page and image cache under
.next/cache. Without a volume, each deploy starts cold. The Next.js preset mounts a volume for it, andimage_cache: persistentkeeps optimized images. See Next.js and image cache. - With more than one replica, each keeps its own ISR cache unless you use the Redis shared cache.
- Turning on the ingress cache is optional and starts with the “Cache static assets” preset in CDN and caching. The ingress never caches requests that carry cookies or an Authorization header unless a rule allows it.
- A single small VPS is the best tested path. Build memory counts, so check Build performance.
Troubleshooting
- Troubleshooting by symptom: crashloops, failed health checks, certificate and DNS problems.
- Troubleshooting: the full list and what each doctor finding means.
- Behind Cloudflare: redirect loops, 526 and 413 errors.
- Next.js: health check and shutdown behavior.
- Run
levelrail-cli doctorandlevelrail-cli attentionfirst.
Frequently asked questions
Does it support the App Router and server components?
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?
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?
Can I run it on one small VPS?
Yes. A single node is the best tested path.
Is there a migration guide?
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.