TempsTemps
  • Docs
  • Blog
  • Pricing
  • Enterprise
  • Security
  • Contact
Star—
TempsTemps

Open-source deployment platform with built-in error tracking, analytics, and monitoring. Runs on any VPS. No surprise bills, no data leaving your infrastructure.

  • Product
  • Features
  • Documentation
  • Changelog
  • Enterprise
  • Contact
  • Resources
  • Getting Started
  • Upgrade
  • GitHub
  • Reddit
  • Tools
  • VPS Security Scanner
  • PaaS Tax Calculator
  • Compare
  • vs Vercel
  • vs Netlify
  • vs Coolify
  • All Platforms
  • Deploy
  • Next.js
  • Node.js
  • Django
  • Laravel
  • Go
  • Rust
  • All Frameworks →
  • Legal & Compliance
  • Security & Trust
  • Data Ownership & Privacy
  • GDPR Compliance

© 2026 Temps. All rights reserved.

GitHubDocs
t
Temps

How to Deploy Next.js in Under 5 Minutes with Temps

How to Deploy Next.js in Under 5 Minutes with Temps

January 31, 2026 (5mo ago)

Temps Team

Written by Temps Team

Last updated January 31, 2026 (5mo ago)

Free guide

Zero-Downtime Deployment Playbook

The deployment checklist used by teams shipping 10+ times per day without dropping a single request.

  • Blue-green vs rolling vs canary — when to use each
  • Health check configuration that actually catches failures
  • Preview environment setup for every PR
  • Automated rollback triggers and procedures

No spam. Unsubscribe anytime. Privacy policy

#next.js#deployment#tutorial#getting-started
Back to all posts

How to Deploy a Next.js App to a Self-Hosted Server (2026 Guide)

You can deploy a Next.js application to your own server in under 5 minutes using Temps — the self-hosted platform that gives you Vercel-grade developer experience without per-seat pricing or bandwidth bills. This guide covers the full path from zero to production, including preview environments, custom domains, and environment variables.

TL;DR: Install Temps on any VPS, run bunx @temps-sdk/cli projects create + projects git + deploy, and your Next.js app is live with automatic HTTPS. Temps Cloud costs ~$6/mo (Hetzner + 30% margin); self-hosting is free, Apache 2.0.


Temps vs Vercel vs Coolify for Next.js Deployments

