6 releases (stable)

Uses new Rust 2024

new 1.1.2 Nov 7, 2025
1.1.0 Nov 3, 2025
1.0.7 Nov 3, 2025
1.0.5 Oct 30, 2025
0.1.0 Apr 25, 2025

#377 in HTTP server

MIT license

22KB
155 lines

webserve

Stars Badge Forks Badge Issues Badge License Badge

A blazing-fast static file and SPA Web server written in Rust. Supports live reload, SPA fallback, and directory serving — like npm serve, but compiled and production-ready.


🚀 Features

  • ✅ Serve any directory (-d ./dist)
  • ✅ SPA fallback support (--spa)
  • ✅ File watching with automatic browser reload (--watch)
  • ✅ Configurable host and port (-h, -p)
  • ✅ Built with Rust + Tokio for high performance

📦 Installation

git clone https://github.com/marcuwynu23/webserve
cd webserve
cargo build --release

The executable will be located in target/release/webserve.

You can also install it globally (requires Rust):

cargo install --path .

🛠 Usage

webserve [OPTIONS]

Options

Flag Description Default
-d, --dir Directory to serve files from Current directory
-p, --port Port to listen on 8080
-h, --host Host/IP to bind 127.0.0.1
--spa Enable SPA fallback (404 → index.html) disabled
-w, --watch Enable file watching + auto-reload disabled

🧪 Example

Serve a Vite/React app from ./dist, with SPA fallback and live reload:

webserve -d ./dist --spa --watch

📜 License

MIT © Mark Wayne Menorca

Dependencies

~19–32MB
~519K SLoC