n8n · self-hosting guide · verified against the docs 4 September 2026

n8n self-hosted: the practical guide

Self-hosted n8n is the free Community edition of n8n running on a machine you control — a laptop, a VPS or a private cloud — instead of n8n Cloud. As of 4 September 2026 the install path n8n documents is Docker: either the one-line setup, curl -fsSL https://get.n8n.io | sh, which writes a Compose file and starts n8n at http://localhost:5678, or a Docker Compose file you write yourself. You need Docker Engine with Docker Compose v2 (Docker Desktop on macOS, or Windows through WSL), and for the full stack with the AI Assistant sandbox at least 4 GB of RAM and 2 vCPUs.

There is no license key to buy and no plan to pick; what you give up versus the paid editions is SSO, environments, projects, sharing, external secrets and Git version control. n8n itself recommends self-hosting for expert users and warns that mistakes can mean data loss. Below: the requirements, the exact commands from the docs, when n8n Cloud is the cheaper choice, and how to import our templates into your own instance.

Requirements

  • Docker, with Compose v2The docs’ prerequisite for the Compose setup: “Docker Engine and Docker Compose v2. Run docker compose version to check.” Docker Desktop (Mac, Windows, Linux) includes both; on a headless Linux server install Docker Engine and the Compose plugin. The one-line setup needs the docker compose v2 plugin specifically, not the old docker-compose binary.
  • At least 4 GB RAM and 2 vCPUsThe stated minimum for the current Compose stack, because it bundles the AI Assistant sandbox (Docker-in-Docker), which “needs more headroom than a typical container”. The single-container docker run below has no stated minimum.
  • Linux or macOS — Windows via WSLThe one-line setup and the Compose guide both want a Unix shell. On Windows use WSL with Docker Desktop’s WSL2 backend, and keep the project folder inside the WSL filesystem, not under /mnt/c/.
  • The skills n8n listsSetting up and configuring servers and containers; managing application resources and scaling; securing servers and applications; configuring n8n. n8n “recommends self-hosting for expert users” and says mistakes can lead to data loss, security issues and downtime.
  • A database decisionn8n defaults to SQLite in a file. The docs call it “fine for trying things out” and say a production instance with more than a handful of users or round-the-clock workflows should use Postgres.
  • One open port, plus reachability for webhooksOnly n8n’s port 5678 should ever be internet-facing; the sandbox and search services stay private. For webhook triggers from external services, your instance must be reachable from the web — the docs’ tunnel is for local development only.

Version cadence, per the docs on 4 September 2026: n8n releases a new minor version most weeks; the stable image is for production (2.37.9 at the time of checking), beta is the latest release (2.38.3) and may be unstable. Our templates were built on n8n 2.25.7 and import as standard workflow JSON.

Fastest path: the one-line setup

This is what the n8n docs now put at the top of “Host n8n”. It replaces the old npm install n8n / npx n8n approach, which the docs say no longer works from n8n 3.0. Run it in a terminal on Linux or macOS (WSL on Windows):

curl -fsSL https://get.n8n.io | sh

What it does, per the docs: checks that Docker is installed and running; creates a folder called n8n in your current directory; writes the configuration files (compose.yml, .env with generated secrets, searxng-settings.yml); downloads n8n and starts it, then prints n8n is running at: http://localhost:5678. Data lives in a Docker volume (n8n-data). The AI Assistant’s support services start too but the assistant stays off until you add a model API key.

Prefer to read a script before piping it to sh? The docs give the same install in three commands:

curl -fsSL https://get.n8n.io -o get-n8n.sh
less get-n8n.sh   # review it
sh get-n8n.sh

Everyday commands

To do thisRun this
Stop n8ndocker compose -f ./n8n/compose.yml down
Start it againdocker compose -f ./n8n/compose.yml up -d
Upgrade to the latest versioncurl -fsSL https://get.n8n.io | sh -s -- --upgrade
Remove n8n and delete its datadocker compose -f ./n8n/compose.yml down -v then rm -rf ./n8n

Flags: --version 2.31.4 installs or upgrades to a specific version, --no-start writes the files without starting, --upgrade only bumps the version and leaves data, settings and customisations untouched.

Step by step: self-host n8n and import your first workflow

  1. Install DockerDocker Desktop on macOS or Windows (with WSL2), or Docker Engine plus the Compose plugin on a Linux server. Check with docker compose version.
  2. Run the one-line setupIn a terminal: curl -fsSL https://get.n8n.io | sh. It checks Docker, creates an n8n folder with compose.yml, .env (unique secrets generated) and searxng-settings.yml, pulls the images and starts n8n. Safe to run twice: if n8n is already set up in that folder it says so and changes nothing.
  3. Open http://localhost:5678The command prints the URL once n8n is ready — the first start takes a moment. Create the owner account; you can register the Community edition during setup to unlock folders, debug in editor and custom execution data for free.
  4. Import a templateOpen any n8n template on this site, click Copy JSON, then paste onto your empty canvas (Ctrl/Cmd+V) or use the workflow menu → Import from File with the downloaded .json. Templates that need no credentials run immediately.
  5. Keep it updatedcurl -fsSL https://get.n8n.io | sh -s -- --upgrade bumps the version and leaves data and settings alone. n8n’s advice: update at least once a month and read the release notes for breaking changes.

