Skip to content

DevYatsu/express_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express_rs

A minimal and blazing-fast web framework for Rust, inspired by Express.js

🚀 Overview

express_rs aims to provide a clean, expressive, and flexible web framework modeled after the ergonomics of Express.js, but with the performance and safety guarantees of Rust.

The goal is to keep things simple, fast, and ergonomic — no macros, no ceremony — just modular, async-first routing, middlewares, and handler composition.


✅ Features (Implemented)

  • Express-style routing with .get(), .post(), etc.
  • Middleware system (app.use(...)) with layered composition
  • Minimal App type (no macro or derive required)
  • Request + Response types with mutable APIs
  • Route parameter extraction (/user/:id)
  • Route handler abstraction (Handler) with Next
  • Logging with method, path and elapsed time
  • Built-in response helpers (e.g., .send(), .json(), .status())
  • File serving with streaming optimization + LRU cache
  • MIME type detection (via [mime_guess] and [infer])
  • Route matching via fast radix tree (matchthem)
  • Global string interner for path and param deduplication
  • Type-safe per-request parameter access via extension API
  • MethodKind enum + method bitflag support

🛠️ Goals & Roadmap

Core Architecture

  • Internal App struct with lazy router initialization
  • Router type with per-method route trees
  • Middleware pipeline with early return support
  • Symbol-based interned parameters

Developer Experience

  • Static type-safe API for request extensions (.locals, etc.)
  • Global AppState<T> support like Actix
  • Built-in logging/tracing macros with levels
  • Built-in .env support for config (optional)
  • Pluggable middleware (logger, body-parser, etc.)

Advanced Routing

  • Path prefix mounting (app.use('/api', apiApp))
  • Route grouping (router.route('/users').get(...).post(...))
  • Optional trailing slash handling
  • Regex or wildcard segments (* / .*)

Performance

  • Benchmarks against Axum/Actix/Warp
  • Zero-copy response body writing
  • Avoid all heap allocations in hot path
  • Smallvec for handler/index lists

🧪 Example

use express_rs::App;

fn main() {
    let mut app = App::default();

    app.get("/", |req, res, _| {
        res.send("Hello from Rust!");
    });

    app.listen(3000, || {
        println!("🚀 Listening on http://localhost:3000");
    });
}

About

express.js but in rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published