n8n is an open-source workflow automation platform that rivals Zapier and Make — and unlike them, its self-hosted Community edition runs entirely on your own machine with unlimited executions for free. This guide walks you through installing n8n with Docker or npm, keeping your data persistent, and building your first automation.
What you get from self-hosting n8n
The self-hosted edition includes the full visual workflow editor, hundreds of integrations, scheduling triggers, webhooks, and code nodes with full JavaScript and Python support. The main thing you don't get versus n8n Cloud is managed hosting: updates, uptime, and scaling are your responsibility. For personal projects, side businesses, and learning, self-hosting is more than enough — no credit card, no execution limits, no subscription.
Prerequisites
You need one of the following:
- Docker (Docker Desktop on Windows/Mac, Docker Engine on Linux) — the recommended path
- Node.js 18 or newer if you'd rather install via npm
That's it. n8n runs fine on a modest laptop (4 GB RAM) or a small VPS.
Option 1: install with Docker (recommended)
The official image is n8nio/n8n. Run it with a named volume so your workflows, credentials, and settings survive restarts:
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8nOpen http://localhost:5678 in your browser. On first launch, n8n asks you to create an owner account — this account lives locally in your instance, not on any cloud service.
Do not use --rm for your daily driver: removing the container without a volume wipes everything. The -v n8n_data:/home/node/.n8n mount is what makes the setup durable.
Option 2: install with npm
If you prefer running n8n as a plain Node process:
npm install n8n -g
n8n startThe editor appears at http://localhost:5678. n8n stores its data in ~/.n8n by default, so your workflows persist between runs automatically.
Option 3: Docker Compose for a tidy setup
For a more production-like local setup, save this as docker-compose.yaml:
services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=localhost
- N8N_PORT=5678
- GENERIC_TIMEZONE=UTC
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:Then run docker compose up -d. The restart policy means n8n comes back up after reboots.
Basic authentication and security
By default, n8n's first-run wizard creates an owner account, and you sign in with email and password. A few rules worth following:
- Never expose a local n8n instance to the internet without HTTPS and authentication in place. Local-only access (
localhost) is safe on a trusted machine. - Back up the
n8n_datavolume (or the~/.n8nfolder) before major version updates — export important workflows as JSON from the editor as well. - If you deploy on a VPS, put n8n behind a reverse proxy such as Nginx with a Let's Encrypt certificate, and set
N8N_HOST,N8N_PROTOCOL=https, andWEBHOOK_URLso webhooks generate correct URLs.
Making webhooks work from your laptop
Many automations start with a Webhook trigger node that external services call. On localhost, outside services can't reach your machine. The standard fix is a tunnel such as ngrok:
1. Start n8n as usual.
2. Install ngrok and run ngrok http 5678.
3. Copy the https://xxxx.ngrok-free.app URL into the service that calls your webhook.
For a long-term setup, deploy n8n to a VPS with a domain so webhooks have a stable public URL.
Build your first workflow: a scheduled task tracker
Let's build something concrete — a workflow that checks an RSS feed every morning and posts new items to a Discord channel.
1. Add a Schedule trigger — set it to run daily at 08:00 in your timezone.
2. Add an RSS Read node — paste the feed URL of a blog or news source you follow.
3. Add an IF node — filter for items published in the last 24 hours using an expression like {{ $json.pubDate }} compared against today's date.
4. Add a Discord node — create a webhook in your Discord channel settings and paste the webhook URL into the node's credentials.
Click Test workflow, then toggle Active in the top right so it runs on schedule. You just automated a daily digest with zero cloud fees.
Useful nodes to learn next
- Code node — run JavaScript or Python to transform data between steps; this is n8n's biggest edge over Zapier.
- HTTP Request node — talk to any API that lacks a dedicated node.
- AI Agent nodes — connect OpenAI, Anthropic, or Google Gemini credentials to build AI-powered workflows, including agents with memory and tool use.
- Sub-workflows — break complex automations into reusable pieces you can call from other workflows.
- Sticky notes — document what each section of a workflow does; future you will be grateful.
Community nodes and templates
The editor's Templates section ships with hundreds of ready-made workflows you can import and adapt — great for learning how experienced builders structure things. Under Settings → Community Nodes, you can install extra integrations published by the n8n community, which widens the tool's reach beyond the built-in node set.
Updating and backing up safely
Update n8n by pulling the newest image and recreating the container:
docker pull n8nio/n8n
docker stop n8n && docker rm n8n
docker run -d --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n n8nio/n8nBecause your data lives in the n8n_data volume, deleting the container loses nothing — but verify that before every update, and export mission-critical workflows as JSON from the editor's workflow menu. A cheap belt-and-braces backup is a workflow that periodically exports all your workflows and emails them to you, using n8n itself as the backup tool.
When to upgrade to n8n Cloud
Self-hosting stops making sense when automations become business-critical: you need guaranteed uptime, support SLAs, or built-in scaling. n8n Cloud starts those features with a free trial, and paid plans are priced per active workflow. But for experimenting, learning, and running personal automations, the self-hosted edition is genuinely free forever — your only cost is whatever machine it runs on.

