Claude Code + Hostinger Tutorial

Deploy a Next.js App to Production with Claude Code

A complete walkthrough โ€” from blank project to live URL, using AI to write every line.

Get Hostinger VPS โ†’

Affiliate link โ€” helps support the channel at no extra cost to you

Step-by-Step Guide

Follow along with the video. Copy the prompts below exactly as shown.

1

Get a Hostinger VPS

Sign up for a Hostinger KVM VPS plan. The KVM 2 plan is plenty for a Node.js app.

Hostinger VPS Plans โ†’
Recommended: Choose Ubuntu 22.04 LTS as your OS during setup.
2

Point Your Domain to the Server

Log in to your DNS provider and add an A record:

  • Type: A
  • Name: @ for root domain, or a subdomain like app
  • Value: your server's IP address
  • TTL: Auto / 300
Cloudflare users: You can enable the orange cloud proxy โ€” it works fine with this setup.
3

Set Up SSH Key Access

Claude Code needs passwordless SSH access to your server.

1. Generate an SSH key (if you don't have one)

ssh-keygen -t ed25519 -C "your@email.com"

Press Enter through all prompts. This creates a private key and a public key (.pub) in ~/.ssh/.

2. Copy your public key

Mac:

cat ~/.ssh/id_ed25519.pub | pbcopy

Windows (PowerShell):

Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub" | Set-Clipboard

3. Add the key to your Hostinger VPS

In hPanel, go to VPS โ†’ SSH Keys โ†’ Add SSH Key and paste your public key. Or run:

ssh-copy-id root@YOUR_SERVER_IP
Test it: Run ssh root@YOUR_SERVER_IP โ€” if it connects without a password prompt, you're ready.
4

Let Claude Code Set Up the Server

Now that SSH is working, give Claude Code this prompt and it will handle the entire server setup:

Claude Code Prompt

I have a fresh Hostinger VPS at root@YOUR_SERVER_IP running Ubuntu 22.04. SSH in and set up everything needed to host Node.js apps: install Node.js v20, PM2, and Docker. Then set up Traefik as a reverse proxy in Docker so it handles HTTPS automatically via Let's Encrypt. Use YOUR_EMAIL for SSL certs. Configure it to watch a dynamic config file at /root/traefik-dynamic.yml so I can add new apps without restarting anything.

Tip: Traefik handles HTTPS/SSL certificates automatically via Let's Encrypt โ€” no manual cert setup needed.
5

Create Your Project with Claude Code

Use prompts like these to scaffold your entire app:

Claude Code Prompt

Create a new Next.js 15 app with TypeScript, Tailwind CSS, and shadcn/ui. Use the App Router. Set it up with a dashboard layout and a sidebar.

Claude Code Prompt

Add a Neon serverless PostgreSQL database using Drizzle ORM. Create a users table and a settings table with UUID primary keys.

Claude Code Prompt

Add authentication using Neon Auth. Protect all /dashboard routes and redirect unauthenticated users to /auth/signin.

6

Create a GitHub Repo

Ask Claude Code to create a private GitHub repo and push your code:

Claude Code Prompt

Can you make a new private GitHub repo for this project called My App Name?

Claude Code Prompt

Can you make a better README that explains the tech stack and how to set it up?

7

Create the Deploy Script

Ask Claude Code to create a deploy script for your Hostinger VPS:

Claude Code Prompt

I want to create a deploy script that deploys to production on Hostinger. I already have apps set up there. The server is root@YOUR_SERVER_IP and I want the app at myapp.mydomain.com

Claude Code will generate a deploy.sh that builds locally and rsyncs the output to your server:

#!/bin/bash
set -e

SERVER="root@YOUR_SERVER_IP"
REMOTE_DIR="/var/www/myapp"

BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" != "main" ]; then
  echo "Error: must be on main branch to deploy"
  exit 1
fi

npm run build:prod

rsync -avz --delete .next/standalone/ $SERVER:$REMOTE_DIR/
rsync -avz .next/static $SERVER:$REMOTE_DIR/.next/
rsync -avz public $SERVER:$REMOTE_DIR/
rsync -avz .env.production.local $SERVER:$REMOTE_DIR/.env

ssh $SERVER "cd $REMOTE_DIR && PORT=3002 pm2 restart myapp || PORT=3002 pm2 start server.js --name myapp"
Important: Add output: "standalone" to your next.config.ts โ€” required for the rsync deploy approach.

Make it executable and deploy:

chmod +x deploy.sh
./deploy.sh
8

Configure Traefik for Your Domain

Ask Claude Code to add the route โ€” it will SSH in and update the config file directly:

Claude Code Prompt

SSH into the server and add a Traefik route for myapp.mydomain.com pointing to port 3002. Add it to /root/traefik-dynamic.yml alongside any existing apps.

Traefik watches the file and reloads automatically โ€” no restart needed. SSL is provisioned on the first request.

SSL is automatic. Traefik requests a Let's Encrypt certificate for your domain the first time it's hit.
9

You're Live!

Visit your domain โ€” your app should be live with HTTPS. For future deploys, just run:

./deploy.sh

To check your app status on the server:

ssh root@YOUR_SERVER_IP "pm2 list"
ssh root@YOUR_SERVER_IP "pm2 logs myapp --lines 50"
Done! You now have a fully automated deploy pipeline โ€” build locally, push to production in one command.