Deploy a Next.js App in 5 Minutes
Step-by-step tutorial to deploy a Next.js application from GitHub to Vardo.
This tutorial walks through deploying a Next.js application from a GitHub repo to Vardo, end to end.
Prerequisites
- A running Vardo instance (installation guide)
- A GitHub account with a repo containing a Next.js app
- A domain pointed at your server (or a subdomain of your Vardo base domain)
Step 1: Connect GitHub
Vardo deploys from GitHub repos using a GitHub App. If you skipped this during the setup wizard, configure it now:
- Go to Settings → Integrations → GitHub
- Click Create GitHub App — this opens GitHub with the app manifest pre-filled
- Click Create GitHub App on the GitHub page
- You'll be redirected back to Vardo with the credentials saved automatically
Once connected, Vardo can read repos the app has been granted access to and receive push webhooks for automatic deployments.
Step 2: Create a Project
Projects are groupings of related apps (think: a product or client).
- Go to Projects in the sidebar
- Click New Project
- Give it a name — for example,
my-app - Click Create
Step 3: Create an App from a GitHub Repo
- Inside your project, click New App
- Choose GitHub as the source
- Search for and select your repository
- Select the branch to deploy from (usually
main) - Choose a deploy type:
Build options:
- Dockerfile — if your repo has a
Dockerfile, Vardo uses it directly - Nixpacks — auto-detects Node.js and builds without a Dockerfile. Handles
pnpm install,pnpm build, and starts the app on port 3000. - Railpacks — alternative buildpack with faster builds
For a standard Next.js app without a Dockerfile, Nixpacks is the easiest option — it detects your package manager and framework automatically.
- Click Create App
Step 4: Configure Environment Variables
Before deploying, add any environment variables your app needs:
- Open the app detail page
- Click the Environment tab
- Add key/value pairs — for example:
DATABASE_URL=postgresql://... NEXTAUTH_SECRET=... NEXTAUTH_URL=https://my-app.example.com - Click Save
Environment variables are encrypted at rest and injected into the container at runtime.
Step 5: Deploy
- Click Deploy on the app detail page
- Watch the build log in real time — Vardo pulls the repo, builds the image, and starts the container
- When the status changes to Running, the app is live
A typical Next.js deploy takes 2-5 minutes depending on your server specs and the app's build time.
Automatic deployments: Vardo sets up a webhook on your repo automatically. Every push to the configured branch triggers a new deploy.
Step 6: Add a Custom Domain
By default, Vardo assigns a subdomain under your base domain (e.g., my-app.example.com). To use a custom domain:
- Go to the app's Domains tab
- Click Add Domain
- Enter your custom domain (e.g.,
app.mycompany.com) - Add a DNS record at your registrar:
Or if your DNS provider requires an A record, point it directly to your server IPCNAME app.mycompany.com → host.example.com - Click Verify — Vardo checks DNS and provisions a Let's Encrypt certificate automatically
- Once verified, the domain is live with HTTPS
What Just Happened
Here's what Vardo does under the hood when you deploy:
- Clone — pulls the repo at the selected commit SHA
- Build — runs
docker buildusing your Dockerfile or Nixpacks - Deploy — starts the new containers in the inactive blue-green slot
- Health check — waits for the new containers to become healthy (up to 60 seconds)
- Route — Traefik discovers the new containers and routes traffic to them
- Cleanup — tears down the old slot
Zero-downtime: the old slot keeps serving traffic until the new one passes health checks. If the new slot fails, the old one stays up.
Common Errors and Fixes
Build fails: pnpm: command not found
Your Dockerfile doesn't have pnpm installed. Add this before the install step:
RUN npm install -g pnpmOr use a base image that includes it.
Container starts but immediately exits
Check the logs tab. Common causes:
- Missing environment variable (e.g.,
DATABASE_URLnot set) - App listening on wrong port — Vardo expects port 3000; make sure your Next.js server uses
PORT=3000or the Compose template sets it - Build artifact missing — ensure your Dockerfile copies the
.nextdirectory
Domain shows "Invalid certificate"
DNS hasn't propagated yet. Wait a few minutes and click Verify again. Let's Encrypt certificate provisioning happens automatically once DNS resolves.
Webhook not triggering deploys
Go to your GitHub repo → Settings → Webhooks and check the recent deliveries. If the webhook is failing, re-save the GitHub integration in Vardo (Settings → Integrations → GitHub) to regenerate the secret.
Next Steps
- Set up automatic backups for your app's database
- Add health monitoring under Metrics in the sidebar
- Configure email notifications for deploy failures under Settings → Notifications