n8n Postgres, wired before n8n wakes up.
n8n 2.10.2, the workflow automation tool, deploys here with its own PostgreSQL 16 onto a dedicated server Selfhost.dev provisions, secures and runs, across six locations on three continents. A European 4 GB server is $0.02/hr, about $15 a month, with n8n connected to its database before it first starts.
The template deploys in about five minutes.
no signup
+$5.00 added at signup · deployment choice preserved · no card
See the monthly figure for your region before you sign up.
- n8n 2.10.2 with PostgreSQL 16
- Three containers, one click
- Custom domain and SSL, handled
- A European 4 GB server at $0.02/hr
What is n8n Postgres?
Same n8n,
different store.
What it is. n8n, the open source automation tool, storing its workflows and execution history in PostgreSQL instead of a SQLite file. Not to be confused with the Postgres node, which queries your own databases from a workflow.
Who it is for. Teams whose workflows run all day, keep long execution history, or will need queue mode later. Postgres takes many writers at once, where SQLite writes one at a time.
When to use it. Pick it at deploy time when volume is already heavy or growing. For one person running a handful of workflows, the SQLite template does the same job with one fewer container.
n8n Postgres requirements
What n8n Postgres needs, and what we already provide.
| What n8n Postgres needs | Requirement |
|---|---|
| n8n | 2.10.2, pinned, with its task runner |
| Database | PostgreSQL 16 in its own container |
| Containers | 3 |
| Memory | A 4 GB server at minimum; smaller sizes are refused at deploy |
| Disk | 40 GB on the 4 GB size, shared by n8n and Postgres |
| Not configured | SMTP, queue mode, community nodes, external secrets |
| What we provide | Detail |
|---|---|
| Locations | Falkenstein, Nuremberg, Helsinki, Ashburn, Hillsboro, Singapore |
| TLS | A Let's Encrypt certificate per hostname, renewed for you |
| Backups | A daily whole-server image, last 7 kept, optional |
| Metrics | Host CPU and memory in the console |
| Access | Root SSH with your own key |
| AI control | MCP tools to deploy and manage it from an AI assistant |
Specifications current as of September 2026.
What's in the n8n Postgres deployment
Three containers. One click.
Three containers on one project server, each pinned to a version and started together.
| Component | Version | What it does |
|---|---|---|
| n8n | n8nio/n8n:2.10.2 | Editor, workflow engine and webhook endpoints, behind HTTPS |
| Task runner | n8nio/runners:2.10.2 | Runs Code node JavaScript and Python, five at a time |
| PostgreSQL | postgres:16-alpine | Workflows, execution history and credential records |
| Volumes | n8n-data, postgresql-data | n8n's own files, and the database files |
Connected before n8n starts
The template sets DB_TYPE=postgresdb and the connection settings before the first boot, and n8n builds its own tables the first time it starts. There is no database to create and no seed to run.
Your encryption key is not in Postgres
Postgres holds your credential records, but the key that decrypts them sits in n8n's own volume. We pin that key as a platform secret, so every redeploy starts with the same key and your saved API keys keep working.
Execution history lands in Postgres
Every run n8n records goes into the database. n8n prunes old runs by default and keeps up to 10,000, and Postgres reuses the space those deletions free, where a SQLite file keeps its size until it is vacuumed.
What we set up for you
The compose file, already running.
Every n8n and Postgres tutorial ends in the same compose file. Here it is already running, with the parts copied versions leave out already set.
| What a tutorial has you do | On this template |
|---|---|
| Write a compose file for n8n and Postgres | Three containers, declared and started together |
Set DB_TYPE and the DB_POSTGRESDB_* variables | Set before the first boot |
Point n8n at the database container, not localhost | Already wired to the database container |
| Choose a database password | Generated for this deployment |
Generate N8N_ENCRYPTION_KEY and never lose it | Pinned as a platform secret |
Swap :latest for a real version | n8n 2.10.2 and Postgres 16, pinned |
| Keep port 5432 off the internet | The server firewall opens only 22, 80 and 443 |
| Put HTTPS and a proxy in front | A Let's Encrypt certificate, with N8N_PROXY_HOPS=1 set |
| Make webhook URLs match your domain | WEBHOOK_URL, N8N_EDITOR_BASE_URL and N8N_HOST follow the live domain |
| Stop Code nodes reading server secrets | N8N_BLOCK_ENV_ACCESS_IN_NODE=true |
The example most guides copy publishes Postgres on port 5432 and sets no encryption key. On a server of your own, those are the first two things to fix.
How to run n8n with Postgres in 4 steps
From zero to live.
No server to set up.
Four steps, and none of them is a compose file.
1. Open the template
The Launch button opens the console on this exact template. Choose a server size and one of six locations.
2. Launch it
The console shows each provisioning stage, and the template deploys in about five minutes onto a generated HTTPS address.
3. Claim the owner account
Open the address and create the owner account straight away. That first account runs the instance.
4. Build or import
Create your first workflow, or import one as JSON. Every run it records from now on lands in Postgres.
What we run and what you run
On your n8n Postgres server.
| We run | You run |
|---|---|
| The server, its firewall and its HTTPS certificates | n8n itself: workflows, credentials and users |
| The three containers, on the versions they were pinned to | When to move to a newer n8n or Postgres |
| Daily whole-server backups, if you switch them on | Your own pg_dump copies, kept off the server |
| Host CPU and memory metrics in the console | Postgres tuning, indexes and pruning settings |
| Root SSH for the key you add | A mail provider for n8n's invites and resets |
What a 4 GB server handles
For n8n and its database.
The whole template counts as one light workload. The task runner executes five Code steps at once, and the server size, not a plan, sets the ceiling.
| On one 4 GB server | Fits |
|---|---|
| n8n Postgres on its own | Yes, with room for more light apps |
| n8n Postgres plus one heavy app | Yes |
| Light apps only | Up to 5 workloads |
Need more room? An 8 GB server takes three heavy apps plus one light, or any lighter mix.
What n8n Postgres costs to run
Postgres adds a container, not a fee.
You pay for the server by the hour, and the rate depends on where it runs.
| Server | RAM, cores, disk | Where | Rate | About a month |
|---|---|---|---|---|
cx23 (recommended) | 4 GB, 2 cores, 40 GB | Europe | $0.02/hr | $15 |
cpx21 (twice the disk) | 4 GB, 3 cores, 80 GB | Europe | $0.04/hr | $26 |
cpx21 | 4 GB, 3 cores, 80 GB | Singapore | $0.07/hr | $51 |
cpx21 | 4 GB, 3 cores, 80 GB | US | $0.12/hr | $88 |
cx33 (one size up) | 8 GB, 4 cores, 80 GB | Europe | $0.03/hr | $23 |
Monthly figures assume 730 hours. Hourly rates as displayed in the console, September 2026.
| What else you pay for | Cost |
|---|---|
| n8n, the task runner and the Postgres container | $0 |
| HTTPS and a custom domain | $0 |
| Users and seats | $0 |
| Bandwidth | $0, no traffic metering on a template project |
| Backups | Optional, +20% of the server rate |
If your balance reaches zero
A server with a card on file or a past top-up is powered off first and held for 24 hours, and adding credit in that window starts it again. Welcome-credit-only servers are deleted at zero, and backups go with the server.
Price another size or region in the calculator, no signup.
What every n8n Postgres deployment gets
Five commitments, all of them built into the platform.
- Every service is health-checked every 60 seconds.
- A stalled deploy is retried automatically, not abandoned.
- A deploy is never reported done until the URL actually answers.
- Retrying a create never leaves you paying for two copies.
- Your version never moves on its own.
The n8n Postgres template deploys in about five minutes. That is the platform's own budget, not an estimate.
Not sure you need Postgres yet?
Tell us how many executions you run a day and how long you keep history. We reply with the database we would pick, the server size and the monthly cost.
When the SQLite template is the better choice
One case for the other template.
For one person running a few workflows a day with short history, self hosted n8n on SQLite is the simpler machine: two containers, one volume, the same server price. Postgres earns its extra container when several workflows write at once, history runs long, or queue mode is on the roadmap.
n8n Postgres limitations
What this does not do.
- Postgres, but no queue mode. Postgres is the database queue mode needs, yet spreading work across machines also takes Redis and worker containers, which this template does not run.
- One disk for both. n8n and Postgres share the server's fixed disk, 40 GB on the 4 GB size, and it does not grow. The 80 GB cpx21 doubles it.
- Not a Managed Database. The bundled Postgres has no point in time recovery, pooling or Multi-AZ. Those come with Selfhost.dev Managed PostgreSQL, a separate product.
- Five Code executions at once. The task runner is capped at five concurrent.
- Claim the owner account straight away. Whoever opens the address first becomes the owner, and n8n leaves that form open until someone does.
- Email needs a provider. Invites and password resets wait until you add SMTP in n8n's settings.
- Community nodes and external secrets are off. Neither is configured on this template.
- Version moves are yours. We never change your n8n or Postgres version; moving to a newer one is your call.
n8n Postgres backup and restore
A daily image, and your own dumps.
Two ways to keep n8n and its database safe: a daily image of the whole server, and your own Postgres dumps over SSH.
| Method | What it covers | Where it lives |
|---|---|---|
| Daily server backup (optional, +20%) | n8n, Postgres and both volumes in one image, last 7 kept | With the server |
pg_dump over root SSH | Workflows, execution history and credential records | Wherever you copy it |
| n8n's CLI export | Workflows and credentials as files | Wherever you copy it |
Dump the database
Add your SSH key to the project, then run docker exec <db-container> pg_dump -U <user> <database> > n8n.sql on the server.
One thing to know about dumps
A dump restores cleanly into this deployment. Restored anywhere else, its credentials need this deployment's encryption key, so export credentials with n8n's CLI as well.
Moving n8n from SQLite to Postgres
Workflows as JSON, credentials by hand.
Start fresh on this template. Export your workflows as JSON from the n8n editor, import them into the new instance and add your credentials again. Credentials are encrypted with the old instance's key, which is why workflow files leave them behind.
Frequently asked questions
Which database does n8n use, SQLite or Postgres?
Is this the same as the n8n Postgres node?
Do I need to create the n8n database and user myself?
Which Postgres schema does n8n use?
Where does n8n keep credentials when it runs on Postgres?
What does the n8n error SQLITE_FULL, database or disk is full, mean?
How much disk does n8n with Postgres get?
Can I move my SQLite n8n to Postgres?
About Selfhost.dev
Selfhost.dev is a managed self hosting platform for developers and small teams. Open-source apps and databases on dedicated servers you control, billed by the hour with no subscription tiers.
Best for: n8n, Twenty CRM, Supabase and managed PostgreSQL, MySQL, Redis, ClickHouse, OpenSearch and Kafka.