🔥 Ignitia
A blazing fast, lightweight web framework for Rust
Ignite your development journey with performance and elegance
Getting Started • Documentation • Examples • Benchmarks
✨ What's New in v0.2.4
🚀 Major Performance Improvements
- 94% Latency Reduction: Middleware chain optimization (30ms → 1.9ms)
- 40% Memory Reduction: Optimized body handling with direct
Bytesusage - 51,574 req/sec: Production-ready throughput competing with Axum
🎯 Breaking Changes
- Radix-only routing (removed Base router mode)
- Unified
Json<T>type for both extraction and response - Optimized body types (
Arc<Bytes>→Bytes)
🎨 Enhanced Developer Experience
- New
IntoResponsetrait for ergonomic responses - Support for returning primitives (bool, numbers, Option, Result)
- Comprehensive documentation with examples
See CHANGELOG.md for complete details and migration guide.
📋 Table of Contents
- Features
- Quick Start
- Core Concepts
- Performance
- Documentation
- Examples
- Middleware
- State Management
- Error Handling
- Feature Flags
- Migration from v0.2.3
- Roadmap
- Contributing
- License
🎯 Features
Core Features
- 🚀 Blazing Fast: High-performance Radix tree routing with O(log n) lookup
- 🔥 Zero-Cost Abstractions: Compile-time optimizations with minimal runtime overhead
- 🎨 Ergonomic API: Intuitive builder pattern inspired by Axum and Actix
- 🛡️ Type-Safe: Leverage Rust's type system for compile-time guarantees
- 🔌 Middleware: Composable middleware system with
from_fnhelper - 📦 State Management: Built-in support for shared application state
- 🔒 Secure by Default: HTTPS/TLS, CORS, security headers, and rate limiting
- 🌐 WebSocket Support: Full-featured WebSocket implementation
- 📝 Rich Extractors: Path, Query, Json, Form, Headers, Cookies, State
v0.2.4 Enhancements
- ✨ IntoResponse Trait: Return any type that implements
IntoResponse - 🎯 Unified Json: Single
Json<T>type for both input and output - 🚄 Performance: 94% latency reduction through middleware optimization
- 📚 Documentation: Comprehensive rustdoc coverage with examples
- 🔧 Simplified API: Radix-only routing, infallible response builders
🚀 Quick Start
Installation
Add Ignitia to your Cargo.toml:
[]
= "0.2.4"
= { = "1", = ["full"] }
= { = "1.0", = ["derive"] }
Hello World
use ;
use SocketAddr;
async
RESTful API Example
use ;
use ;
async
🧠 Core Concepts
IntoResponse - New in v0.2.4
Return any type that implements IntoResponse:
use ;
use StatusCode;
let router = new
// Simple string
.get
// With status code
.post
// JSON response
.get
// Boolean (returns JSON true/false)
.get
// Numbers (returns as text/plain)
.get
// Option (auto 404 if None)
.get
// Result with automatic error handling
.get;
Radix Tree Routing
v0.2.4: Exclusively uses high-performance Radix tree routing
use Router;
let router = new
// Static routes
.get
.get
// Path parameters
.get
.get
// Multiple parameters
.get
// Wildcard routes
.get;
Performance: O(log n) lookup, zero allocations, 51,574 req/sec
Extractors
Type-safe request data extraction:
use ;
use Deserialize;
// Multiple extractors (up to 16)
async
Nested Routers
Organize routes by feature:
// API v1 routes
let api_v1 = new
.get
.post;
// API v2 routes
let api_v2 = new
.get
.post;
// Main router
let app = new
.get
.nest
.nest;
⚡ Performance
Benchmarks (v0.2.4)
Test Setup: wrk -c100 -d30s http://localhost:3000/
Throughput: 51,574 req/sec
Latency: 1.90ms avg, 10.60ms max
Transfer: 7.97 MB/sec
Consistency: 70.54% within 1 std dev
Performance Improvements (v0.2.4)
| Metric | v0.2.3 | v0.2.4 | Improvement |
|---|---|---|---|
| Avg Latency | 30ms | 1.9ms | 94% ↓ |
| Allocations | baseline | -40% | 40% ↓ |
| Throughput | ~45K RPS | 51.5K RPS | 14.5% ↑ |
Optimizations
- Middleware Chain: Pre-compiled at startup, lock-free runtime access
- Body Handling: Direct
Bytesusage, zero-copy for static content - Route Matching: Radix tree with O(log n) lookup, no regex compilation
- Response Building: Infallible builders, inline optimizations
Comparison with Other Frameworks
| Framework | Throughput | Latency (avg) |
|---|---|---|
| Ignitia v0.2.4 | 51,574 RPS | 1.90ms |
| Axum | ~50-70K RPS | ~2-3ms |
| Actix Web | ~60-80K RPS | ~1-2ms |
| Rocket | ~40-50K RPS | ~3-4ms |
Competitive with industry-leading frameworks while maintaining ease of use.
📚 Documentation
Comprehensive Guides
- API Reference - Complete API documentation
- Routing Guide - Advanced routing patterns
- Response Guide - Response types and IntoResponse
- Middleware Guide - Custom middleware creation
- State Management - Sharing state across handlers
- Error Handling - Error types and handling
- WebSocket Guide - Real-time communication
- TLS/HTTPS Guide - Secure connections
Online Documentation
- docs.rs - Comprehensive API documentation
- Examples - Working code examples
- CHANGELOG.md - Version history and migration guides
💡 Examples
With Middleware
use ;
let router = new
.middleware
.middleware
.get;
Custom Middleware with from_fn
use from_fn;
let auth = from_fn;
let router = new
.middleware
.get;
State Management
use Arc;
use ;
async
let state = AppState ;
let router = new
.state
.get;
WebSocket Support
use ;
let router = new
.websocket;
TLS/HTTPS
use Server;
let router = new
.get;
new
.enable_https?
.ignitia
.await?;
🔧 Middleware
Built-in Middleware
use ;
let router = new
.middleware
.middleware
.middleware
.middleware
.middleware
.middleware
.middleware; // 10MB
Custom Middleware
use ;
let custom = from_fn;
🗄️ State Management
Share state across handlers:
use Arc;
use RwLock;
use ;
let state = AppState ;
let router = new
.state
.get;
❌ Error Handling
Automatic Error Conversion
use ;
async
Custom Error Types
use IntoResponse;
;
🎛️ Feature Flags
Enable optional features in your Cargo.toml:
[]
= {
version = "0.2.4",
= ["tls", "websocket", "self-signed"]
}
Available Features
tls- HTTPS/TLS support with rustlswebsocket- WebSocket protocol supportself-signed- Generate self-signed certificates for development
🔄 Migration from v0.2.3
Router Mode Removal
// ❌ v0.2.3
let router = new
.with_mode;
// ✅ v0.2.4
let router = new; // Always uses Radix
Body Type Changes
// ❌ v0.2.3
response.body = new;
// ✅ v0.2.4
response.body = from;
Response Builders
// ❌ v0.2.3
async
// ✅ v0.2.4
async
Json Type
// ❌ v0.2.3
use Json as JsonExtractor;
use Json as JsonResponse;
// ✅ v0.2.4
use Json; // One type for both!
async
See CHANGELOG.md for complete migration guide.
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
# Clone the repository
git clone https://github.com/AarambhDevHub/ignitia.git
cd ignitia
# Run tests
cargo test
# Run benchmarks
cargo bench
# Check formatting
cargo fmt -- --check
# Run clippy
cargo clippy -- -D warnings
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
☕ Support & Community
If you find Ignitia helpful, consider supporting the project:
🙏 Acknowledgments
Design patterns and inspiration from:
- Axum - Middleware patterns, extractors, IntoResponse
- Actix Web - Performance optimizations
- Rocket - Response type ergonomics
Built with ❤️ using:
- Tokio - Async runtime
- Hyper - HTTP implementation
- Serde - Serialization
- Tower - Service abstractions
🔥 Ignite your development journey with Ignitia! 🔥
⭐ Star us on GitHub • 📖 Read the Docs • 💬 Join Discussion • 💬 Discord • ☕ Support