🚀 BWS (Ben's Web Server)
A high-performance, memory-safe web server and reverse proxy built with Rust and Cloudflare's Pingora framework.
✨ Features
- 🌐 Multi-Site Hosting - Multiple websites with individual configurations
- 🔒 Automatic SSL/TLS - Let's Encrypt integration with auto-renewal
- ⚡ Load Balancing - Round-robin, weighted, and least-connections algorithms
- 🔌 WebSocket Proxy - Full WebSocket support with load balancing
- 📊 Health Monitoring - Built-in health checks and metrics
- 🛡️ Memory Safety - Rust eliminates buffer overflows and memory leaks
- 🔧 Hot Reload - Update configuration without downtime
🚀 Quick Start
Installation
# From crates.io
# From Docker
# From source
&&
Basic Configuration
Create config.toml:
[]
= "BWS Server"
# Static website
[[]]
= "main"
= "localhost"
= 8080
= "static"
= true
# Reverse proxy with load balancing
[[]]
= "api"
= "api.localhost"
= 8090
[]
= true
[[]]
= "backend"
= "http://127.0.0.1:3001"
[[]]
= "/api/"
= "backend"
# HTTPS with automatic certificates
[[]]
= "secure"
= "example.com"
= 443
[]
= true
= true
[]
= true
= "admin@example.com"
Run
&&
📖 Documentation
- Architecture Guide - System design and modules
- Configuration Examples - Ready-to-use configs
- Security Guide - Security features and best practices
🏗️ Architecture
BWS uses a modular, enterprise-grade architecture:
src/
├── core/ # Foundation: types, error handling, utilities
├── config/ # Configuration management
├── handlers/ # Request processing (static, API, proxy, WebSocket)
├── middleware/ # CORS, security headers, rate limiting
├── monitoring/ # Health checks, metrics, certificate monitoring
├── server/ # Server infrastructure
└── ssl/ # SSL/TLS and certificate management
🔧 CLI Options
📊 API Endpoints
GET /api/health- Server health statusGET /api/health/detailed- Detailed system informationGET /- Static content (when configured)
🐳 Docker
# Quick start
# With custom config
🛡️ Security
- Memory Safety: Rust's type system prevents entire classes of vulnerabilities
- Zero Panics: Comprehensive error handling throughout
- Security Headers: HSTS, CSP, XSS protection built-in
- Path Traversal Protection: Secure static file serving
- Rate Limiting: Configurable request throttling
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
Licensed under the MIT License.
BWS - Enterprise-grade web serving, simplified. Built with ❤️ in Rust.