Overview
Discover what makes Static Web Server powerful
**Static Web Server (SWS)** is a lightweight, high‑performance HTTP/1.1 and HTTP/2 web server written in Rust. It is engineered to serve static assets—HTML, CSS, JavaScript, images, fonts, and other media—with minimal memory footprint and zero runtime dependencies. The core design focuses on safety, concurrency, and low overhead, making it an attractive choice for developers deploying static sites or asset servers in production environments such as micro‑services, edge nodes, or CI/CD pipelines.
Language & Runtime
HTTP Engine
Compression
File I/O
Overview
Static Web Server (SWS) is a lightweight, high‑performance HTTP/1.1 and HTTP/2 web server written in Rust. It is engineered to serve static assets—HTML, CSS, JavaScript, images, fonts, and other media—with minimal memory footprint and zero runtime dependencies. The core design focuses on safety, concurrency, and low overhead, making it an attractive choice for developers deploying static sites or asset servers in production environments such as micro‑services, edge nodes, or CI/CD pipelines.
Technical Stack
- Language & Runtime: Rust 1.56+ with the asynchronous Tokio runtime.
- HTTP Engine: Hyper (the de‑facto Rust HTTP library) powers request parsing, response generation, and protocol handling.
- Compression: Optional on‑demand gzip/deflate, Brotli, or Zstandard (zstd) support driven by the
Accept‑Encodingheader. - File I/O: Uses Rust’s async file APIs (
tokio::fs) for non‑blocking reads, coupled with memory‑mapped I/O for large files to enable efficient byte‑range requests. - TLS: Integrates
rustlsfor TLS/ALPN support, allowing HTTP/2 over HTTPS without external libraries. - Binary: A single statically‑linked 4 MB binary (uncompressed) that requires no dynamic libraries, simplifying containerization and deployment on any Linux distribution.
Core Capabilities
- Asynchronous Serving: Handles thousands of concurrent connections with minimal thread usage, leveraging Tokio’s multi‑core scheduler.
- HTTP/2 & HTTP/1.1: Supports both protocols, with automatic negotiation based on client capabilities.
- Range Requests & Partial Content: Full support for
Rangeheaders, enabling efficient media streaming and resumable downloads. - Cache Control: Configurable
Cache‑Controlheaders per directory or file type, facilitating CDN‑style caching strategies. - Graceful Shutdown: Listens for termination signals (
SIGINT,SIGTERM) and completes in‑flight requests before exiting. - Security Headers: Preconfigured security headers (e.g.,
X‑Content‑Type‑Options,Referrer-Policy) for HTTP/2 connections.
Deployment & Infrastructure
SWS is designed for container‑friendly deployment:
- Docker: Official images (
joseluisq/static-web-server) are available on Docker Hub, with multi‑arch support (amd64, arm64). - Kubernetes: Can be run as a sidecar or standalone pod; the small binary size reduces image pull times and ECR/OCI storage costs.
- Edge & IoT: The 4 MB binary and no external dependencies make it suitable for edge devices, Raspberry Pi, or even WebAssembly via Wasmer.
- Scalability: Horizontal scaling is straightforward; each instance can be load‑balanced behind a reverse proxy or Kubernetes ingress. For very large static sites, multiple instances can share the same file system (e.g., NFS, EFS) or a shared object store via an HTTP gateway.
Integration & Extensibility
- Configuration: All settings are driven by a TOML configuration file or command‑line flags; no embedded scripting is required.
- Plugin Hooks: While SWS does not expose a traditional plugin API, it offers HTTP middleware hooks (e.g., custom request/response handlers) via the
hyperservice trait, enabling developers to embed SWS into larger Rust applications. - Webhooks: The server can be paired with CI/CD pipelines (GitHub Actions, GitLab CI) to trigger rebuilds and redeployments automatically.
- Extensible Compression: Developers can add new compression algorithms by integrating additional crates and exposing them through the configuration.
Developer Experience
- Documentation: Comprehensive docs on
docs.rsand the GitHub repository, covering API usage, configuration options, and advanced features. - Community: Active Discord channel for real‑time support; contributors welcome via GitHub issues and pull requests.
- Error Handling: Rust’s
Resulttypes provide clear error propagation; the server logs detailed diagnostics for production troubleshooting. - Testing: Extensive test suite with integration tests against
hyperandtokio, ensuring reliability across platforms.
Use Cases
- Static Site Hosting: Perfect for JAMstack sites, documentation portals, or portfolio pages where speed and zero runtime overhead are critical.
- Asset Delivery: Serve CSS/JS bundles, images, fonts, and large media files with range support for streaming.
- Development Proxy: Fast local development server that mirrors production performance, useful in front‑end dev workflows.
- Micro‑service Edge: Deploy as a lightweight reverse proxy or cache layer in front of more complex services.
Advantages Over Alternatives
| Feature | Static Web Server | Competing Tools |
|---|---|---|
| Binary Size | ~4 MB static | >100 MB (Node, Go) |
| Runtime Dependencies | None | Often require Node.js or Go runtime |
| Performance | Asynchronous Rust, low latency | Synchronous or less optimized |
| Security | Built‑in TLS & security headers | Requires external config |
| Licensing | Apache 2.0 (permissive) | Varies, often GPL or proprietary |
| Platform Support | Linux, macOS, Windows, FreeBSD, NetBSD, |
Open SourceReady to get started?
Join the community and start self-hosting Static Web Server today
Related Apps in cloud-platforms
Home Assistant
Open-source smart home hub for automation and integration
Caddy
Secure, auto‑TLS web server for every site
Traefik
Dynamic reverse proxy and load balancer for microservices
Pi‑hole
Network‑wide ad blocking with your own DNS server
CasaOS
Your Personal Cloud OS for Docker-based home servers
AdGuard Home
Network‑wide ad and tracker blocker
Weekly Views
Repository Health
Information
Explore More Apps
OTOBO
Flexible open‑source ticketing and ITSM for service organizations
LibreTime
Self‑hosted radio station automation
Simple-URL-Shortener
KISS URL shortener with user comments
Formbricks
Open‑source, privacy‑first survey platform
Wagtail
Fast, flexible CMS built on Django
Easy-WI
Automated game & voice server management platform