Development · Article or course

How to self-host a Next.js app on a Hetzner VM using Kamal

Step-by-step tutorial for deploying Next.js to Hetzner using Kamal

Visit logsnag.com ↗

A practical guide by LogSnag founder Shayan on deploying containerized Next.js applications to a budget Hetzner virtual machine. It walks through configuring standalone Next.js Docker builds, defining health check routes, and managing deployments with Kamal.

What it's for

  • Deploy a production Next.js application to an inexpensive VPS
  • Configure multi-stage Docker builds with standalone Next.js output
  • Automate container provisioning and zero-downtime updates via Kamal CLI
  • Route traffic and SSL to a self-hosted server using Cloudflare

Features

  • Next.js health check endpoint configuration
  • Optimized multi-stage Dockerfile setup for standalone Next.js
  • Hetzner cloud server provisioning guidelines
  • Kamal configuration file setup (deploy.yml)
  • Server bootstrapping with kamal setup
  • Automated app deployment with kamal deploy
  • Custom domain routing using Cloudflare DNS proxy

Pricing

Free blog post tutorial

Details

Type
Article or course
Category
Development
Topic
DevOps & Hosting
Open source
No
Platforms
Web, Linux, Command line
For
Indie hackers, full-stack developers, and DevOps engineers looking to cut Next.js hosting costs.
Alternative to
Vercel, Railway, Render, Coolify
Tags
nextjs, kamal, hetzner, docker, self hosted, deployment

Why it was saved

  • @ImSh4yy, 3 January 2024: Step-by-step guide for a common indie-hacker deployment setup: Hetzner is a cheap VPS provider and Kamal is the popular deployment tool from 37signals.
  • @ImSh4yy, 3 January 2024: Step-by-step guide for a common indie-hacker deployment setup: Hetzner is a cheap VPS provider and Kamal is the popular deployment tool from 37signals.

Compare

Related

  • Coolify

    Open-source, self-hosted platform alternative to Heroku, Vercel, and Railway

  • AgentUI

    Open-source, self-hosted chat interface for Agno agents and teams

  • n8n Docker Self-Hosting & HTTP Cheat Sheet

    Quick command reference for running n8n via Docker and configuring environments.

  • sher

    CLI tool for instant temporary preview links without GitHub or accounts

  • VPS + Coolify Self-Hosting Stack

    Cost-saving hosting strategy using a single VPS and Coolify

  • WAHA

    Self-hosted WhatsApp REST API configured via Docker in minutes.

Updated