To self-host n8n, run the official Docker image on a Linux VPS, persist the /home/node/.n8n volume, put it behind a reverse proxy for free SSL, and lock down the editor with user accounts and a fixed encryption key. The Community Edition has no licence fee and no execution limits; you pay only for the server it runs on.
Short answer
Deploy the official n8nio/n8n Docker image on a small Linux VPS. Mount a persistent volume for /home/node/.n8n, set N8N_ENCRYPTION_KEY, N8N_HOST, N8N_PROTOCOL=https and WEBHOOK_URL, then terminate SSL at a reverse proxy such as Caddy, Traefik or Coolify. Create named user accounts, use PostgreSQL for production, and schedule off-server backups.
I lead open-source and integration deployments at MithTech, a team of Frappe specialists in Bengaluru. n8n is the workflow layer we use when a client wants integrations, lead capture, invoice syncs and WhatsApp alerts running on infrastructure the client owns. Honestly, the install is the easy hour. The part people skip is securing the editor and proving a backup restores, and that is what bites six months later.
We have deployed n8n alongside Frappe and ERPNext programmes often enough that the same mistakes come up each time. This guide is the checklist our team follows: install cleanly, make data survive restarts, get real SSL, secure the editor, and prove the backup works. All of it uses the free Community Edition.
Is n8n free to self-host, and what is the licence?
The Community Edition has no licence fee for your own use, with unlimited workflows and executions. There are no per-execution or per-workflow charges on your own server; your cost is the infrastructure. What is easy to miss is the licence, because n8n is source-available rather than conventional open source.
n8n is published under the Sustainable Use License, which n8n calls "fair-code". It is not an OSI-approved open-source licence. In plain terms: you may use, modify and self-host n8n for your own internal business purposes, for non-commercial use, or for personal use. You may not host n8n and charge others to use it, or white-label it as your own product, without an agreement with n8n. For an organisation automating its own sales, invoicing or customer operations, that is fully allowed.
8 rows · click a column to sort
| n8n Community Edition (self-hosted) | |
|---|---|
| Licence fee | None |
| Execution limits | None |
| Workflow limits | None |
| Licence model | Sustainable Use License (fair-code, source-available, not OSI) |
| Your own business automations | Allowed |
| Reselling hosting / white-labelling | Not allowed without an agreement |
| Features left out | SSO (SAML/LDAP), environments, Git version control, log streaming and a few others need a paid plan |
| What you pay for | The server, the database and your setup time |
Hosted plans and the paid features are priced separately; check n8n's own pricing page, since editions and terms change. This guide stays on the free self-hosted path.
What server do you need to self-host n8n?
A small Linux VPS is enough for most workloads. A single-core, 1 GB RAM instance runs a light install, but 2 CPU cores and 2 GB RAM give room once you add PostgreSQL and a few concurrent workflows. Any mainstream provider works; check its own page for prices, and pick a region close to your users for lower webhook latency.
Before you install, get three things ready:
- A domain or subdomain (for example
automation.yourcompany.in) pointed at the server's IP with an A record. Webhooks and OAuth callbacks need a real hostname, not an IP. - Open firewall ports: 22 (SSH), and 80 and 443 for the reverse proxy and SSL challenges. Do not expose n8n's internal port 5678 publicly.
- Docker installed, or a platform like Coolify that manages Docker for you.
For memory-heavy automations (large data merges, PDF generation, big API payloads), add RAM before CPU. n8n is usually more memory-bound than CPU-bound.
How do you install self-hosted n8n with Docker?
Docker isolates n8n and its Node runtime from the host and makes upgrades a one-line pull. The two routes we use are a Coolify one-click deploy, for teams that want a dashboard, or a hand-written Docker Compose file, for full control. Both run the same official image.
Choose Coolify or Docker Compose
If you already run Coolify, add n8n as a service and it wires up the container, domain and SSL; see the Coolify self-hosting guide for the base setup. If you prefer full control, write your own Compose file as below.
Write the Docker Compose file
Create a docker-compose.yml that runs the official image, maps the internal port and mounts a named volume for persistence:
services:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "127.0.0.1:5678:5678"
environment:
- N8N_HOST=automation.yourcompany.in
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://automation.yourcompany.in/
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- GENERIC_TIMEZONE=Asia/Kolkata
- N8N_SECURE_COOKIE=true
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Binding to 127.0.0.1:5678 keeps n8n reachable only from the reverse proxy, not the open internet. In production, pin a version tag instead of latest.
Set a fixed encryption key
Generate a long random string and store it in a .env file next to the Compose file as N8N_ENCRYPTION_KEY=.... n8n uses this key to encrypt saved credentials; if it changes, every stored credential becomes unreadable.
Bring it up
Run docker compose up -d, then docker compose logs -f n8n to confirm a clean start. The editor is now live on the loopback port, ready for the proxy in the next section.
How do you make n8n data survive restarts?
This is the most common mistake. n8n stores your workflows, credentials and, by default, its encryption key inside /home/node/.n8n in the container. If that directory is not on a volume, everything disappears the moment the container is recreated during an update or reboot.
Two settings protect your data:
- Mount the data directory. The
volumesblock in the Compose file above maps a named Docker volume to/home/node/.n8n, which keeps workflows, execution history and the SQLite database on disk outside the container's lifecycle. - Pin the encryption key. Set
N8N_ENCRYPTION_KEYyourself rather than letting n8n generate one. A generated key lives only inside the mounted directory, so if you move servers without copying that folder, your saved credentials cannot be decrypted. A fixed key you control makes migrations straightforward.
Neither replaces a backup: a volume on a failed disk is still lost.
For anything beyond a test instance, switch the database from SQLite to PostgreSQL. Add a postgres service to your Compose file and point n8n at it with DB_TYPE=postgresdb and the DB_POSTGRESDB_* variables. It is the same principle as reliable self-hosting on a low-cost VPS: state lives in a backed-up store, not inside a disposable container.
How do you add SSL and secure the n8n editor?
Never run the editor on plain HTTP: it handles credentials and webhook payloads that must be encrypted in transit. Put a reverse proxy in front of n8n that terminates TLS with a free Let's Encrypt certificate, while n8n itself listens only on localhost. n8n's docs show this reverse-proxy setup.
Put a reverse proxy in front
Use Caddy, Traefik or Nginx (or let Coolify do it). Caddy is the least fussy: a two-line Caddyfile fetches and renews a Let's Encrypt certificate for your domain and forwards traffic to 127.0.0.1:5678. Traefik does the same through labels in Docker Compose.
Match the n8n environment to HTTPS
Set N8N_PROTOCOL=https, N8N_HOST to your domain, and WEBHOOK_URL to the full https:// address, so n8n generates correct webhook and OAuth callback URLs. Keep N8N_SECURE_COOKIE=true so the session cookie is only sent over HTTPS.
Set up user accounts
On first load, n8n asks you to create an owner account. Set a strong password straight away and add named accounts for your team instead of sharing one login, so each change has a name on it.
Reduce the attack surface
Do not expose port 5678; only the proxy's 443 should be open. Keep the server patched, restrict SSH to keys, and consider an IP allowlist or VPN in front of the editor if only your office needs it. Webhook URLs can stay public while the editor stays private.
If you are weighing this self-hosted path against a hosted automation SaaS, the n8n vs Zapier vs Make comparison for India covers when owning the stack is worth the effort.
How do you back up a self-hosted n8n instance?
Back up two things, the database and the encryption key. Together they let you rebuild the instance on a new server. Test the restore at least once before you rely on it.
- Database dump. For PostgreSQL, run a scheduled
pg_dump(or use your provider's managed snapshots). For a small SQLite instance, snapshot the whole/home/node/.n8nvolume. - Encryption key. Store
N8N_ENCRYPTION_KEYseparately in a password manager or secrets vault. Without it, a restored database cannot decrypt credentials. - Off-server copy. Push dumps to S3-compatible object storage or another location, not the same disk. If Coolify manages the instance, its scheduled backups can send snapshots to an S3 bucket.
- Export workflows as code. n8n workflows are JSON. Committing exports to a Git repository gives you version history and a second recovery path independent of the database.
Should you run n8n yourself, or have it run for you?
Run it yourself if someone on your team will apply n8n releases, keep the server patched, guard the encryption key and test the restore above; it is then a fair, low-cost way to self host n8n. Have it run for you if nobody owns that work, or use n8n's own hosted plans, because a workflow that stops firing is often noticed only when an invoice or a lead goes missing.
Do it yourself if
You have someone at home with Docker, PostgreSQL and a reverse proxy, a spare server to test restores on, and automations that can wait a few hours if the instance is down.
Have it run for you if
Invoice syncs, lead capture or customer alerts depend on these workflows, webhooks from other systems must always land, or nobody wants to read release notes before each upgrade.
Under managed hosting we run one named server for n8n, in your cloud account or ours: nightly backups copied off it, one restored on a schedule, every upgrade tried on a copy first, and the keys stay yours. It is a monthly fee for running it plus the server, quoted in writing after a call; the self-hosting cost comparator sets that against a per-task automation bill.
Frequently asked questions
+Is self-hosted n8n really free with unlimited executions?
Yes. The Community Edition has no licence fee and no cap on workflows or executions on your own server. Your cost is the infrastructure: the VPS, the database and your setup time. Execution limits and tiered pricing apply to n8n's hosted plans, and a few features (such as SSO and Git version control) need a paid plan.
+What is the Sustainable Use License, and can I use n8n commercially?
It is n8n's fair-code, source-available licence, and not an OSI-approved open-source licence. You may use, modify and self-host n8n for your own internal business purposes, including commercial automations for your own company: invoicing, sales and operations are all fine. You may not host n8n and charge others to use it, or white-label it as your own product, without an agreement with n8n.
+Should I use SQLite or PostgreSQL for self-hosted n8n?
PostgreSQL for anything in production. SQLite is the default and fine for testing or a personal instance, but under concurrent executions it becomes a bottleneck and is harder to back up reliably. Set DB_TYPE=postgresdb and the related connection variables to switch.
+Do I need a domain to self-host n8n?
In practice, yes. Webhooks, OAuth callbacks and SSL all depend on a stable hostname. Point a domain or subdomain at the server with an A record, then set N8N_HOST and WEBHOOK_URL to it. A bare IP without HTTPS is only for local testing and should never handle real credentials.
+Can I run n8n on the same server as ERPNext?
You can, if the server has enough RAM, but we usually keep them on separate instances, or at least separate containers, so a heavy automation run never starves your ERP. n8n works well with ERPNext for syncing orders, invoices and notifications; see our Frappe and ERPNext work for how the two connect.
+How do I keep the n8n editor secure?
Run it only behind HTTPS through a reverse proxy, give each person their own account with a strong password, keep the internal port bound to localhost, and never expose port 5678 publicly. Patch the server, use SSH keys, and consider a VPN or IP allowlist for the editor while leaving only webhook URLs public.
We also connect self-hosted n8n to Frappe and ERPNext and the other systems you already use, so your automations reach the records they act on.
Comments & ratings
No comments yet. Start a new discussion.
Manoj · Published on 20 July 2026
Worked with us? Leave a Google review