Self-Host n8n: Keep Automation Data on Your Server
Yes, you can keep n8n automation data entirely on your own server by self-hosting the n8n application. You download the open-source n8n software, run it on your own hardware or cloud VM, and all workflow definitions, credentials, and execution logs stay within your infrastructure—nothing is sent to n8n’s cloud unless you explicitly choose their hosted service.
Background: n8n’s Two Deployment Models
n8n offers two primary ways to use its automation platform. The first is n8n Cloud, a paid software-as-a-service where n8n hosts everything for you. The second is self-hosted n8n, where you run the software yourself. Self-hosting is possible because n8n is open-source (under the Sustainable Use License, which restricts certain commercial uses but allows personal and internal business use). The self-hosted version is free to download, and you only pay for the infrastructure you run it on. This distinction matters because it directly answers the data-location question: with n8n Cloud, your data lives on n8n’s servers; with self-hosting, it lives on yours.
How Self-Hosting n8n Works
n8n is a Node.js application, and the official distribution is a Docker image. To self-host, you set up a server (a local machine, a VPS, or a cloud instance) and run the n8n container. The software stores three types of data: workflow definitions (the nodes and connections you build), credentials (API keys and passwords for the services you connect to), and execution data (the records of each time a workflow runs). By default, n8n uses an embedded SQLite database for this storage, but you can configure it to use PostgreSQL or MySQL for more demanding setups. All of this data is written to your server’s storage—either a local disk or a mounted volume—so you control backups, access, and retention.
What Data Stays on Your Server vs. What Goes Out
Even when self-hosted, n8n is not a hermetically sealed system. Your workflows connect to external services (Gmail, Slack, Stripe, etc.) via their APIs, so the data that flows through those connections necessarily leaves your server to reach those services. For example, if you build a workflow that reads emails from Gmail and posts them to Slack, n8n fetches the email content from Gmail’s servers and then sends it to Slack’s servers. What stays on your server is the metadata—the workflow logic, the connection credentials, and the execution logs that record what happened during each run. This is a crucial distinction: self-hosting n8n keeps the automation platform’s data local, but it does not prevent your integrations from sending data to third-party services. If your goal is to keep data entirely within your network, you must also choose which external services you connect to and what data you pass to them.
How to Choose: Self-Hosted vs. Cloud
Deciding between self-hosted n8n and n8n Cloud depends on your priorities. Choose self-hosting if you have any of these needs:
- Data sovereignty: You must keep workflow data within your own jurisdiction or network for compliance or privacy reasons.
- Cost control: You want to avoid per-execution or per-seat pricing and instead pay a flat rate for your own server.
- Customization: You want to modify n8n’s source code or integrate it deeply with your own infrastructure.
- Offline operation: You need automation to run even if your internet connection to n8n’s cloud is down.
Choose n8n Cloud if you prefer not to manage servers, want automatic updates and backups, and need official support. Cloud is simpler but gives you less control over data location and costs more at scale.
Common Problems and Solutions
Self-hosting n8n comes with a few recurring challenges. Here are the most common ones and how to address them:
- Upgrades: n8n releases frequent updates. If you don’t upgrade, you miss security patches and new features. Use the official Docker image and read the upgrade notes before pulling a new version, as some releases require database migrations.
- Backups: Your data lives on your server, so you must back it up yourself. The simplest approach is to back up the database file (SQLite) or the PostgreSQL dump, plus your
.envconfiguration file. Test your backups regularly. - Security: Since you control the server, you are responsible for securing it. Put n8n behind a reverse proxy with HTTPS, enable authentication (set
N8N_BASIC_AUTH_ACTIVE=trueand a strong password), and keep the server’s operating system patched. - Scaling: The default SQLite setup works for small to medium workloads. If you have many workflows or high execution volumes, switch to PostgreSQL and consider running multiple n8n instances behind a load balancer, sharing the same database.
Costs of Self-Hosting n8n
Self-hosting n8n is free in terms of software licensing, but you pay for infrastructure. A small VPS with 1–2 GB of RAM can run n8n for light use, costing roughly $5–$20 per month depending on the provider. For heavier workloads, you might need 4–8 GB of RAM and more CPU, which could cost $40–$100 per month. You also need to factor in the time you spend on maintenance: updates, monitoring, backups, and troubleshooting. If you value your time highly, the cloud version might be more cost-effective, even though its monthly fee is higher. Compare the total cost of ownership, not just the sticker price.
Safety and Security Considerations
When you self-host n8n, you take on the security responsibilities that a cloud provider would otherwise handle. Here are the essential steps to protect your data:
- Run n8n as a non-root user inside the container, and never expose the server’s SSH port to the public internet.
- Use a firewall to restrict access to ports 22 (SSH) and 5678 (n8n’s default port) to only the IPs you trust.
- Set up a reverse proxy (like Nginx or Caddy) with a valid SSL certificate so all traffic is encrypted in transit.
- Enable n8n’s built-in basic authentication or integrate with an external SSO provider.
- Store credentials securely: n8n encrypts them at rest using a key you provide via the
N8N_ENCRYPTION_KEYenvironment variable. Keep this key safe and back it up—if you lose it, you cannot decrypt your stored credentials. - Regularly update the n8n container and the host OS to patch known vulnerabilities.
Remember that your workflows may contain sensitive data in environment variables or in the workflow code itself. Treat your server as you would any production system.
Alternatives to Self-Hosting n8n
If self-hosting n8n feels too heavy, there are other ways to keep automation data on your own infrastructure. n8n’s desktop app runs locally on your machine, but it’s meant for development, not production. Node-RED is another open-source automation tool that is also self-hosted and uses a flow-based editor; it has a different licensing model (Apache 2.0) and a larger library of community nodes. Huginn is a self-hosted agent that focuses on monitoring and reacting to events. If you want a fully managed solution with on-premises deployment, some enterprise automation platforms like Apache Airflow or Prefect can be self-hosted, but they are more oriented toward data pipelines than API integrations. Each has its own learning curve and ecosystem, so the right choice depends on your technical comfort and the complexity of your automations.
Frequently Asked Questions
Does self-hosted n8n send any data to n8n’s servers?
No, by default the self-hosted n8n does not send workflow data, credentials, or execution logs to n8n’s cloud. The only exception is if you explicitly enable telemetry or use n8n’s built-in templates library, which fetches workflow templates from n8n’s servers. You can disable telemetry by setting N8N_DIAGNOSTICS_ENABLED=false in your environment variables.
Can I use n8n without Docker?
Yes, you can run n8n directly from npm (npm install n8n -g) on a Node.js server, but Docker is the officially recommended and easiest method because it bundles all dependencies and simplifies upgrades. If you run it without Docker, you’ll need to manage Node.js versions and system packages yourself.
What database does n8n use by default?
By default, n8n uses SQLite, a file-based database that requires no separate server. For production use with higher concurrency, you can switch to PostgreSQL or MySQL by setting the DB_TYPE environment variable and providing connection details.
Can I migrate from n8n Cloud to self-hosted?
Yes, you can export your workflows from n8n Cloud as JSON files and import them into a self-hosted instance. However, you will need to re-enter credentials, as they are not exported for security reasons. The process is straightforward: in the workflow editor, use the export option, then import the file in your self-hosted instance.
Is self-hosting n8n free for commercial use?
The n8n Sustainable Use License allows free use for internal business purposes, but it restricts offering n8n as a hosted service to third parties without a separate agreement. If you plan to sell n8n-based services, you should review the license terms or contact n8n for a commercial license.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.