Guide

localhost:3000 and other dev ports: open them from anywhere with a public URL

localhost:3000 is where a dev server on port 3000 answers, and only on your own machine. Here is what runs there, how to fix it when it refuses to connect, and how to open it to the internet with a public HTTPS URL.

All docs

What runs on localhost:3000#

localhost is your own computer: the name points at the loopback address 127.0.0.1, which never leaves the machine. 3000 is the port, and it is the default for a lot of development servers. When you run next dev, start an Express app or boot Rails, the terminal prints http://localhost:3000 and that is where the app answers.

PortCommonly used by
3000Next.js, Create React App, Express, Ruby on Rails, Nuxt
3001A second app, when 3000 is already taken
5000Flask and older ASP.NET Core templates
5173Vite
8000Django, FastAPI with Uvicorn, python -m http.server
8080Spring Boot, Tomcat and many proxies

However you typed it (localhost 3000, localhost3000, localhost::3000), the address is http://localhost:3000: one colon, no spaces, and http rather than https. Dev servers speak plain HTTP unless you set up a certificate, so https://localhost:3000 usually fails with a TLS error.

Because it is the loopback address, only programs on your machine can open it. Your phone, a teammate, a webhook provider and an AI agent running in the cloud all get nothing. To let any of them in, the port needs a public URL.

Fixing "localhost:3000 refused to connect"#

"Refused to connect" means nothing is listening on the port. Work through these in order:

  • The server isn't running. Check the terminal where you started it. A crash on startup leaves the port closed.
  • It started on another port. When 3000 is busy, many tools move to 3001 and say so in one line of output. Open the address the terminal printed.
  • You asked for HTTPS. Use http:// unless you configured a certificate.
  • IPv4 and IPv6 disagree. localhost can resolve to ::1 while the server listens on 127.0.0.1 only. Try http://127.0.0.1:3000.

See what, if anything, holds the port:

Terminal
# macOS and Linux
lsof -i :3000

# Windows
netstat -ano | findstr :3000

Port 3000 is already in use#

The opposite problem, EADDRINUSE or "address already in use", means an earlier server is still holding the port. Stop that process, or start the new one on a different port:

Terminal
# Stop whatever is listening on 3000 (macOS and Linux)
lsof -ti :3000 | xargs kill

# Or run on another port
PORT=3001 npm run dev
npx next dev -p 3001

Turn localhost:3000 into a public HTTPS URL#

An OtterKit tunnel gives the port a public address without deploying anything. Log in once, then point a tunnel at the port:

Terminal
npx otterkit login
npx otterkit tunnel 3000
Terminal
  ✓ Tunnel ready

  URL      https://tunnel-a1b2c3d4.otterkit.app
  Target   127.0.0.1:3000
  Rate     1 credit/hr · never more than 300/month

Anyone with the URL now reaches your local server over HTTPS, and every request is captured so you can inspect and replay it. Three options are worth knowing from the start:

Terminal
# Keep the same URL every time
npx otterkit tunnel 3000 --subdomain my-app

# Require a username and password
npx otterkit tunnel 3000 --auth me:secret

# Run in the background and stop by itself after 4 hours
npx otterkit tunnel 3000 --daemon --ttl 4h

A tunnel costs 1 credit ($0.01) per connected hour and never more than $3 in any 30 days. New accounts get 10 free credits. The tunnels guide covers every option.

Let an AI agent or a webhook provider reach your server#

Stripe, GitHub and every other webhook sender need a public URL to deliver to. With the tunnel up, give the provider the tunnel URL plus your handler's path, for example https://my-app.otterkit.app/api/webhooks/stripe, and events arrive at localhost:3000.

A tunnel only works while your machine is awake. If events can arrive at any time, catch them with an always-on webhook endpoint and replay them into port 3000 when you are ready:

Terminal
# OtterKit answers the provider around the clock
npx otterkit webhook --daemon --subdomain stripe-dev

# Later: send the latest captured event to your local server
npx otterkit replay stripe-dev --target 127.0.0.1:3000

An AI coding agent can do all of this itself. Add the MCP server and Claude Code, Cursor or any MCP client can open the tunnel, wait for a request and replay it without you typing a command:

Terminal
claude mcp add otterkit -- npx otterkit mcp

localhost:3001, 5000, 8000 and 8080#

Everything above applies to any port: only the number changes. The differences are in what usually runs there.

localhost:3001#

Usually the second app in a project, such as an API next to a front end, or the port a dev server moved to because 3000 was taken.

Terminal
npx otterkit tunnel 3001

localhost:5000#

Flask's default. On a Mac, AirPlay Receiver also listens on port 5000, so a Flask app can fail to start or the browser can show an unrelated 403. Turn AirPlay Receiver off in System Settings under General, AirDrop & Handoff, or run the app on another port.

Terminal
npx otterkit tunnel 5000

localhost:8000#

Django's runserver, FastAPI under Uvicorn and Python's built-in http.server all start here.

Terminal
npx otterkit tunnel 8000

localhost:8080#

The usual port for Spring Boot, Tomcat and local proxies.

Terminal
npx otterkit tunnel 8080

Questions about localhost:3000#

Is localhost:3000 the same as 127.0.0.1:3000?#

Almost always. localhost is a name and 127.0.0.1 is the IPv4 address it points to. On some systems the name resolves to the IPv6 address ::1 first, which is why one can work when the other is refused.

Can someone else open my localhost:3000?#

No. Their localhost is their own computer. They can reach your server only through a public URL, such as a tunnel, or your machine's network address if the server listens on it and a firewall allows it.

Is it safe to put a dev server on a public URL?#

A tunnel exposes that one port and nothing else on the machine. Add --auth to require a password, and let it stop by itself: tunnels end after 24 hours unless you choose another --ttl.

Do I have to deploy to test a webhook?#

No. Tunnel the port your handler runs on, or capture the events on a webhook endpoint and replay them locally.

Next steps#