MCPcopy Index your code
hub / github.com/Az107/HTeaPot

github.com/Az107/HTeaPot @v0.6.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.5 ↗ · + Follow
157 symbols 390 edges 25 files 60 documented · 38%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🍵 HTeaPot

A blazing-fast, minimalist HTTP server library built with Rust

Crates.io Documentation

License: MIT GitHub Repo stars

English | Español

A high-performance, lightweight HTTP server and library built in Rust. HTeaPot is designed to deliver exceptional performance for modern web applications while maintaining a simple and intuitive API.

📚 Table of Contents

✨ Features

Exceptional Performance

  • Threaded Architecture: Powered by a custom-designed thread system that handles 70,000+ requests per second
  • Consistent Under Load: Maintains steady performance even under high concurrency scenarios
  • Resilient: Achieves near-perfect 100% success rate for 200 OK responses during stress tests

Versatile Functionality

  • Static File Serving: Efficiently serve static assets with minimal configuration
  • Streaming Support: Leverages chunked transfer encoding for large files and long-lived connections
  • Flexible API: Use HTeaPot as a standalone server or as a library in your Rust applications

Developer-Friendly

  • Simple Configuration: Get started quickly with intuitive TOML configuration
  • Extensible Design: Easily customize behavior for specific use cases
  • Lightweight Footprint: Zero dependencies and efficient resource usage

🚀 Getting Started

🔧 Installation

# Install from crates.io
cargo install hteapot

# Or build from source
git clone https://github.com/Az107/hteapot.git
cd hteapot
cargo build --release

🖥️ Running the Server

Option 1: With Config

  1. Create a config.toml file:
[HTEAPOT]
port = 8081        # The port to listen on
host = "localhost" # The host address to bind to
root = "public"    # The root directory to serve files from
  1. Run the server:
hteapot ./config.toml

Option 2: Quick Serve

hteapot -s ./public/

🦀 Using as a Library

  1. Add HTeaPot to your Cargo.toml project:
cargo add hteapot
  1. Implement in your code: example
use hteapot::{HttpStatus, HttpResponse, Hteapot, HttpRequest};

fn main() {
    // Create a new server instance
    let server = Hteapot::new("localhost", 8081);

    // Define your request handler
    server.listen(move |req: HttpRequest| {
        HttpResponse::new(HttpStatus::IAmATeapot, "Hello, I am HTeaPot", None)
    });
}

📊 Performance

HTeaPot has been benchmarked against other popular HTTP servers, consistently demonstrating excellent metrics:

Metric HTeaPot Industry Average
Requests/sec 70,000+ req/s 30,000 - 50,000 req/s
Error rate < 0.1% 0.5% - 2%
Latency (p99) 5ms 15ms - 30ms
Memory usage Low Moderate

Roadmap

  • [x] HTTP/1.1 support (keep-alive, chunked encoding)
  • [x] Library API
  • [x] Streaming responses
  • [x] Multipart form handling
  • [x] Basic routing system
  • [ ] HTTPS support
  • [ ] Compression (gzip/deflate)
  • [ ] WebSocket support
  • [ ] Enhanced documentation and examples

Contributing

We welcome contributions from the community! To get started:

# Format the code
cargo fmt

# Lint for warnings
cargo clippy --all-targets --all-features

# Run tests
cargo test

See CONTRIBUTING.md for more details.

License

HTeaPot is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • The Rust community for their exceptional tools and libraries
  • Our contributors who have helped shape this project
  • Users who provide valuable feedback and bug reports

Extension points exported contracts — how you extend this code

HttpResponseCommon (Interface)
Trait shared by all response types (normal, streamed, etc.) [4 implementers]
src/hteapot/response.rs
Schema (Interface)
Trait for safely extracting typed values from a `TOMLSchema`. [1 implementers]
src/config.rs
Handler (Interface)
(no doc) [2 implementers]
src/handler/handler.rs
HandlerFactory (Interface)
(no doc) [2 implementers]
src/handler/handler.rs

Core symbols most depended-on inside this repo

to_string
called by 62
src/hteapot/brew.rs
clone
called by 47
src/hteapot/request.rs
insert
called by 29
src/hteapot/http/headers.rs
len
called by 21
src/hteapot/http/headers.rs
is_empty
called by 13
src/hteapot/http/headers.rs
get
called by 12
src/hteapot/request.rs
get2
called by 9
src/config.rs
info
called by 8
src/logger.rs

Shape

Method 87
Function 32
Class 26
Enum 8
Interface 4

Languages

Rust99%
TypeScript1%

Modules by API surface

src/hteapot/request.rs20 symbols
src/logger.rs19 symbols
src/hteapot/response.rs19 symbols
src/hteapot/http/headers.rs18 symbols
src/hteapot/engine.rs12 symbols
src/shutdown.rs9 symbols
src/hteapot/brew.rs9 symbols
src/config.rs9 symbols
src/hteapot/brew/parser.rs7 symbols
src/cache.rs6 symbols
src/handler/mod.rs4 symbols
src/handler/file.rs4 symbols

For agents

$ claude mcp add HTeaPot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact