@lowdep/serve-here
v1.0.0
Published
Zero-dependency static file server — directory listings, correct MIME types, range requests, SPA mode
Downloads
105
Maintainers
Readme
serve-here
A zero-dependency static file server for the current directory. Correct MIME types, directory listings, HTTP range requests (so video/audio seeking and resumable downloads actually work), path-traversal protection, and an SPA fallback mode.
http-server and serve both pull in dependency trees. Python's http.server gets MIME types wrong and doesn't support range requests. serve-here is one file with none of those problems.
Install
npm install -g serve-hereOr without installing:
npx serve-hereUsage
serve-here # Serve ./ on http://localhost:8080
serve-here dist -p 3000 # Serve ./dist on port 3000
serve-here --spa # SPA: unknown routes → index.html
serve-here --no-cache --cors # Dev mode (no caching + CORS)
serve-here --no-listing # 404 instead of directory listingsThe port auto-increments if the chosen one is busy.
Example
serve-here serving /home/me/project/dist
Local http://localhost:8080
Network http://192.168.1.42:8080
Ctrl+C to stop
14:22:01 200 GET /index.html 3ms
14:22:01 200 GET /app.js 1ms
14:22:05 206 GET /demo.mp4 8ms ← range request (video seek)
14:22:09 404 GET /missing.png 0msThe Network URL means you can open the site on your phone or another machine on the same Wi-Fi.
Features
| Feature | Why it matters |
|---|---|
| Range requests (206) | Video/audio scrubbing, resumable downloads |
| Correct MIME types | .mjs, .wasm, .webp, .woff2, etc. served correctly |
| Directory listings | Browsable, with sizes and dates (dark-mode aware) |
| Path-traversal protection | ../ escapes outside the root are blocked (403) |
| SPA mode | --spa serves index.html for client-side routes |
| LAN access | Binds all interfaces so phones/other devices can connect |
Options
| Flag | Default | Description |
|---|---|---|
| -p, --port <n> | 8080 | Port (auto-increments if busy) |
| --host <addr> | 0.0.0.0 | Bind address |
| --spa | off | Serve index.html for unknown routes |
| --no-listing | off | Return 404 instead of a directory listing |
| --no-cache | off | Send no-cache headers (development) |
| --cors | off | Add permissive CORS headers |
| --quiet | off | Don't log requests |
License
MIT
Keywords
static server · http server · serve files · http-server alternative · serve alternative · local web server · range requests · spa server · zero dependencies · cli
Built to solve, shared to help — Rushabh Shah 🛠️✨
One of 40+ zero-dependency developer CLI tools — no node_modules, ever.
