n8n is the open-source workflow automation tool that a lot of people reach for when Zapier or Make starts getting expensive. The catch, and the appeal, is that you can self-host it, which gives you unlimited workflows and full control over your data for the cost of a small server. The only real question is where and how to run it. This guide walks through the best ways to self-host n8n in 2026, from a one-click deploy to running it yourself on a VPS, with the setup steps and gotchas that actually matter.

Quick verdict
The easiest way to self-host n8n is a one-click deploy on Railway, which runs it 24/7 with a database and a public URL and no server to manage. If you want full control or a fixed monthly bill, run n8n in Docker on a VPS like Cloudways or Hostinger.
Ways to self-host n8n at a glance
| Method | Best for | Difficulty | Cost |
|---|---|---|---|
| Railway (one-click) | Easiest, runs 24/7 | Very easy | From ~$5/mo |
| Docker on a VPS | Full control, fixed cost | Moderate | From ~$6/mo |
| Docker Compose | n8n plus Postgres, self-managed | Moderate | VPS cost |
| npm (local) | Testing only | Easy | Free |
Self-host n8n on Railway in minutes
Deploy n8n from a template, get a database and a public URL automatically, and keep it running 24/7 with no server to manage. The fastest way to self-host n8n.
Why self-host n8n?
n8n offers a cloud version, so why run it yourself? A few reasons make self-hosting the popular choice.
Cost at scale. n8n’s self-hosted Community Edition is free software, so you pay only for the server it runs on. Once you are running a lot of workflows or high execution volumes, a few dollars a month of hosting beats per-task pricing by a wide margin, which is exactly why people migrate from Zapier and Make.
Data control and privacy. Self-hosting keeps your workflows and the data flowing through them in your own environment, which matters for sensitive integrations and compliance.
No limits. You are not capped on workflows, executions, or steps by a pricing tier. The only limit is your server’s resources.
The trade-off is that you own the setup and maintenance. The methods below range from almost no maintenance to fully hands-on, so you can pick the balance that suits you. If you are still deciding between self-hosting and a cloud tool, our n8n vs Zapier comparison covers the bigger picture.
1. Railway: The Easiest Way to Self-Host n8n
If you want n8n running reliably without becoming a part-time sysadmin, Railway is the simplest path, and it is what we recommend to most people.
Why it is the easy button
Railway has an n8n template, so deploying is close to one click: pick the template, and it provisions n8n along with a Postgres database, sets the connection variables, and gives your instance a public HTTPS URL automatically. That public URL matters, because n8n needs one for webhooks and for OAuth integrations to work, and on many VPS setups you have to configure that yourself. Railway also keeps n8n running continuously and does not sleep it, so your scheduled workflows and webhooks fire reliably around the clock.
Setup and cost
The whole process takes a few minutes: deploy the template, set an encryption key and a couple of environment variables when prompted, open the URL, and create your owner account. Because Railway uses usage-based pricing, a typical n8n instance runs from around the $5 Hobby plan upward depending on how much it does, and it scales if your automation grows. The trade-off versus a fixed VPS is that a very busy instance has a less predictable bill, but for most self-hosters the simplicity and reliability are well worth it.
Pros
- One-click template with database included
- Public HTTPS URL set up automatically for webhooks
- Runs 24/7, no server to manage
- Scales as your automation grows
Cons
- Usage-based billing is less predictable than a flat VPS
- Less low-level control than your own server
Get n8n running on Railway
A one-click template with Postgres and a public URL, running 24/7 with nothing to maintain. The simplest way to self-host n8n.
2. Docker on a VPS: Full Control and Fixed Cost
If you want a predictable monthly bill, full control, or to run n8n alongside other services, hosting it in Docker on a VPS is the classic approach. Cloudways gives you a managed cloud server without the administration overhead, and Hostinger offers inexpensive VPS plans if you are comfortable on the command line.
The basic setup
You spin up a VPS, install Docker, and run the official n8n image, mapping a volume so your workflows persist across restarts and setting environment variables for your encryption key and host details. To make webhooks and OAuth work, you point a domain or subdomain at the server and put n8n behind a reverse proxy like Nginx or Caddy with HTTPS, which is the part that takes the most effort. A process or the Docker restart policy keeps n8n alive if the server reboots.
Trade-offs
A VPS gives you a flat cost, often around $6 to $12 a month, complete control, and room to run n8n plus a database and other apps on one box. The downside is that you own everything: the reverse proxy, HTTPS certificates, updates, and backups are yours to manage. For someone comfortable with a server it is cost-effective and flexible, but it is more work than a managed deploy. For production use, pair it with Postgres rather than the default SQLite, which the next method makes easy.
Pros
- Predictable flat monthly cost
- Full control, run other services too
- Always on, no sleeping
Cons
- You configure the reverse proxy, HTTPS, and backups
- More setup and maintenance than a managed deploy
3. Docker Compose: n8n Plus Postgres
For a production-grade self-hosted setup, Docker Compose lets you run n8n and a Postgres database together with a single configuration file. This is the recommended pattern once you move past testing, because the default SQLite database is fine for light use but Postgres handles concurrent executions and larger workflow histories far better.
You write a compose file defining two services, n8n and Postgres, with a shared network, persistent volumes for both, and environment variables wiring n8n to the database and setting your encryption key and host. Then a single command brings the whole stack up. It runs on the same VPS as method two, so the hosting choice and the reverse proxy and HTTPS work are the same, but you gain a robust database and a setup that is easy to reproduce and back up. If you are self-hosting n8n for real work, this is the configuration to aim for.
Pros
- Production-grade with Postgres
- Reproducible, easy to back up
- One file defines the whole stack
Cons
- More moving parts than a single container
- Still requires VPS, reverse proxy, and HTTPS setup
4. npm Locally: For Testing Only
You can install n8n directly with npm and run it on your own machine, which is the quickest way to try it out. It is genuinely useful for experimenting with nodes and building a workflow before you deploy. It is not a hosting method, though, because your workflows only run while your computer is on and reachable, so scheduled triggers and webhooks will not fire reliably. Use it to learn and prototype, then deploy to Railway or a VPS for anything you actually depend on.
Pros
- Quickest way to try n8n
- Good for learning and prototyping
Cons
- Not a real hosting method, runs only while your machine is on
- Webhooks and schedules will not fire reliably
Things to get right when self-hosting n8n
Whichever method you choose, a few details make the difference between a setup that works and one that frustrates you.
Set an encryption key. n8n encrypts saved credentials with a key. Set it explicitly through an environment variable and keep it safe, because losing it means losing access to your stored credentials.
Give it a public HTTPS URL. Webhooks and OAuth-based integrations need a reachable HTTPS address. Railway provides one automatically, and on a VPS you set it up with a domain and reverse proxy.
Use Postgres for production. The default SQLite is fine for testing, but Postgres handles concurrency and larger histories much better once you rely on n8n.
Back up your data. Back up the database and your encryption key. With them you can restore or migrate your entire n8n instance.
Frequently asked questions
Is self-hosting n8n free? The n8n Community Edition is free software, so you pay only for the server it runs on. That is typically a few dollars a month on Railway or a VPS, which is why self-hosting is so much cheaper than per-task automation tools at volume.
What is the easiest way to self-host n8n? A one-click deploy on Railway, which provisions n8n with a database and a public URL and keeps it running 24/7 without you managing a server. It is the simplest route for most people.
Do I need a database to self-host n8n? n8n works with its built-in SQLite for light use, but Postgres is strongly recommended for production because it handles concurrent executions and larger histories better. Railway’s template and a Docker Compose setup both make adding Postgres easy.
Why do my n8n webhooks not work when self-hosted? Almost always because n8n does not have a reachable public HTTPS URL configured. Webhooks and OAuth integrations need one. Railway sets this up automatically, while on a VPS you configure a domain and reverse proxy with HTTPS.
How much does it cost to self-host n8n? Usually $5 to $12 a month for the hosting, whether that is Railway’s usage-based pricing or a flat VPS plan. Compared with the per-task pricing of cloud automation tools, it is dramatically cheaper at any real volume.
The bottom line
Self-hosting n8n gives you unlimited workflows and full control over your data for the price of a small server, and the only real decision is how much you want to manage. For most people, a one-click deploy on Railway is the best choice, running n8n 24/7 with a database and a public URL and nothing to maintain. If you want a fixed bill and full control, Docker on a VPS like Cloudways or Hostinger, ideally with Postgres via Docker Compose, is the way to go. Either way, set your encryption key, give it a public HTTPS URL, and back up your data, and you will have a reliable automation engine that costs a fraction of the cloud alternatives.

