← All articles
Self-hostingDeployment

Deploy Paperclip on Hetzner Cloud

Hetzner Cloud offers some of the best price-to-performance ratios in cloud hosting. A CX22 server (2 vCPU / 4 GB RAM) costs €4.51/month and runs Paperclip comfortably with room to spare.

Deploy on Railway instead →

Why Hetzner for Paperclip

Hetzner is popular with European developers for its rock-solid network, generous specs at low prices, and straightforward dashboard. For Paperclip, the CX22 plan (2 AMD vCPU, 4 GB RAM, 40 GB SSD, 20 TB traffic) at €4.51/month is more than enough for a production deployment — and it's about 3–4× cheaper than equivalent US cloud providers.

Caveat: Hetzner data centers are in Germany, Finland, and the US. If you need servers in Asia-Pacific or Latin America, consider other providers.

Step 1: Create a Hetzner account and server

  1. Sign up at hetzner.com and go to Hetzner Cloud
  2. Click New Project → New Server
  3. Configure:
    • Location: Nuremberg, Falkenstein, or Helsinki (EU); or Ashburn (US East)
    • Image: Ubuntu 24.04
    • Type: CX22 (2 vCPU / 4 GB RAM / 40 GB SSD) — €4.51/month
    • SSH Keys: Add your public key
  4. Create the server

Step 2: Connect and update

ssh root@YOUR_SERVER_IP

apt update && apt upgrade -y
apt install -y curl git ufw nginx

Set up a non-root user:

adduser deploy
usermod -aG sudo deploy

Step 3: Install Node.js

Use the NodeSource repository for Node 20 LTS:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
apt install -y nodejs
node --version  # should print v20.x.x

Step 4: Install Paperclip

npm install -g paperclipai

Create a data directory:

mkdir -p /opt/paperclip/data
chown -R deploy:deploy /opt/paperclip

Step 5: Configure environment

Create /opt/paperclip/.env:

cat > /opt/paperclip/.env << 'EOF'
NODE_ENV=production
PAPERCLIP_DATA_DIR=/opt/paperclip/data
BETTER_AUTH_SECRET=your_random_secret_here
PAPERCLIP_LISTEN_PORT=3100
PAPERCLIP_LISTEN_HOST=127.0.0.1
EOF
chmod 600 /opt/paperclip/.env

Generate a secret: openssl rand -hex 32

Step 6: Create a systemd service

cat > /etc/systemd/system/paperclip.service << 'EOF'
[Unit]
Description=Paperclip AI
After=network.target

[Service]
Type=simple
User=deploy
WorkingDirectory=/opt/paperclip
EnvironmentFile=/opt/paperclip/.env
ExecStart=/usr/bin/npx paperclipai server start
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable paperclip
systemctl start paperclip
systemctl status paperclip

Step 7: Configure nginx reverse proxy

cat > /etc/nginx/sites-available/paperclip << 'EOF'
server {
    listen 80;
    server_name paperclip.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:3100;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}
EOF

ln -s /etc/nginx/sites-available/paperclip /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx

Step 8: SSL with Let's Encrypt

apt install -y certbot python3-certbot-nginx
certbot --nginx -d paperclip.yourdomain.com

Certbot automatically renews your certificate. To verify:

certbot renew --dry-run

Step 9: Configure firewall

ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable

This blocks all ports except SSH (22) and HTTP/HTTPS (80/443).

Step 10: DNS

In your domain registrar, add an A record:

paperclip.yourdomain.com → YOUR_SERVER_IP

Wait for DNS propagation (typically 5–30 minutes), then access Paperclip at https://paperclip.yourdomain.com.

Monitoring and updates

Check Paperclip status:

systemctl status paperclip
journalctl -u paperclip -f

To update Paperclip:

npm install -g paperclipai@latest
systemctl restart paperclip

Common errors

502 Bad Gateway: Paperclip isn't running. Check systemctl status paperclip and journalctl -u paperclip --since "5 minutes ago".

Port 3100 not responding: Check that PAPERCLIP_LISTEN_HOST=127.0.0.1 in your env file. If it's 0.0.0.0, it's binding to all interfaces (fine but update your firewall rules).

Out of disk space: Hetzner CX22 has 40 GB. Monitor usage with df -h. Upgrade to CX32 if needed.

Cost

  • CX22 (2 vCPU / 4 GB RAM): €4.51/month
  • Includes 20 TB traffic — more than you'll ever use for Paperclip

Hetzner is hard to beat on price for European users. For zero-config deploys, Railway offers $20 free credit to get started.

Ready to deploy?

Affiliate disclosure: this link may earn us a commission at no extra cost to you.

This is an independent guide. Paperclip Hosting is not affiliated with the official Paperclip project. Guide steps are based on real deployments and are subject to change as the software evolves.