Hex Stack - A simple stack to create modern backend applications that are fast and have the best in class developer experience.


Keywords
cli, generator, http, server, websocket, backend, dx, rust
License
MIT

Documentation

HexStack

Crates.io

A modern, full-stack web framework for Rust

Please star the repo if you like it, so that I know someone is using it.

What is HexStack?

HexStack is a complete, modern web framework for Rust that combines the familiar developer experience of Express.js, WS and Drizzle with the performance and safety of Rust. HexStack brings together three powerful libraries to create a unified full-stack development experience:

  • Ripress - Lightning-fast HTTP server (97% of Actix-Web performance)
  • Wynd - Simple, powerful WebSocket server
  • Lume - Type-safe ORM with intuitive API (coming soon)

Why Choose HexStack?

🚀 Unmatched Performance

  • HTTP performance: 97% of Actix-Web speed
  • WebSocket performance: Built on Tokio for maximum async efficiency
  • Nearly 10x faster than Express.js + Socket.io

💡 Superior Developer Experience

  • Express.js-familiar API that feels natural
  • Type-safe from the ground up
  • Comprehensive CLI for rapid scaffolding
  • Seamless integration between all components

⚡ Modern Architecture

  • Async/await support throughout
  • HTTP/2 support via Hyper
  • Real-time WebSocket capabilities
  • Production-ready from day one

Performance Benchmark

Table of Contents


Overview

HexStack is designed to be the Rails/Laravel of the Rust ecosystem - a complete, opinionated framework that provides everything you need to build modern web applications. With its CLI tool, you can scaffold new projects in seconds and start building immediately.

Features

  • 🔧 Powerful CLI - Scaffold projects with hexstack new
  • 🌐 HTTP + WebSocket - Unified server handling both protocols
  • 📦 Zero Configuration - Works out of the box with sensible defaults
  • 🏗️ Multiple Templates - HTTP-only, WebSocket-only, or full-stack apps
  • 🛡️ Type Safety - Compile-time guarantees throughout the stack
  • 🚀 Hot Reload - Fast development iteration (coming soon)
  • 📊 Built-in Middleware - CORS, logging, file uploads, rate limiting
  • 🔄 Real-time Ready - WebSocket support for live features

Installation

Install HexStack CLI globally:

cargo install hexstack

Or add individual components to an existing project:

cargo add ripress --features with-wynd
cargo add wynd --features with-ripress
cargo add tokio --features macros,rt-multi-thread

CLI Usage

Create a New Project

# Full-stack HTTP + WebSocket application
hexstack new my-app --template full

# HTTP-only application
hexstack new my-api --template http

# WebSocket-only application
hexstack new my-ws --template websocket

Available Templates

  • http - Ripress HTTP server only
  • websocket - Wynd WebSocket server only
  • full - Ripress + Wynd integrated server (default)

Examples

Full-Stack Application

use ripress::{app::App, types::RouterFns};
use wynd::wynd::{Wynd, WithRipress};

#[tokio::main]
async fn main() {
    let mut wynd: Wynd<WithRipress> = Wynd::new();
    let mut app = App::new();

    // WebSocket handling
    wynd.on_connection(|conn| async move {
        conn.on_text(|event, handle| async move {
            let _ = handle.send_text(&format!("Echo: {}", event.data)).await;
        });
    });

    // HTTP routes
    app.get("/", |_, res| async move {
        res.ok().text("Welcome to HexStack!")
    });

    app.get("/api/health", |_, res| async move {
        res.ok().json(json!({"status": "healthy"}))
    });

    // Mount WebSocket
    app.use_wynd("/ws", wynd.handler());

    app.listen(3000, || {
        println!("🚀 HexStack server running on http://localhost:3000");
        println!("📡 WebSocket available at ws://localhost:3000/ws");
    })
    .await;
}

HTTP-Only Application

use ripress::{app::App, types::RouterFns};

#[tokio::main]
async fn main() {
    let mut app = App::new();

    app.get("/", |_, res| async move {
        res.ok().json(json!({"message": "Hello from HexStack!"}))
    });

    app.use_cors(None)
        .use_rate_limiter(None);

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

WebSocket-Only Application

use wynd::wynd::{Wynd, Standalone};

#[tokio::main]
async fn main() {
    let mut wynd: Wynd<Standalone> = Wynd::new();

    wynd.on_connection(|conn| async move {
        println!("Client connected");

        conn.on_text(|event, handle| async move {
            println!("Received: {}", event.data);
            let _ = handle.send_text("Message received!").await;
        });

        conn.on_binary(|event, handle| async move {
            let _ = handle.send_binary(event.data.clone()).await;
        });
    });

    wynd.listen(3000, || {
        println!("📡 WebSocket server running on ws://localhost:3000");
    })
    .await
    .unwrap();
}

View more examples in the Examples directory.

Get Started

Ready to build something amazing? Get started in 30 seconds:

# Install HexStack CLI
cargo install hexstack

# Create a new full-stack app
hexstack new my-app

# Navigate and run
cd my-app
cargo run

Your server will be running on http://localhost:3000 with WebSocket support at ws://localhost:3000/ws.

Documentation

Ecosystem

HexStack is built on top of these powerful libraries:

Ripress - HTTP Server

  • 97% of Actix-Web performance
  • Express.js-inspired API
  • Built-in middleware ecosystem
  • Production ready v1.0+

Wynd - WebSocket Server

  • Event-driven async API
  • Automatic connection management
  • Type-safe message handling
  • Seamless HTTP integration

Lume - ORM (Coming Soon)

  • Type-safe queries
  • Schema-first approach
  • Migration system
  • Relationship handling

Performance

HexStack delivers exceptional performance across the stack:

  • HTTP: 97% of Actix-Web performance
  • WebSocket: Full async/concurrent connections
  • Memory: Efficient connection and resource management
  • Throughput: 10x faster than Express.js + Socket.io equivalents

Contributing

We don't take contributions yet, but your feedback is always welcome! If you have any questions or suggestions, feel free to reach out to us on X.

License

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


HexStack v0.3.0 - The Future of Rust Web Development