localhost:3000
Building a React app? Working with Express? That URL you keep refreshing — localhost:3000 — is the default dev server for most of the JavaScript ecosystem. Ruby on Rails popularized it, Node.js adopted it, and now React, Next.js, and Express all use it out of the box.
What Uses Port 3000?
| Framework | Start Command | Default Port |
|---|---|---|
| React (Create React App) | npm start | 3000 |
| Next.js | npm run dev | 3000 |
| Express.js | node server.js | 3000 |
| Ruby on Rails | rails server | 3000 |
| Gatsby | gatsby develop | 8000 |
| Grafana | Service | 3000 |
Quick Start
React
npx create-react-app my-app
cd my-app
npm start
# Opens http://localhost:3000
Next.js
npx create-next-app my-app
cd my-app
npm run dev
# Opens http://localhost:3000
Express.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello World');
});
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});
Port 3000 Already in Use?
Most common error: EADDRINUSE: address already in use :::3000
Find What's Using Port 3000
# Mac/Linux
lsof -i :3000
# Windows
netstat -ano | findstr :3000
Kill the Process
# Mac/Linux
kill -9 $(lsof -t -i:3000)
# Windows (replace PID with actual number)
taskkill /PID 12345 /F
Or Use a Different Port
# React
PORT=3001 npm start
# Next.js
npm run dev -- -p 3001
# Express
app.listen(process.env.PORT || 3001);
Can't Connect to localhost:3000?
| Problem | Solution |
|---|---|
| ERR_CONNECTION_REFUSED | Server isn't running. Check terminal for errors. |
| Page loads but blank | Check browser console (F12) for JS errors |
| CORS errors | Backend needs to allow localhost:3000 origin |
| Hot reload not working | Clear cache, restart dev server |
Why Port 3000?
Port numbers below 1024 require admin/root privileges (like 80 for HTTP). Port 3000 is high enough to avoid that hassle, low enough to remember easily, and became convention after Rails and Node.js popularized it. When 3000 is busy, most tools auto-increment to 3001.