I wanted a self-hosted n8n that costs nothing to run. n8n is built for a server that stays on, with a database and background processes. Vercel is built for short-lived functions. That looked like a bad match, so I tried it as an experiment.
It works, with limits. This post covers how, what I tested, and what doesn't work.
Repo: https://github.com/muhammad-zulqarnain-awan/n8n-on-vercel
This is a hobby project for personal, non-commercial use. n8n's license and Vercel's Hobby plan both require that. Deploy your own copy; don't share or sell access to an instance.
The idea
One Vercel function sits in front of n8n:
-
vercel.jsonrewrites every URL to a single function. - On the first request, the function starts n8n as a child process on
127.0.0.1. - It waits for n8n's readiness check, then proxies the request to it.
- After 4 minutes without traffic, it stops n8n.
The idle shutdown is the key trick. n8n polls its database every couple of seconds, which would keep a free Neon database awake all month, and an idle process would also burn Vercel's free allowance. Stopping n8n lets Neon scale to zero and keeps the usage small. The next request just starts n8n again.
All state lives in Neon Postgres: workflows, credentials (encrypted), execution history. Nothing important sits on the function's temporary disk, so restarts lose nothing.
The pieces
- A proxy handler that forwards requests (including streaming responses) to the local n8n.
- A supervisor that starts n8n, waits until it's ready, and stops it when idle.
-
A config builder that turns your Neon connection URL and domain into n8n's settings. n8n takes separate
DB_POSTGRESDB_*variables, not a connection string, so the config builder splits the URL for it.
A few n8n settings matter on serverless:
-
N8N_PUSH_BACKEND=sse, because live editor updates work over server-sent events and avoid WebSockets. -
N8N_DEFAULT_BINARY_DATA_MODE=database, because there is no shared disk between function instances. - A small database pool and a slow database ping, to be kind to the free database.
- Community packages disabled, since they would install to a folder that gets wiped.
- A request size limit just under Vercel's, so errors come from n8n rather than from the platform.
What I tested
All of this ran locally against a real Postgres, through the proxy, and the project is now deployed and working on my own domain:
- Owner setup, login and the editor UI
- Production webhooks, including a Code node
- A webhook as the very first request after a cold start: correct response each time
- Form triggers: the form renders and submissions run
- Credentials: saved encrypted, still decrypting after a full restart
- 20 parallel webhook calls: all returned 200
- Idle shutdown: n8n exits cleanly and all database connections close
Locally, a cold boot took about 9 to 10 seconds and about 9.5 CPU-seconds. On Vercel it will differ, so measure your own.
What doesn't work
I want to be upfront about this:
- Schedule and polling triggers are unreliable. They need a process that's always running. On the Hobby plan, cron is at most daily.
- Cold starts: the first request after idle waits for n8n to boot.
- Request bodies over about 4.5 MB are rejected by Vercel.
- Runs are capped at 300 seconds.
- No community nodes and no Python Code node.
- n8n has announced that internal task-runner mode and non-container installs will be removed in future versions, so I pin the version and upgrades are deliberate.
n8n is also a big package, around 2.9 GB installed, about 1.8 GB after excluding source maps, type files and markdown. That needs Vercel's Large Functions feature, which is in beta.
Staying free, and staying legal
Both free tiers have monthly caps, and Vercel Hobby pauses features when you exceed them. Check your Usage page after a week. Close the editor tab when you're done, because an open editor keeps n8n awake.
On licensing: the glue code in the repo is MIT, but n8n is not. It uses a "fair-code" license that covers internal business and personal use, not hosting it for others. And Vercel Hobby is for non-commercial use. So this is for your own projects, not for reselling.
Try it
The README walks through it step by step: generate an encryption key, import the repo into Vercel, create a Neon database from the Storage tab, set two environment variables, add your domain, and run the smoke test script. If you deploy it, I'd love your numbers (cold start time, Vercel usage, anything that broke). Open an issue or a PR.
Things I haven't verified on Vercel yet and would love help with: how a frozen and resumed instance behaves, and whether "respond immediately" webhooks finish their work after replying.
Repo: https://github.com/muhammad-zulqarnain-awan/n8n-on-vercel
Top comments (0)