Localhost — Guides | Better Vibe Coding

Localhost

What localhost means, why local development matters, and how to run your app on your own computer and see it in the browser.

⏱ ~10 min
Last updated February 2026

Before you start

Your IDE should be set up (IDE Setup guide). Docker installed is helpful but not required for this guide (Docker guide).

What is localhost?

Localhost is your own computer, acting as a web server. When you type a URL like google.com into your browser, your browser reaches out across the internet to Google's servers. When you type localhost, your browser talks to your own machine instead. No internet needed. No server needed. Just your computer talking to itself.

That's it. Localhost means "this computer right here."

Why does this matter?

When you build an app, you need to see it running. You need to click the buttons, fill in the forms, and watch what happens. But your app isn't on the internet yet — it's just files on your computer. Localhost is how you run those files and see them in your browser, as if the app were a real website.

This is called local development. You build and test everything on your own computer first. When it works, then you put it on the internet (that's called deployment — a topic for another day). Every professional developer works this way. It's faster, it's safer, and you can experiment without breaking anything that real users might see.

How it works

When you run your app locally, something called a development server starts up on your computer. This server does the same thing that a real web server on the internet does — it takes your code, processes it, and serves it to a browser. The only difference is that it's all happening on your machine.

The development server listens on a port. Think of your computer as an apartment building. The building has one address (localhost), but it has many apartments (ports). Each app gets its own apartment number so they don't interfere with each other. The most common port you'll see is 3000, but it could be 5000, 8000, 8080, or something else.

So the full address you type into your browser looks like:

Browser address bar
http://localhost:3000

That means: "Talk to this computer (localhost), apartment 3000 (the port where my app is running)."

Running your app locally

The exact command to start your app depends on what you're building. AI will usually tell you what command to run, and it'll be in your project's README file. But here are the most common patterns you'll encounter:

If your project uses Docker

This is the simplest case. If AI set up Docker for your project (you'll see a docker-compose.yml file), just run:

Terminal
docker compose up

Docker starts everything — your app, your database, whatever's needed. It will print out log messages, and somewhere in there you'll see something like "Server running on port 3000" or "Listening on http://localhost:3000". Open your browser, go to that address, and there's your app.

If your project uses Node.js

Many web apps are built with Node.js. You'll usually see a package.json file in your project. Run:

Terminal
npm install
npm run dev

The first command installs your project's dependencies (the libraries it needs). You only have to run it once, or when dependencies change. The second command starts the development server.

If your project uses Python

Python projects vary more, but common patterns include:

Terminal
pip install -r requirements.txt
python app.py

Or for Django or Flask projects, AI might tell you to run something like python manage.py runserver or flask run.

Don't memorize these. The specific command depends on your project. AI will tell you what to run when it sets up your project. The point of this guide is to understand what's happening when you run those commands — not to memorize the commands themselves.

What you should see

When you start your development server, a few things happen:

The terminal shows output. You'll see log messages as the server starts. Look for a line that mentions a URL or port number. Something like "ready on http://localhost:3000" or "server started on port 8080."

Your browser shows your app. Open your browser and go to the URL from the terminal output. You should see your app. If it's a new project, it might just be a welcome page or a blank page with some text. That's fine — it means it's working.

Changes show up automatically. Most modern development servers support hot reloading. This means when you (or AI) change a file and save it, the browser automatically refreshes to show the update. You don't have to stop and restart the server every time you make a change.

Common issues

"This site can't be reached" or "Connection refused." Your development server probably isn't running. Check your terminal — did it start successfully, or is there an error message? Make sure the port in your browser matches the port the server is running on.

"Port 3000 is already in use." Something else is already using that port. Either close the other thing (check if you have another terminal running a server), or tell AI to change the port. You can also find and kill the process using the port:

Terminal (Mac/Linux)
lsof -i :3000
Terminal (Windows)
netstat -ano | findstr :3000

These commands show you what's using port 3000. You can then close that application or ask AI to help you stop it.

The page loads but looks broken. Your app is running but there might be a build issue. Check the terminal for error messages. Also check the browser's developer console (press F12 or Cmd+Option+I on Mac) — errors show up there in red.

Changes aren't showing up. Try a hard refresh: Cmd+Shift+R (Mac) or Ctrl+Shift+R (Windows). This clears the browser cache and forces a fresh load. If that doesn't work, check that your development server is still running in the terminal.

The development server needs to stay running. Your app only works in the browser as long as the server is running in your terminal. If you close the terminal or stop the server (Ctrl+C), the browser will show "can't be reached." Just restart the server when you want to work again.

Localhost vs. the real internet

One important thing to understand: localhost is only visible to you. Nobody else can see your app by going to localhost:3000 — that address only means something on your computer. On someone else's computer, localhost refers to their machine.

When you're ready for other people to see your app, you deploy it — put it on a server that's connected to the internet with a real URL. But that's a separate step that comes later. For now, localhost is your private workshop where you build and test everything before it goes public.

You understand localhost. 🌐

You know what it means, how to start a development server, and how to see your app in the browser. Next up: Git — the tool that saves your work and lets you undo mistakes. Git Setup →

Wait. Before you go.

Be first to know when we launch — plus get a free chapter right now.

No spam. Ever.