Docker Compose by hand

Use this when you want to fold n8n into an existing Compose project or control every line. The docs’ current Compose guide builds five services, because it includes the sandbox stack that lets the AI Assistant run code safely:

ServiceWhat it is for
n8nThe workflow editor itself, at http://localhost:5678 — the only service that should be internet-facing.
sandbox-certsRuns once to generate the TLS certificates the sandbox services need, then exits.
sandbox-apiThe control plane n8n talks to when the AI Assistant needs to run code.
sandbox-runner-1A privileged Docker-in-Docker container that creates and runs the sandboxes. Never expose its ports.
searxngBundled web search backend for the AI Assistant. Internal only.

The docs walk it in six steps: 1 mkdir n8n && cd n8n; 2 create .env with your own values for the sandbox secrets (SANDBOX_API_KEYS, SANDBOX_API_RUNNER_REGISTRATION_TOKEN, SANDBOX_API_RUNNER_API_KEY, N8N_SANDBOX_SERVICE_API_KEY — which must match a value in SANDBOX_API_KEYS — plus SEARXNG_SECRET and N8N_INSTANCE_AI_SEARXNG_URL), and keep that file out of version control; 3 create searxng-settings.yml enabling the JSON format; 4 create compose.yml with the five services above — copy it from the official Compose guide rather than from a blog, since the image names and TLS wiring are exact; 5 start and check:

docker compose up -d
docker compose ps

Wait until sandbox-api shows healthy; sandbox-runner-1 and n8n then start automatically. 6 verify n8n is up:

curl -sf http://localhost:5678/healthz

Production database. The guide defines no database service, so n8n falls back to SQLite inside the container unless you mount a volume. For production the docs add a postgres:18 service (with PGDATA set explicitly, because Postgres 18 changed its default data location — remove that line and your database starts empty), put POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB in .env, and point n8n at it with DB_TYPE=postgresdb plus the DB_POSTGRESDB_HOST, _PORT, _DATABASE, _USER and _PASSWORD variables. n8n migrates itself to the new database on startup; existing SQLite data does not carry over, so do this on a fresh instance. A hardened variant with a non-root Postgres user and an external task runner lives in n8n’s n8n-hosting repository.

Updating a Compose install, from the docs — in the directory with your compose file:

docker compose pull
docker compose down
docker compose up -d

Smallest possible install: one container, no sandbox

If you do not want the AI Assistant stack at all, the docs still document a single docker run (on a page n8n now labels outdated in favour of Compose, but the command is unchanged). It creates one volume for your data and starts one container; replace the timezone placeholders with a tz database name:

docker volume create n8n_data

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="<YOUR_TIMEZONE>" \
 -e TZ="<YOUR_TIMEZONE>" \
 -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 -e N8N_RUNNERS_ENABLED=true \
 -v n8n_data:/home/node/.n8n \
 n8nio/n8n

Line by line, per the docs: port 5678 is mapped to the host; TZ sets the system timezone and GENERIC_TIMEZONE the timezone schedule-based nodes use; N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS enforces secure permissions on the config file; N8N_RUNNERS_ENABLED enables task runners — deprecated from n8n 2.0, where runners are on by default, but required on 1.x; the n8n_data volume mounted at /home/node/.n8n keeps workflows, credentials and the encryption key across restarts. Keep that volume even if you later move to Postgres: it still holds the encryption key and instance logs.

When n8n Cloud is cheaper

Self-hosting is free in license terms and costs a server plus your hours; the hours are the number most people forget. n8n’s own decision table (docs, “Choose how to use n8n”):

Your situationRecommended optionReason
Want to start right awayn8n CloudNo installation needed
Don’t have technical expertisen8n CloudFully managed, no setup or maintenance required
Don’t want to manage infrastructuren8n Cloudn8n handles hosting, updates, and scaling
Need full control over deploymentSelf-hostedYou control the environment and configuration
Have infrastructure and technical resourcesSelf-hostedYou can manage your own deployment
Want to run n8n for freeSelf-hosted (Community edition)Free with almost the complete feature set
  • Cloud wins below 10,000 executions a monthStarter is 20€ a month for 2,500 workflow executions and Pro 50€ for 10,000 (billed annually, per n8n’s pricing page on 4 September 2026). A maintained server plus monthly updates rarely costs less than that in time alone. The arithmetic per plan and per template is in our n8n pricing explainer.
  • Self-hosting wins above itOn Cloud the plan above Pro is Enterprise (contact sales); the self-serve Business plan at 667€ a month is itself a self-hosted license. So past 10,000 executions you run a server either way — and the Community edition runs it with no quota to buy.
  • Self-hosting wins on data residency and custom codeYour data stays where you put it (hosted plans store data in Frankfurt, Germany), and the pricing table marks custom nodes and bash scripts as “available in self-hosted”.
  • Cloud wins if nobody wants to be on calln8n’s prerequisite list — servers, containers, scaling, security — is a job description. If that job has no owner on your team, the 20–50€ is the cheaper line item.

