logo

How I Built a Portable Local Development Environment for n8n Using Docker and ngrok

As someone who relies on n8n for workflow automation, I’ve been running a paid cloud-hosted instance for production workflows. It’s stable, simple to manage, and the hosted tier works well for day-to-day operations.

But when it came to developing and testing new automations locally, I ran into a few roadblocks:

  • Limited active workflows and execution quotas on the hosted plan
  • No real way to test webhooks or long-running flows in a safe, private environment
  • Repeatedly toggling workflows on/off to avoid hitting usage limits during development

I needed something more flexible.


🎯 What I Wanted

For local development, my goals were clear:

  • Unlimited executions and active workflows
  • HTTPS-accessible webhooks (so I could test integrations with services like Stripe, Slack, or GitHub)
  • A stack that’s lightweight, fast to spin up, and doesn’t require a separate VM
  • Ability to develop locally, then export to production on the hosted n8n instance

🛠️ The Solution: Docker + ngrok

I created a small, self-contained environment using:

  • Docker Compose to orchestrate an n8n instance and an ngrok tunnel
  • ngrok to expose n8n over HTTPS with a reserved static domain
  • A clean .env config that lets me run this on any machine with minimal setup

🔗 Check out the GitHub repo

This gives me:

  • A local n8n instance with full functionality
  • Basic authentication for security
  • Public HTTPS webhook URLs thanks to ngrok
  • A setup I can spin up or shut down in seconds

📦 What’s in the Stack?

The core is a docker-compose.yml file that defines two services:

  1. n8n — the workflow engine itself, running in a container
  2. ngrok — a tunneling service that exposes the local n8n server to the internet with HTTPS

Everything is driven by a .env file, making it easy to keep secrets out of version control and configure per-machine if needed.


🚀 Workflow: Local → Cloud

I now:

  • Build and test all workflows locally, where I have unlimited executions
  • Export finished workflows using n8n’s JSON export/import
  • Deploy to the hosted n8n environment when I’m ready for production

This means I get the best of both worlds:

  • Full power and control during development
  • The simplicity and reliability of managed hosting for production

🧩 Bonus: Why This Works So Well

  • ngrok static domains make webhooks stable, even across restarts
  • I avoid exceeding quotas on the hosted plan while prototyping
  • I can version control workflows locally
  • The stack is portable and reproducible — perfect for remote dev or CI environments

✅ TL;DR

If you're using n8n cloud but want a better local dev experience, this setup gives you:

  • Unlimited, secure local development
  • Public HTTPS webhook access
  • Simple, one-command startup
  • Easy migration of workflows to production

You can check out the full repo and setup instructions here: 👉 https://github.com/ptylr/n8n-local-dev-ngrok