# 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

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.

Website: https://logsnag.com/blog/self-host-nextjs-hetzner-kamal

## What it is 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](https://xiry.app/topics/development.md)
- 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](https://x.com/ImSh4yy/status/1742614880056746211): 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](https://x.com/ImSh4yy/status/1742614880056746211): 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

- [Alternatives to Vercel](https://xiry.app/alternatives/vercel.md)

## Related

- [Coolify](https://xiry.app/resources/coolify): Open-source, self-hosted platform alternative to Heroku, Vercel, and Railway (Web app, Freemium)
- [AgentUI](https://xiry.app/resources/agentui): Open-source, self-hosted chat interface for Agno agents and teams (Web app, Open source)
- [n8n Docker Self-Hosting & HTTP Cheat Sheet](https://xiry.app/resources/n8n-docker-self-hosting-and-http-cheat-sheet): Quick command reference for running n8n via Docker and configuring environments. (Tip, Free)
- [sher](https://xiry.app/resources/sher): CLI tool for instant temporary preview links without GitHub or accounts (Web app, Free)
- [VPS + Coolify Self-Hosting Stack](https://xiry.app/resources/vps-coolify-self-hosting-stack): Cost-saving hosting strategy using a single VPS and Coolify (Tip, Free)
- [WAHA](https://xiry.app/resources/waha): Self-hosted WhatsApp REST API configured via Docker in minutes. (GitHub repo, Open source)

Updated 10 October 2026. Page: https://xiry.app/resources/how-to-self-host-a-next-js-app-on-a-hetzner-vm-using-kamal

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
