Where are n8n workflows stored?
This short guide explains where are n8n workflows stored and how to locate them. In brief, n8n saves workflows in the configured database in production (commonly PostgreSQL). Local or single-user installs can use a file-based database. You can also export workflows as JSON from the UI for backup or migration.
How n8n stores workflows
n8n keeps workflow definitions in persistent storage. The platform uses an ORM and stores workflow rows in the database. Credentials and workflow metadata are also saved alongside workflows. The exact files or tables depend on your database choice and deployment method.
Where are n8n workflows stored in common setups
Docker with PostgreSQL: workflows live in the PostgreSQL database. The data is persisted by mounting the database storage to a Docker volume or external database host.
Docker with SQLite or desktop: workflows are stored in a local SQLite file inside the n8n data directory. This is common for testing or single-user use.
Exported workflows: you can export workflows as JSON from the n8n editor. Exported JSON files are portable and useful for manual backups or version control.
How to export and move workflows
Use the n8n UI to export workflows. Export creates a JSON file you can save externally. To move workflows between instances, import the JSON or restore the database backup. Exports are safest for individual workflows. Full migrations are best done by moving the database or using a managed database snapshot.
Best practices and security
Always back up the database regularly. Use Docker volumes or external managed Postgres to keep data persistent. Set a strong database password and restrict network access.
Enable the credential encryption key in n8n to protect stored credentials. Treat exported JSON files as sensitive data and store them securely.
Summary
Workflows are stored in the configured database by default, with PostgreSQL recommended for production. Local installs may use a file-based database or JSON exports. Keep backups, use Docker volumes for persistence, and secure your database and credentials to protect automation assets.