Local HTTP Server Manager
Project description
http-server-cli
Forget ports. Just preview.
Based on
python3 -m http.server, zero external dependencies. Jusths . -oto preview your project.
- Zero External Dependencies — Only requires macOS (lsof/open) and Python 3.7+ (
pip install http-server-cli) - Auto Port Allocation + Preview — Default 8080, auto-increment on conflict (
hs . -o) - Smart Homepage — Auto-redirect to most recently modified HTML file when no index.html
- Project Tracking — Persistent project path ↔ port mapping (
hs list) - Process Resource Monitoring — Real-time CPU, memory usage and runtime (
hs list) - Multiple Launch Modes — Daemon background or foreground (
-ddaemon /-fforeground) - JSON Output — All commands support
--jsonfor API/MCP consumption - Custom Index Page — Specify default HTML file with
-i/--index
Why hs
When developing multiple frontend projects, you constantly switch between "Which port did A use?" and "Who's occupying 8080?".
hs closes the loop: Start → Track → List → Kill — auto-find free ports, remember which project uses which port, view and close anytime.
Comparison
| Scenario | Before | With hs |
|---|---|---|
| Start server | python3 -m http.server 8080 + manually open browser |
hs . -o — auto-find free port, open browser |
| View servers | lsof -i :8080, then ps to see path |
hs list |
| Switch projects | Kill old one, start new (or conflict) | hs ../project-b |
| Kill server | lsof to find PID → kill |
hs kill 8080 |
Installation
pip install http-server-cli
# Upgrade to latest version
pip install --upgrade http-server-cli
Verify:
hs version # → http-server-cli v1.0.6
hs . -o # Start in current directory + open browser
Usage
Daily Workflow
# 1. Preview your project
cd ~/project-alpha
hs . -o # Auto-find free port, open browser
# 2. Check running servers
hs list
# ✅ http://localhost:8080 → ~/project-alpha
# ✅ http://localhost:8081 → ~/project-beta (daemon)
# 3. Kill unwanted servers
hs kill 8080 # By port
hs kill ~/project-alpha # By path
hs kill-all # Kill all
All Commands
| Command | Description |
|---|---|
hs . [-o] [-d] [-f] |
Shortcut, equivalent to hs start . |
hs start [path] [-o] [-d] [-f] [-i <file>] |
Start server (path defaults to .; -o open browser; -d daemon; -f foreground; -i custom index) |
hs list |
List all running servers |
hs list --json |
JSON format list |
hs status [port|path] |
Query single server status |
hs status --json [port|path] |
JSON format status |
hs kill <port|path> |
Kill specified server |
hs kill-all |
Kill all servers |
hs config |
Show configuration |
hs config --json |
JSON format configuration |
hs set port <num> |
Set default port (default 8080) |
hs set domain <str> |
Set bind domain (default localhost) |
Tips
hs . -o=hs start . -o, faster to typehs . -d: daemon mode, runs in background, check withhs lisths . -f: foreground mode, Ctrl+C to stophswithout args =hs start .(start in current directory)hs . -i app.html: useapp.htmlas the index page
Data Directory
~/.http-server-cli/
├── config.json # Default port/domain configuration
├── registry.json # port → {path, pid, domain, daemon, foreground, started_at}
└── logs/{port}.log # http.server logs
Platform Requirements
Currently only supports macOS (requires lsof command). Linux/Windows support in development.
Local Development
git clone git@github.com:imjaden/http-server-cli.git
cd http-server-cli
pip install -e .
python3 -m pytest tests/
Is This Reinventing the Wheel?
| Tool | Start Server | Auto Port | Track Project↔Port | List All | Kill by Name | Open Browser |
|---|---|---|---|---|---|---|
python3 -m http.server |
✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
http-server (npm) |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
serve (npm) |
✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
live-server |
✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
portless (npm) |
✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
kill-port-cli (npm) |
❌ | ❌ | ❌ | ✅ | ✅ | ❌ |
lsof / netstat |
❌ | ❌ | ❌ | Manual | Manual | ❌ |
http-server-cli |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file http_server_cli-1.0.6.tar.gz.
File metadata
- Download URL: http_server_cli-1.0.6.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d77a1ebc27658b919956c59598bb1bc98b476522b49080594c69dcf12491c1b
|
|
| MD5 |
7cfb51449835a4e0d03222fd9f25579f
|
|
| BLAKE2b-256 |
005320979d058392bb926dd7f8ac7d726163219618ff5f90852396c5f85cc7b7
|
File details
Details for the file http_server_cli-1.0.6-py3-none-any.whl.
File metadata
- Download URL: http_server_cli-1.0.6-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc8a0cdadfb2de0aac790c88517c6e59d91c21df426c52ad07de7478e26178c0
|
|
| MD5 |
59c884fcbcf8521aef1644bd35b2b7ac
|
|
| BLAKE2b-256 |
6609b0fd098ec83e152b54bf95ba425aff7c1abf1e181ca52f66551499188920
|