Free credit available Limited time

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.

Launch n8n with Postgres

The template deploys in about five minutes.

+$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.

One-click template (live today). n8n 2.10.2 with its own PostgreSQL 16.

n8n Postgres requirements

What n8n Postgres needs, and what we already provide.

What n8n Postgres needsRequirement
n8n2.10.2, pinned, with its task runner
DatabasePostgreSQL 16 in its own container
Containers3
MemoryA 4 GB server at minimum; smaller sizes are refused at deploy
Disk40 GB on the 4 GB size, shared by n8n and Postgres
Not configuredSMTP, queue mode, community nodes, external secrets
What we provideDetail
LocationsFalkenstein, Nuremberg, Helsinki, Ashburn, Hillsboro, Singapore
TLSA Let's Encrypt certificate per hostname, renewed for you
BackupsA daily whole-server image, last 7 kept, optional
MetricsHost CPU and memory in the console
AccessRoot SSH with your own key
AI controlMCP 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.

ComponentVersionWhat it does
n8nn8nio/n8n:2.10.2Editor, workflow engine and webhook endpoints, behind HTTPS
Task runnern8nio/runners:2.10.2Runs Code node JavaScript and Python, five at a time
PostgreSQLpostgres:16-alpineWorkflows, execution history and credential records
Volumesn8n-data, postgresql-datan8n'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 doOn this template
Write a compose file for n8n and PostgresThree containers, declared and started together
Set DB_TYPE and the DB_POSTGRESDB_* variablesSet before the first boot
Point n8n at the database container, not localhostAlready wired to the database container
Choose a database passwordGenerated for this deployment
Generate N8N_ENCRYPTION_KEY and never lose itPinned as a platform secret
Swap :latest for a real versionn8n 2.10.2 and Postgres 16, pinned
Keep port 5432 off the internetThe server firewall opens only 22, 80 and 443
Put HTTPS and a proxy in frontA Let's Encrypt certificate, with N8N_PROXY_HOPS=1 set
Make webhook URLs match your domainWEBHOOK_URL, N8N_EDITOR_BASE_URL and N8N_HOST follow the live domain
Stop Code nodes reading server secretsN8N_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 runYou run
The server, its firewall and its HTTPS certificatesn8n itself: workflows, credentials and users
The three containers, on the versions they were pinned toWhen to move to a newer n8n or Postgres
Daily whole-server backups, if you switch them onYour own pg_dump copies, kept off the server
Host CPU and memory metrics in the consolePostgres tuning, indexes and pruning settings
Root SSH for the key you addA 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 serverFits
n8n Postgres on its ownYes, with room for more light apps
n8n Postgres plus one heavy appYes
Light apps onlyUp 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.

ServerRAM, cores, diskWhereRateAbout a month
cx23 (recommended)4 GB, 2 cores, 40 GBEurope$0.02/hr$15
cpx21 (twice the disk)4 GB, 3 cores, 80 GBEurope$0.04/hr$26
cpx214 GB, 3 cores, 80 GBSingapore$0.07/hr$51
cpx214 GB, 3 cores, 80 GBUS$0.12/hr$88
cx33 (one size up)8 GB, 4 cores, 80 GBEurope$0.03/hr$23

Monthly figures assume 730 hours. Hourly rates as displayed in the console, September 2026.

What else you pay forCost
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
BackupsOptional, +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.

Sizing sheet

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.

MethodWhat it coversWhere it lives
Daily server backup (optional, +20%)n8n, Postgres and both volumes in one image, last 7 keptWith the server
pg_dump over root SSHWorkflows, execution history and credential recordsWherever you copy it
n8n's CLI exportWorkflows and credentials as filesWherever 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?
Self hosted n8n uses SQLite unless you configure Postgres, and n8n Cloud runs SQLite on its Starter and Pro plans too, keeping Postgres for Enterprise Scaling. This template configures Postgres from the start, so workflows, executions and credential records go into PostgreSQL 16 rather than a single file on disk.
Is this the same as the n8n Postgres node?
No. The Postgres node is a step inside a workflow that reads from or writes to a database you point it at. This page is about where n8n keeps its own data. The two work together: an instance running on Postgres can still use the node against any other Postgres database you own.
Do I need to create the n8n database and user myself?
No. The Postgres container starts with n8n's database, user and password already in place, all generated for this deployment. On a server of your own, n8n's docs have you create the database, grant the user its privileges and write the password into n8n's settings before the first start.
Which Postgres schema does n8n use?
n8n uses the public schema unless DB_POSTGRESDB_SCHEMA says otherwise, and this template leaves it at public. You never create the tables yourself: n8n runs its migrations against that schema every time it starts, adding whatever tables and columns a new version needs.
Where does n8n keep credentials when it runs on Postgres?
The credential records sit in Postgres, encrypted. The key that decrypts them does not: n8n keeps it in its own data volume, and we pin it as a platform secret on this template. That is why a redeploy keeps every saved API key and OAuth token working.
What does the n8n error SQLITE_FULL, database or disk is full, mean?
The disk holding n8n's SQLite file has run out of space, usually because execution history grew. n8n prunes old runs by default, but a SQLite file keeps its size until it is vacuumed. Clearing space fixes the error. On Postgres, the space pruned runs leave behind is reused for new ones.
How much disk does n8n with Postgres get?
The 4 GB server comes with 40 GB of fixed disk, shared by n8n, Postgres and anything else in the project. It does not grow, so if you keep long execution history, the 4 GB cpx21 with 80 GB is the better start. n8n's default pruning keeps the newest 10,000 runs.
Can I move my SQLite n8n to Postgres?
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 they do not travel inside workflow files. Delete the SQLite service once everything runs.

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.

n8n Postgres, minus the compose file.

PostgreSQL 16 connected before the first boot
The encryption key pinned across redeploys
One server bill, nothing extra for the template
Launch n8n with Postgres