DEV Community

Hubert Shelley
Hubert Shelley

Posted on

Introducing Silent: A Clean Rust Web Framework Without Macro Magic

In the Rust web ecosystem, frameworks often rely heavily on macros to provide ergonomic APIs. While powerful, macros can sometimes obscure what's happening under the hood and make debugging harder.

Enter Silent — a web framework built on Hyper with a different philosophy: minimal or no macros.

Why Silent?

🎯 Explicit Over Magic

Silent prioritizes explicit, readable code. What you see is what you get. No macro expansion surprises.

⚡ Hyper-Powered Performance

Built on Hyper 1.x, Silent inherits its battle-tested performance and reliability.

🔧 Feature-Complete

  • Routing with extractors
  • Middleware support
  • WebSocket
  • Static file serving
  • Template rendering
  • Session management
  • Security utilities (argon2, pbkdf2, AES, RSA)
  • gRPC support
  • Cloudflare Worker support (Edge computing ready!)

Quick Example

use silent::{Server, Request, Response, Result};

async fn hello(req: Request) -> Result<Response> {
    let name = req.params().get("name").unwrap_or("World");
    Ok(Response::text(format!("Hello, {}!", name)))
}

#[tokio::main]
async fn main() {
    Server::new()
        .route("/hello/:name", hello)
        .run("127.0.0.1:8080")
        .await;
}
Enter fullscreen mode Exit fullscreen mode

NetServer: Protocol-Agnostic Networking

Silent also includes NetServer, a generic network layer:

use silent::NetServer;
use std::time::Duration;

#[tokio::main]
async fn main() {
    NetServer::new()
        .bind("127.0.0.1:8080".parse().unwrap())
        .with_rate_limiter(10, Duration::from_millis(10), Duration::from_secs(2))
        .with_shutdown(Duration::from_secs(5))
        .serve(|stream, peer| async move {
            println!("Connection from: {}", peer);
            Ok(())
        })
        .await;
}
Enter fullscreen mode Exit fullscreen mode

NetServer Features:

  • Multi-listener support (TCP, Unix Socket)
  • Token-bucket rate limiting
  • Graceful shutdown
  • Protocol-agnostic via ConnectionService trait

AI/ML Integration

Silent has first-class support for AI workloads:

  • Whisper (speech recognition) with Candle
  • LLM server examples

Check out the LLM Server repository for more details.

Get Started

cargo add silent
Enter fullscreen mode Exit fullscreen mode

Links:

Why Not Just Use Axum or Actix?

If you love macros and don't mind them, Axum and Actix are excellent choices. But if you prefer:

  • Explicit code over macro magic
  • Learning how things work rather than relying on DSLs
  • Edge computing with Cloudflare Workers

Give Silent a try!


Star us on GitHub!
https://github.com/silent-rs/silent

Top comments (0)