There is no single right way to run n8n. The Desktop app is fine for a weekend hack. A $5 Hetzner VPS with Docker Compose runs an entire agency's automations. This chapter walks every path — you will pick one, install it, and end with a workflow live on the internet.
1. Deployment Options at a Glance
Setup Cost Difficulty Best for
n8n Cloud $$$ ★ No-ops, small teams
Desktop App free ★ Learning on your laptop
npm (local) free ★★ Developer machine
Docker free ★★ Any Linux/Mac
Docker Compose free ★★★ Production w/ Postgres
Railway $ ★ One-click cloud
Render $ ★ One-click cloud
DO / Hetzner VPS $ ★★★ Full control2. n8n Cloud
- Sign up at n8n.io/cloud.
- Pick a plan (Starter enough for 5 active workflows).
- Your instance is at your-name.app.n8n.cloud. No install needed.
3. Desktop App
Download from n8n.io/download. Runs on Mac / Windows / Linux. Uses SQLite by default. Great for learning; not for production.
4. Local via npm
# Requires Node.js 20 LTS
npm install -g n8n
n8n start
# → http://localhost:56785. Docker (single container)
docker volume create n8n_data
docker run -d --restart unless-stopped \
--name n8n \
-p 5678:5678 \
-e N8N_HOST="n8n.example.com" \
-e N8N_PROTOCOL=https \
-e WEBHOOK_URL="https://n8n.example.com/" \
-e N8N_ENCRYPTION_KEY="$(openssl rand -hex 32)" \
-v n8n_data:/home/node/.n8n \
n8nio/n8n:latest6. Docker Compose + Postgres (production)
# docker-compose.yml
services:
postgres:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_USER: n8n
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: n8n
volumes: [db:/var/lib/postgresql/data]
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
depends_on: [postgres]
ports: ["127.0.0.1:5678:5678"]
environment:
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_USER: n8n
DB_POSTGRESDB_PASSWORD: ${DB_PASSWORD}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
N8N_HOST: n8n.example.com
N8N_PROTOCOL: https
WEBHOOK_URL: https://n8n.example.com/
volumes: [data:/home/node/.n8n]
volumes: { db: {}, data: {} }7. Railway
- New Project → Deploy from Docker image → n8nio/n8n.
- Add a Postgres plugin. Copy its variables into the n8n service.
- Add a public domain. Set WEBHOOK_URL to that domain.
8. Render
New Web Service → Docker → image n8nio/n8n → attach a Render Postgres instance. Same env vars as Compose.
9. DigitalOcean / Hetzner VPS
# Ubuntu 24.04, 2 GB droplet is enough for 50 workflows.
adduser n8n && usermod -aG sudo n8n
apt update && apt install -y docker.io docker-compose-plugin ufw
ufw allow OpenSSH && ufw allow 80 && ufw allow 443 && ufw enable
# clone your compose file, then:
docker compose up -d10. Ubuntu + Nginx + SSL
# /etc/nginx/sites-available/n8n
server {
server_name n8n.example.com;
location / {
proxy_pass http://127.0.0.1:5678;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
}
}sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d n8n.example.com11. Environment Variables that Matter
- N8N_HOST, N8N_PROTOCOL, WEBHOOK_URL — must match your public URL.
- N8N_ENCRYPTION_KEY — 32-byte hex. Lose this and every credential becomes garbage.
- N8N_BASIC_AUTH_ACTIVE, N8N_BASIC_AUTH_USER/PASSWORD — first-layer lock.
- EXECUTIONS_DATA_PRUNE=true + EXECUTIONS_DATA_MAX_AGE=336 — keep the DB small.
- N8N_LOG_LEVEL=info — debug only while debugging; it is verbose.
12. The Encryption Key
13. Credentials
Under Settings → Credentials, add each service once (OpenAI, Google, Slack, etc.). Any node can pick a saved credential from a dropdown. Never paste tokens into node parameters.
14. Users & Projects
The free version supports a single-owner + members model; paid plans add multi-project workspaces. Give each team member their own login — you get a full audit trail per user.
15. Folders & Tags
Use tags (#client-acme, #prod, #draft) to filter. Move stable workflows into a "Production" folder.
16. Workflow Settings
- Save successful executions: off in prod for hot workflows.
- Save data errors: always on.
- Error Workflow: point every prod workflow at a shared error handler.
- Timezone: set explicitly; do not trust the server default.
17. Community Nodes
# Inside the container
npm install n8n-nodes-<package>
# Then Settings → Community Nodes → install by npm name.18. Templates
Import a workflow from n8n.io/workflows with one click. Great starting points; always audit credentials and URLs before running.
19. Backup & Restore
# Nightly cron on the VPS
docker exec postgres pg_dump -U n8n n8n | gzip > /backups/n8n-$(date +%F).sql.gz
# Keep the encryption key alongside — restore is meaningless without it.20. Version Control
n8n workflows are JSON. Export from the three-dot menu → commit to a Git repo. Paid plans expose native GitHub sync. Either way, treat workflows like code: PR review, branches, tags.