FeatureTempsVercelCoolify
Git-push deploymentsYesYesYes
Preview environmentsYesYesYes (v4+)
Automatic HTTPSYes (Let's Encrypt)YesYes
Built-in analyticsYes (included)$10+/mo add-onNo
Built-in error trackingYes (included)Not includedNo
Session replayYes (included)Not includedNo
Per-seat pricingNone$20/seat/moNone
Bandwidth feesNone$0.15/GB over 1 TBNone
Self-host licenseApache 2.0Closed sourceApache 2.0
Managed cloud pricing~$6/moFrom $20/moFrom $5/mo (management only)

What Is the Fastest Way to Deploy Next.js Without Vercel?

The fastest self-hosted path is a single-binary install + CLI deploy — no Docker Compose files, no Nginx configuration, no manual SSL setup. Temps handles the proxy layer (built on Pingora, Cloudflare's open-source proxy engine written in Rust), automatic Let's Encrypt certificates, and health-checked rollouts.


Prerequisites

  • A Next.js application (any version 13+)
  • Git repository (GitHub, GitLab, or Bitbucket)
  • A server running Temps (or a Temps Cloud account)

Method 1: Deploy with the Temps CLI

The fastest path from local code to production.

Step 1: Install Temps CLI

# macOS / Linux (installs the Temps server + CLI)
curl -fsSL https://temps.sh/deploy.sh | bash

# Or via npm / bun (CLI only)
npm install -g @temps-sdk/cli

Step 2: Log in

bunx @temps-sdk/cli login

This opens a browser window for authentication. Sign in with GitHub, GitLab, or email.

Step 3: Create a project and connect your repository

# Create a new project
bunx @temps-sdk/cli projects create -n "my-nextjs-app" -d "Next.js application"

# Connect your Git repository (--preset nextjs configures build defaults)
bunx @temps-sdk/cli projects git -p my-nextjs-app \
  --owner your-org --repo your-nextjs-app --branch main --preset nextjs -y

Temps automatically detects your Next.js configuration and sets build commands to npm run build with .next as the output directory.

Step 4: Deploy to production

bunx @temps-sdk/cli deploy my-nextjs-app -b main -e production -y

Temps builds your application and deploys it. You receive a URL within seconds. Health checks run every 5 seconds — two consecutive successes promote the deployment, and any failure within the 60-second error window triggers automatic rollback to the previous version.


Free guide

Zero-Downtime Deployment Playbook

The deployment checklist used by teams shipping 10+ times per day without dropping a single request.

  • Blue-green vs rolling vs canary — when to use each
  • Health check configuration that actually catches failures
  • Preview environment setup for every PR
  • Automated rollback triggers and procedures

No spam. Unsubscribe anytime. Privacy policy

Method 2: Deploy via Git Push

Connect your repository once and get automatic deployments on every push.

Step 1: Connect your repository

  1. Go to temps.sh and sign in
  2. Click New Project
  3. Select your Git provider (GitHub, GitLab, Bitbucket)
  4. Choose your Next.js repository

Step 2: Configure build settings

Temps auto-detects Next.js projects. Default settings work for most apps:

SettingDefault Value
Build commandnpm run build
Output directory.next
Node version20

Step 3: Push to deploy

Push to your main branch. Temps handles:

  • Installing dependencies
  • Building your application
  • Deploying to production
  • Provisioning SSL certificate via Let's Encrypt
  • Setting up CDN caching via Pingora (Cloudflare-built proxy)

How Do I Set Environment Variables for Next.js on Temps?

Via CLI

# Add a single variable to production
bunx @temps-sdk/cli environments vars set DATABASE_URL "postgresql://..." \
  -p my-nextjs-app -e production

# Import multiple variables from a .env file
bunx @temps-sdk/cli environments vars import .env.production \
  -p my-nextjs-app -e production

# List all variables
bunx @temps-sdk/cli environments vars list -p my-nextjs-app

Via dashboard

  1. Navigate to your project settings
  2. Click Environment Variables
  3. Add key-value pairs
  4. Choose which environments receive the variable (production, preview, development)

Environment variables are encrypted at rest and securely injected at build and runtime. No variable value is ever stored or displayed in plaintext after initial entry.


Preview Environments for Every Pull Request

Every pull request automatically receives an isolated preview deployment.

How it works

  1. Open a pull request
  2. Temps builds and deploys a preview environment
  3. A comment appears on the PR with the preview URL
  4. Review changes before merging
  5. Preview is cleaned up automatically when the PR closes

Preview URL pattern

pr-123-my-nextjs-app.temps.sh

Share these links with stakeholders or QA before merging to production.


Custom Domains and SSL

DNS configuration

Add an A record pointing to your server:

TypeNameValue
Ayourdomain.comYOUR_SERVER_IP
AwwwYOUR_SERVER_IP

Adding your domain

# HTTP challenge (default, works for standard domains)
bunx @temps-sdk/cli domains add -d yourdomain.com

# Wildcard — requires DNS challenge
bunx @temps-sdk/cli domains add -d "*.yourdomain.com" --challenge=dns-01

For wildcard domains, the CLI shows a TXT record to add to your DNS provider. Once propagated, Temps completes ACME validation and issues the certificate. Standard domains use the http-01 challenge automatically.


Free guide

Zero-Downtime Deployment Playbook

The deployment checklist used by teams shipping 10+ times per day without dropping a single request.

  • Blue-green vs rolling vs canary — when to use each
  • Health check configuration that actually catches failures
  • Preview environment setup for every PR
  • Automated rollback triggers and procedures

No spam. Unsubscribe anytime. Privacy policy

Full Next.js Feature Support

Temps runs your application in a container — all Next.js features work without configuration:

  • App Router — app/page.tsx and nested layouts
  • Server Components — async data fetching in components
  • API Routes — app/api/[route]/route.ts handlers
  • Server Actions — "use server" functions
  • ISR — export const revalidate = 60
  • Middleware — middleware.ts runs on Pingora's edge layer
  • Image Optimization — automatic resizing and caching

Recommended: enable standalone output

Add this to next.config.js for smaller, faster deployments:

/** @type {import('next').NextConfig} */
const nextConfig = {
  output: "standalone",
};

module.exports = nextConfig;

This reduces container image size by excluding development dependencies from the production bundle.


Built-in Observability (No SaaS Subscriptions Required)

Temps includes analytics, error tracking, and session replay without any additional setup or third-party accounts.

Analytics

After your first deployment, the Temps dashboard shows:

  • Page views and unique visitors
  • Top pages and referrers
  • Geographic distribution
  • Device and browser breakdown

Privacy-friendly and GDPR-compliant. No Google Analytics, no cookie banners required.

Error tracking

Temps captures frontend and backend errors automatically:

  • Exception tracking with full stack traces
  • Browser and OS context per error
  • User action breadcrumbs leading up to the error
  • Automatic grouping to identify recurring patterns

No Sentry subscription needed.

Session replay

Record and replay user sessions to understand exactly what happened when something went wrong. Sessions are stored on your infrastructure — no data leaves your servers.


Does Next.js Deployment on Temps Require Kubernetes?

No. Temps uses Docker containers orchestrated by the Temps binary itself — there is no Kubernetes, no Helm charts, and no cluster management. A single VPS running the Temps server handles build, deploy, proxy, certificates, and monitoring in one process.

For multi-server deployments, Temps uses a WireGuard mesh to connect worker nodes, each running Docker. The control plane routes traffic via Pingora. This scales to hundreds of containers without Kubernetes overhead.


Rollbacks

One-command rollback

bunx @temps-sdk/cli deployments rollback -p my-nextjs-app -e production

Temps promotes the previous healthy deployment and updates routing immediately. Health checks (5-second interval, 2 consecutive successes required) verify the rollback before traffic is fully shifted.

View deployment history

# Stream live runtime logs
bunx @temps-sdk/cli runtime-logs -p my-nextjs-app -f

Troubleshooting

Build fails

Check your build logs in the dashboard. Common causes:

  • Missing environment variables (add them under Project Settings → Environment Variables)
  • Node version mismatch (change it under Project Settings → Build)
  • TypeScript errors (fix locally before pushing — tsc --noEmit)

Deployment succeeds but the app returns errors

  1. Stream runtime logs: bunx @temps-sdk/cli runtime-logs -p my-nextjs-app -f
  2. Verify environment variables are set for the correct environment
  3. Confirm any external services (databases, APIs) are accessible from your server

Custom domain not resolving

  1. Verify DNS A records point to your server IP
  2. Allow up to 48 hours for DNS propagation
  3. Check SSL certificate status in the Domains section of your dashboard

Free guide

Zero-Downtime Deployment Playbook

The deployment checklist used by teams shipping 10+ times per day without dropping a single request.

  • Blue-green vs rolling vs canary — when to use each
  • Health check configuration that actually catches failures
  • Preview environment setup for every PR
  • Automated rollback triggers and procedures

No spam. Unsubscribe anytime. Privacy policy

Quick Reference

# Install CLI
curl -fsSL https://temps.sh/deploy.sh | bash

# Login
bunx @temps-sdk/cli login

# Create project and connect repository
bunx @temps-sdk/cli projects create -n "my-nextjs-app" -d "Next.js app"
bunx @temps-sdk/cli projects git -p my-nextjs-app \
  --owner myorg --repo my-nextjs-app --branch main --preset nextjs -y

# Deploy to production
bunx @temps-sdk/cli deploy my-nextjs-app -b main -e production -y

# Set environment variable
bunx @temps-sdk/cli environments vars set DATABASE_URL "postgresql://..." \
  -p my-nextjs-app -e production

# Stream live logs
bunx @temps-sdk/cli runtime-logs -p my-nextjs-app -f

# Add custom domain (HTTP challenge by default; use --challenge=dns-01 for wildcards)
bunx @temps-sdk/cli domains add -d yourdomain.com

# Rollback to previous deployment
bunx @temps-sdk/cli deployments rollback -p my-nextjs-app -e production

Ready to deploy? Get started at temps.sh — self-hosting is free (Apache 2.0), or use Temps Cloud at ~$6/mo.