Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developer workflow: Does it matter which port is used during development?

Are there any differences between choosing this or that port? Are there any standards for picking a port?

I'm just looking for the "why" a particular port was picked to be used. There doesn't appear to be a standard convention for picking a port number(at least in documentation).

The examples in official docs use different port numbers.

  • Create React App docs provide examples using localhost:3000/
  • Django docs provide examples using port 8000/
  • Ember docs provide examples using port 4200/
  • Express docs provide examples using port 3000/
  • Flask docs provide examples using port 5000/
  • Webpack docs provide examples using port 8080/
like image 809
The cows are in the Meadow Avatar asked Oct 27 '25 05:10

The cows are in the Meadow


2 Answers

as you already realized: It doesn't really matter. It should be over 1024, and maybe don't use an official port number. Also its not bad that different systems use different number as default, so they don't clash.

This means you can run an express example and an ember server side by side with the default port number.

Btw I'm pretty sure embers 4200 is a reference to the hitchhiker's guide to the galaxy.

like image 143
Lux Avatar answered Oct 30 '25 18:10

Lux


3000 8000 and 8080 are typical dev ports. However, I would pick something obscure (but meaningful to you) to avoid port conflicts. I came up with a port number scheme where I would always start with 5 and then the other letters would be picked as follows:

5
E - 5
M - 13 (minus 10) = 3
A - 1
I - 9
L

So my port for my EMAIL server would be 55319. Crazy? Not sure, but it meant I could work out the port and never ever got a conflict. Also, hackers often scan for open ports but it takes too long to scan all ports so they just scan frequently used ports. So if you pick an obscure port then they won't scan it and will never know it is open!

like image 41
danday74 Avatar answered Oct 30 '25 18:10

danday74