Import our templates into your self-hosted instance

A self-hosted instance imports workflows exactly like n8n Cloud, because a template is plain workflow JSON. The docs list three UI routes — copy-paste onto the canvas, Import from File, and Import from URL — all in the workflow editor’s top-right menu. On this site every verified template has a Copy JSON button and a Download .json button, so the path is:

  1. Copy JSON on the template pageOr download the .json file. Our files are sanitized: credentials are placeholders like {{YOUR_SLACK_CREDENTIAL}}, never real keys.
  2. Open an empty workflow on your instanceWorkflows → Add workflow, so the import does not land on an existing canvas.
  3. Paste, or Import from FileCtrl/Cmd+V on the canvas, or the ⋯ menu → Import from File… and pick the download. n8n rebuilds every node and connection.
  4. Connect credentials only where a node asksNodes that need an account are flagged; open each and select or create your own credential inside your instance. Keys never leave your server.
  5. Run once, then activateExecute with test data, confirm every node turns green, then toggle Active. Webhook templates get a production URL on your own domain.

These n8n templates need no credentials at all, so they run on a fresh Community instance the minute they are pasted in:

From the command line. A self-hosted instance also has n8n’s server CLI. Copy the downloaded file to the server (or into the container) and run n8n import:workflow --input=file.json. Two notes from the docs: import:workflow deactivates every imported workflow by default, and a workflow whose ID matches one already in your database overwrites it. n8n now recommends its newer n8n-cli package commands for moving workflows between instances and plans to deprecate the server-CLI export/import, though no date is set. Import from URL takes any raw JSON URL — the workflow files in our GitHub mirror can be imported that way.

Full walkthrough of the menus: how to import an n8n template. Want the node layouts before you install anything? Browse the n8n workflow examples.

Sources and last verified

Every command and number on this page was copied from these pages on 4 September 2026. n8n changes install instructions often (the npm path is being retired with 3.0) — if the docs and this page disagree, follow the docs and tell us at support@flowtemplates.app.

Frequently asked questions

Is self-hosted n8n free?

Yes. Without a license key n8n runs as the free Community edition, which the docs say includes almost the complete feature set. It leaves out custom variables, environments, external secrets, external binary-data storage, log streaming, multi-main mode, projects, SSO, workflow and credential sharing, and Git version control — those need a paid Business or Enterprise license.

What do I need to self-host n8n?

Docker Engine with Docker Compose v2 on Linux or macOS (Windows through WSL), and for the current Compose stack at least 4 GB of RAM and 2 vCPUs. n8n also lists the skills it expects: configuring servers and containers, managing resources and scaling, securing the server, and configuring n8n.

Should I install n8n with npm or Docker?

Docker. The n8n docs mark npm installation as deprecated from n8n 3.0, launching October 2026, after which n8n is distributed only through Docker. Existing npm installs keep working for now; new installs should use the one-line setup or Docker Compose.

How do I update a self-hosted n8n?

One-line installs: run curl -fsSL https://get.n8n.io | sh -s -- --upgrade. Compose installs: docker compose pull, then docker compose down, then docker compose up -d. n8n recommends updating at least once a month and checking the release notes for breaking changes first.

Do webhooks work on a self-hosted n8n?

Yes, but a webhook trigger fired by an outside service (Stripe, GitHub, a form) needs your instance to be reachable from the internet. The tunnel the docs describe is for local development and testing only, not production; for a real deployment put n8n behind a reverse proxy and configure the webhook URL as the docs describe.

When is n8n Cloud the better choice?

n8n’s own decision table says Cloud when you want to start right away, lack technical expertise, or do not want to manage infrastructure; self-hosted when you need full control, have the infrastructure and skills, or want to run n8n for free. In money terms, Starter (20€/month) and Pro (50€/month) cover up to 10,000 executions; above that you are running a server either way.

How do I import a Flow Templates workflow into my self-hosted instance?

Exactly as on n8n Cloud: click Copy JSON on the template page and paste onto an empty canvas with Ctrl/Cmd+V, or download the .json and use the workflow menu → Import from File. The five verified n8n templates on this site need no credentials, so they run on a fresh instance without connecting any account.