Skip to content
← All apps

n8n

Create automation workflows and connect services with persistent encrypted credentials.

Choose your deployment and the way you want to use Selfhost. The instructions below follow that choice.

Set up n8n

One persistent container for a small instance.

  • Choose a single SQLite container for a small instance or a PostgreSQL stack for a separate database. Preserve N8N_ENCRYPTION_KEY with the data and database backups.
  • Run Initial setup to create the owner email, first name, last name and password. The action is available only while n8n advertises its first-owner setup state.
selfhost app --directory ./n8n init n8n --method sqlite

Initialization writes portable files and does not start the app. Review compose.yaml, the private .env and any files in files/, then start it:

selfhost app --directory ./n8n start

No Selfhost dashboard or background service is needed. You can also start these files directly:

cd n8n
docker compose -f compose.yaml up -d

Before configuring integrations

  • Native settings include editor and webhook URLs, proxy hops, cookies, SMTP, execution retention, metrics, database and community packages.
  • For HTTPS exposure, set the editor and webhook public URLs, secure cookies and the exact trusted proxy hop count. The initial loopback deployment permits HTTP cookies for local access.
  • List workflows and export workflows operate through the native CLI. Export credentials preserves encryption and needs the original encryption key to restore them. Exports stay in the persistent application directory.
  • Native SSO options depend on the n8n edition and license. This profile does not advertise a free OIDC integration or bypass n8n licensing.
  • Workflow credentials and service permissions are configured inside n8n. Exporting workflow definitions does not by itself export all execution history or the database.
  • Changing SQLite to PostgreSQL is a data migration, not an environment-only switch. Export and migrate with the upstream procedure before selecting the new database.

n8n integrations

Compose service: n8n. These operations use the profile saved when this deployment is created.

Initialize and connect

Supported setup modes: bootstrap.

  • Creates the first owner only. Configure public URLs and HTTPS cookies before exposing this instance.
Setup fields
Owner email email
string · requiredLength: 1 to 255 characters
First name first-name
string · requiredLength: 1 to 255 characters
Last name last-name
string · requiredLength: 1 to 255 characters
Owner password password
secret · requiredLength: 12 to 255 characters

Save onboarding.json, replace example values and supply env: secrets privately through your shell. Empty apps adds no links; add explicit links when this profile supports them.

{
  "mode": "bootstrap",
  "inputs": {
    "email": "YOUR_VALUE",
    "first-name": "YOUR_VALUE",
    "last-name": "YOUR_VALUE",
    "password": "env:SELFHOST_PASSWORD"
  },
  "apps": []
}
selfhost app --directory ./n8n setup n8n
selfhost app --directory ./n8n setup-plan n8n onboarding.json
selfhost app --directory ./n8n setup-apply n8n onboarding.json --revision REVIEWED_REVISION

Setup modes, secret references and recovery

Native settings

Changes use the app’s Compose environment. Unrelated settings are preserved.

Supported fields (30)
Public editor URL editor-url
string
Public webhook URL webhook-url
string
Hostname hostname
string
Public protocol protocol
stringChoices: http, https
HTTPS-only session cookie secure-cookie
stringChoices: true, false
Trusted proxy hops proxy-hops
string · advanced
Workflow timezone timezone
string
Database type database-type
string · advancedChoices: sqlite, postgresdb
PostgreSQL host database-host
string · advanced
PostgreSQL port database-port
string · advanced
PostgreSQL database database-name
string · advanced
PostgreSQL username database-user
string · advanced
PostgreSQL password database-password
secret · advanced
Prune execution history execution-prune
stringChoices: true, false
Execution retention in hours execution-age
string
Maximum stored executions execution-limit
string
Workflow timeout in seconds execution-timeout
string · advanced
Prometheus metrics metrics
stringChoices: true, false
Log level log-level
stringChoices: error, warn, info, debug
SMTP host smtp-host
string
SMTP port smtp-port
string
SMTP username smtp-user
string
SMTP password smtp-password
secret
SMTP sender smtp-sender
string
SMTP TLS smtp-ssl
stringChoices: true, false
Disable public API api-disabled
stringChoices: true, false
Allow community packages community-packages
string · advancedChoices: true, false
Database TLS database-tls
string · advancedChoices: true, false
Verify database certificate database-verify-certificate
string · advancedChoices: true, false
Database CA certificate database-ca
secret · advanced

Save a JSON map of the field IDs you want to change as changes.json. Replace FIELD_ID with an ID from the supported fields above, and use its declared value type. Review the plan and replace REVIEWED_REVISION with the revision it returns.

{
  "FIELD_ID": "YOUR_VALUE"
}
selfhost app --directory ./n8n config n8n
selfhost app --directory ./n8n plan n8n changes.json
selfhost app --directory ./n8n apply n8n changes.json --revision REVIEWED_REVISION

Saved changes need service recreation to become active. Existing interpolated environment values stay under your control in .env or Compose.

Database placement

This recipe supports postgres. Workspace projects can choose a dedicated database, a shared source with a separate database and account, or an existing external database before their first start.

Standalone directories use the generated Compose and environment files directly. Configure the database there before first start. Selfhost’s source provisioning commands belong to workspace projects and are optional.

Database setup, CLI commands and backups

App actions

List workflows

List workflows stored in this instance.

selfhost app --directory ./n8n action n8n list-workflows
Export workflows · schedulable

Export all workflows into the persistent data volume. Exports may contain credentials embedded in workflow parameters.

selfhost app --directory ./n8n action n8n export-workflows

A workspace can schedule this workflow while Selfhost runs. A standalone user can invoke it through an external scheduler. Scheduling guide.

Export encrypted credentials

Export credentials encrypted with the instance encryption key. Back up that key separately.

selfhost app --directory ./n8n action n8n export-credentials
Show version

Show the running n8n version.

selfhost app --directory ./n8n action n8n version

App configuration reference

Versions and updates

This deployment uses the following images. Existing projects retain their saved recipe and images. A new catalogue version does not silently update them.

  • n8n: docker.n8n.io/n8nio/n8n:2.40.7
  • 2.40.7 docker.n8n.io/n8nio/n8n:2.40.7

    Local SQLite and PostgreSQL deployments passed native owner setup, owner authentication, workflow creation and export, native settings and persistent recreation. Upstream SSO licensing applies. PostgreSQL credential export was verified to remain encrypted, and the native workflow table was verified in PostgreSQL.

Review compatibility and back up app data before an update. Choose an image version and review the change.

Keep control of your setup

Selfhost remains optional. Your app runs using ordinary Compose files, its own settings and persistent data. Keep the Compose project name and volumes to preserve storage. Configuration exports and setting backups do not include application data.

Standalone CLI guide · Backups and removal · n8n documentation

Built by Obiente. Your services, your configuration.