Okay, I know that sounds like clickbait. I promise it’s not.
I needed a local, self-hosted n8n instance for some development work, and I decided to let Codex handle the setup instead of doing it by hand. From opening the app to having n8n live in my browser — under two minutes.
If you’ve ever set up a local Docker environment before, you know how it usually goes. Read the docs, write the compose file, chase down a port conflict, wonder why nothing’s loading, finally get it working, and then realize you’ve spent an hour on something that was supposed to take ten minutes.
This time was different. Here’s the whole story.
What You Need Before You Start
Codex can do a lot of the heavy lifting, but your machine still needs a few things in place first:
-
Docker Desktop (installed, open, and signed in)
-
Docker Compose
-
Git
-
Node.js and npm
-
Codex for Windows (the desktop app, signed into ChatGPT)
-
Port 5678 available on your machine
Nothing exotic. Most people tinkering with n8n will already have most of this.
One Important Thing About Codex
There are two ways to use Codex — the web version and the desktop app — and they’re not the same thing.
The web version works against GitHub repositories. It’s great for reviewing code, opening pull requests, and working with remote projects. But it can’t create files on your actual computer or run Docker commands locally.
The desktop app is what you want here. It works directly in a folder on your machine, which means it can create files, run commands, and set things up for real.
If you open PowerShell, type codex, and get a “not recognized” error, don’t worry — that just means the CLI isn’t installed. Use the desktop app instead. They accomplish the same thing for our purposes.
Setting Up the Project Folder
I put my project on the D drive to keep things tidy and separate from system files. In PowerShell:
powershell
mkdir D:\projects\n8n-local
cd D:\projects\n8n-local
Then open the Codex desktop app and point it to that folder as your workspace.
Before doing anything else, do a quick sanity check. Ask Codex to create a small test file:
Create a file named test.txt in this folder with the text: n8n local setup test
Then check in PowerShell:
powershell
dir
If test.txt shows up, Codex is working locally in the right place and you’re good to go. If it doesn’t appear, something is off with the workspace — fix that before moving on.
The Prompt That Made It Work
This is the part worth saving. Give Codex clear, specific instructions so it knows exactly what to build — and what to leave out.
You are helping me set up a local self-hosted n8n development environment
on my Windows PC using Docker Desktop.
Current local project folder:
D:\projects\n8n-local
This is only for local development and testing. It is not for public
production hosting.
Please create the following files in this folder:
1. docker-compose.yml
2. .env.example
3. README.md
4. .gitignore
Requirements for docker-compose.yml:
- Use the official n8n Docker image.
- Run n8n locally at http://localhost:5678
- Persist n8n data using a Docker named volume.
- Enable community packages.
- Keep the setup simple and appropriate for local development.
- Do not configure public hosting.
- Do not configure SSL.
- Do not configure a reverse proxy.
- Do not configure Postgres yet.
Use these environment variables:
- N8N_HOST=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=development
- N8N_COMMUNITY_PACKAGES_ENABLED=true
The README.md should include exact Windows PowerShell commands for:
- starting n8n
- stopping n8n
- restarting n8n
- viewing logs
- checking container status
- resetting the local n8n volume for a fresh install
- opening n8n in the browser
Include a troubleshooting section covering:
- Docker Desktop not running
- WSL2 issues
- port 5678 already in use
- n8n container starts but browser does not load
- community nodes not appearing
After creating the files, tell me the exact next PowerShell command I should run.
That last line matters more than it seems. Always ask Codex to tell you the next command. Don’t leave yourself guessing.
Also notice what the prompt explicitly rules out: no SSL, no reverse proxy, no Postgres, no production hardening. When you’re just trying to get n8n running locally, you don’t need any of that. If you don’t say so, Codex might build you a production-grade server when all you wanted was something running on your laptop.
What Codex Built
Codex created this in the project folder:
D:\projects\n8n-local
│
├── docker-compose.yml
├── .env.example
├── README.md
└── .gitignore
And the Docker Compose file it wrote looked like this:
yaml
services:
n8n:
image: n8nio/n8n:stable
container_name: n8n-local
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_HOST=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=development
- N8N_COMMUNITY_PACKAGES_ENABLED=true
- GENERIC_TIMEZONE=Africa/Accra
- TZ=Africa/Accra
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Simple. Clean. That’s exactly what you want for local development. Keep the first version boring — boring local infrastructure is good infrastructure.
Starting n8n
Codex told me to first copy the environment file:
powershell
Copy-Item .env.example .env
Then start the container:
powershell
docker compose up -d
The first time you run this, Docker will pull the n8n image, which takes a minute or two depending on your connection. After that, check whether the container is actually running:
powershell
docker ps
If you see the n8n container listed, open your browser:
http://localhost:5678
n8n will ask you to create a local owner account. Use whatever email and password you want — this is just for your local sandbox.
And that was it. n8n was running.
Commands You’ll Use Every Day
Once n8n is up, these are the PowerShell commands worth keeping handy:
| What you want to do | Command |
|---|---|
| Start n8n | docker compose up -d |
| Stop n8n | docker compose down |
| Restart n8n | docker compose restart |
| View logs | docker compose logs -f |
| Check container status | docker ps |
| Open n8n in browser | start http://localhost:5678 |
And if you ever need to wipe everything and start completely fresh:
powershell
docker compose down -v
docker compose up -d
That removes the volume and gives you a clean slate.
Three Quick Checks After Launch
Before you declare victory, do these three things to make sure everything is solid:
1. Confirm n8n is actually running
powershell
docker ps
You should see n8n-local listed with a status of Up.
2. Check that community nodes are enabled
Inside n8n, go to Settings → Community Nodes and confirm the option is there and turned on. You don’t need to install anything yet — just make sure the feature is accessible.
3. Save a test workflow
Create a simple workflow — even just a Manual Trigger node by itself — and save it. Then restart n8n and confirm the workflow is still there. If it survived the restart, your Docker volume is persisting data correctly and you’re in good shape.
Why This Worked So Well
The honest answer is that Codex didn’t do anything magical. Docker, Docker Compose, and n8n did the actual work.
What Codex did was remove the friction. Instead of bouncing between the n8n docs, a Docker tutorial, Stack Overflow, and my terminal — writing the compose file myself, fixing indentation errors, figuring out which environment variables actually matter — Codex just handled all of it in one shot.
That’s where tools like this start to feel genuinely useful. Not because they replace knowing what you’re doing, but because they get you from “I know what I want” to “it’s working” without all the detours in between.
Local self-hosted n8n in under two minutes? With Docker already installed and a clear prompt, it’s completely realistic.
Now stop fiddling with infrastructure and go build some workflows.
Questions about this setup? Drop them in the comments below.