Systems

port

A port is a numbered door on a computer where a service waits for visitors. One machine has one network address, but thousands of these numbered doors — so many different services can run side by side, each behind its own door, without bumping into each other.

Some numbers are conventions everyone agrees on: 80 is the door for plain web traffic, 443 is for secure https, and 3000 is the door your dev server often opens while you build something.

That's what localhost:3000 means: localhost is 'this very computer', and :3000 is the door to knock on. Open it in a browser and you're talking to the app you just started — no internet required.

$ npm run dev
  ➜  Local:   http://localhost:3000

# in your browser, visit:
http://localhost:3000

Your dev server opens door 3000; localhost:3000 is how you knock on it.

'Address already in use' means another service is already squatting that door — pick a free number or stop the old one.

Also called
network porttcp portlocalhostport 80port 443port 3000:3000