
http-server
A zero-setup command-line tool that serves files from a folder over HTTP.
- Stars
- 14.2k
- Forks
- 1.6k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 7 months ago
- Type
- CLI
What it is
http-server is a command-line tool that turns a folder on your computer into a website you can view in a browser, with no configuration file needed. It is described as powerful enough for production use, but simple enough for testing, local development and learning. You run it from a terminal, point it at a folder, and it serves that folder at a local address such as http://localhost:8080.
- Preview a static website folder by running http-server in that directory and opening localhost:8080
- Serve a single-page app with a 404.html fallback so client-side routes load
- Run a local HTTPS server with a self-signed certificate using the -S and -C options
- Proxy unresolved requests to another URL with the -P option during development
- Enable basic authentication with --user and --password to restrict access
Great for
- Front-end developers who want to preview a static site or single-page app locally
- Students learning how web servers and HTTP work
- Testing a built HTML/CSS/JavaScript folder quickly without setting up a full server
- Developers who need a simple proxy or HTTPS server for local testing
Not ideal for
- People who need dynamic server-side logic, since it serves static files and proxies requests rather than running application code (inferred from its static-server description)
- Anyone who needs a managed production hosting service with scaling and monitoring; the README mentions production usability but does not describe hosting infrastructure
How to get it
- 1
Install with a package manager
You'll need: Node.js (version not specified in the README excerpt)
Install globally via npm
npm install --global http-serverOr run on demand without installing
npx http-server [path] [options] - 2
Run it
- Install with npm install --global http-server, or use npx http-server without installing
- Open a terminal in the folder you want to serve
- Run http-server
- Visit http://localhost:8080 in your browser
- 3
Get the most out of it
- Use -o to open a browser window automatically after startup
- Use -c-1 to disable caching while you are editing files
- Use -S and -C with an openssl-generated certificate to test over HTTPS
- Use --proxy with a trailing ? to create a catch-all redirect to the index page
- Use -p 0 to let the server find an open port starting at 8080
Downloads
Strengths
- Zero configuration: a single command serves a folder
- Wide range of options for caching, CORS, proxying, HTTPS and basic auth, documented in one table
- MIT licensed and installable through npm, npx or Homebrew
Trade-offs
- No public Docker image is provided; you must build one from the included Dockerfile
- Several options are documented in the README as having defaults that may surprise new users, such as caching being on by default
- The README is long with many options, so beginners may need time to find the parts they need
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| http-server (this) | 14.2k | CLI | beginner | 7 months ago | Front-end developers who want to preview a static site or single-page app locally |
| oha | 10.7k | CLI | beginner | 4 days ago | Developers checking how an API or website handles many simultaneous requests |
| vapor | 26.2k | Library | intermediate | 4 days ago | Swift developers who want to build backend services in the same language as their iOS or macOS apps |
| elysia | 19.3k | Framework | intermediate | 8 days ago | TypeScript developers building HTTP APIs or web servers |
| drogon | 14.4k | Framework | advanced | 4 days ago | C++ developers building HTTP or REST API backends |
| warp | 10.4k | Library | intermediate | 3 months ago | Rust developers building HTTP APIs or web servers |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.