Skyzen
A fast, ergonomic HTTP framework for Rust that works everywhere - from native servers to WebAssembly edge platforms.
Getting Started
[]
= "0.1"
The simplest Skyzen app:
use ;
Run with cargo run and visit http://127.0.0.1:8787.
Routing
Skyzen's routing system is built around Route::new() and intuitive path methods:
use ;
WebSocket Support
Add WebSocket endpoints with the .ws convenience method:
use ;
use WebSocketUpgrade;
new
WebSocket works on both native (via async-tungstenite) and WASM (via WebSocketPair).
The #[skyzen::main] Macro
For HTTP servers, #[skyzen::main] is the recommended way to start your app. It provides:
- Pretty logging with
tracing(respectsRUST_LOG) - Graceful shutdown on
Ctrl+C - CLI overrides for host/port (
--port,--host,--listen) - Tokio + Hyper runtime configured and ready
Disable the default logger if you want to configure your own:
async
WASM Deployment
The same code compiles to WebAssembly for edge platforms:
On WASM targets, #[skyzen::main] exports a WinterCG-compatible fetch handler that works on Cloudflare Workers, Deno Deploy, and other edge runtimes.
Custom Server Usage
For advanced scenarios like embedding Skyzen or using a custom runtime, implement the Server trait directly:
use ;
use Hyper;
async
The Server trait gives you full control over:
- Which executor to use (not tied to Tokio)
- Connection handling and error recovery
- Integration with existing infrastructure
Extractors & Responders
Pull data from requests with extractors:
use Json;
use Params;
async
Return anything that implements Responder:
async
OpenAPI Documentation
Generate API docs automatically:
async
License
MIT or Apache-2.0, at your option.