Skip to content

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
Step-by-step guide: how to use http-serverInstall, first run, examples, tips and FAQs

How to get it

  1. 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-server

    Or run on demand without installing

    npx http-server [path] [options]
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
http-server (this)14.2kCLIbeginner7 months agoFront-end developers who want to preview a static site or single-page app locally
oha10.7kCLIbeginner4 days agoDevelopers checking how an API or website handles many simultaneous requests
vapor26.2kLibraryintermediate4 days agoSwift developers who want to build backend services in the same language as their iOS or macOS apps
elysia19.3kFrameworkintermediate8 days agoTypeScript developers building HTTP APIs or web servers
drogon14.4kFrameworkadvanced4 days agoC++ developers building HTTP or REST API backends
warp10.4kLibraryintermediate3 months agoRust 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.