Features¶
Every feature in Cello is implemented in Rust for maximum performance. From radix-tree routing to SIMD JSON parsing, Cello delivers C-level speed with a Python-native developer experience. Explore the full feature set below.
Feature Overview¶
mindmap
root((Cello Framework))
Core
Routing
Requests
Responses
Blueprints
Async
SIMD JSON
Middleware
CORS
Compression
Logging
Rate Limiting
Caching
Circuit Breaker
Security
JWT Auth
RBAC Guards
Sessions
CSRF
Security Headers
API Keys
Real-time
WebSocket
SSE
Advanced
Dependency Injection
Background Tasks
Templates
Static Files
DTOs
OpenAPI
Enterprise
Database Pooling
Redis
GraphQL
gRPC
Message Queues
Patterns
Event Sourcing
CQRS
Saga Feature Categories¶
-
Core
The foundation of every Cello application -- high-performance routing, request/response handling, and async-first design.
- Radix-tree routing (~100ns lookup)
- Lazy body parsing & headers
- JSON, HTML, streaming responses
- Flask-like blueprints
- Sync & async handlers
- SIMD-accelerated JSON
v0.1.0 -
Middleware
A rich middleware suite built entirely in Rust with zero-allocation processing and composable pipelines.
- CORS handling
- Gzip compression
- Structured logging
- Token bucket & sliding window rate limiting
- Smart caching with TTL
- Circuit breaker fault tolerance
v0.2.0 - v0.6.0 -
Security
Enterprise-grade security with constant-time operations and defense-in-depth architecture.
- JWT, Basic & API Key auth
- RBAC guards with composable roles
- Secure cookie sessions
- CSRF double-submit protection
- CSP, HSTS, X-Frame-Options
- Constant-time token comparison
v0.4.0 - v0.5.0 -
Real-time
Bidirectional and server-push communication powered by Tokio's async runtime.
- WebSocket with message framing
- Server-Sent Events streaming
- Multi-client broadcasting
- Connection health monitoring
v0.3.0 -
Advanced
Power features for complex applications -- from dependency injection to auto-generated API documentation.
- FastAPI-style dependency injection
- Post-response background tasks
- Jinja2-compatible templates
- Efficient static file serving
- Multipart file uploads
- DTO validation & OpenAPI/Swagger
v0.3.0 - v0.6.0 -
Enterprise
Production-grade integrations for databases, caches, message queues, and multi-protocol APIs.
- Async connection pooling with health checks
- Redis with Pub/Sub & cluster support
- GraphQL queries, mutations & subscriptions
- gRPC with streaming support
- Kafka, RabbitMQ & SQS adapters
v0.8.0 - v0.9.0 -
Advanced Patterns
Battle-tested architectural patterns for building resilient distributed systems.
- Event Sourcing with aggregate roots & snapshots
- CQRS command/query separation
- Saga pattern for distributed transactions
- Event replay & compensation logic
v0.10.0
Feature Comparison¶
How does Cello stack up against popular Python web frameworks?
| Feature | 🎵 Cello | FastAPI | Flask | Django |
|---|---|---|---|---|
| Rust-powered hot path | ||||
| SIMD JSON parsing | ||||
| Radix-tree routing | ||||
| Async support | 1 | 2 | ||
| Dependency injection | ||||
| Auto OpenAPI docs | 3 | |||
| WebSocket | ||||
| Built-in JWT auth | ||||
| RBAC guards | ||||
| Rate limiting | ||||
| Circuit breaker | ||||
| HTTP/2 & HTTP/3 | ||||
| Cluster mode | ||||
| GraphQL | ||||
| gRPC |
Quick Feature Tour¶
from cello import App, Depends
app = App()
def get_db():
return Database()
@app.get("/users/{user_id}/posts/{post_id}")
def get_post(request, db=Depends(get_db)):
return {
"user_id": request.params["user_id"],
"post_id": request.params["post_id"],
"posts": db.get_posts(request.params["user_id"])
}
from cello import App
from cello.middleware import JwtConfig, JwtAuth
app = App()
jwt_config = JwtConfig(secret=b"your-secret-key-min-32-bytes-long")
app.use(JwtAuth(jwt_config))
@app.get("/protected")
def protected(request):
claims = request.context.get("jwt_claims")
return {"user": claims["sub"], "role": claims.get("role")}
from cello import App
app = App()
clients = set()
@app.websocket("/ws/chat")
def chat(ws):
clients.add(ws)
ws.send_text("Welcome!")
try:
while True:
msg = ws.recv()
if msg is None:
break
for client in clients:
if client != ws:
client.send_text(f"User: {msg.text}")
finally:
clients.discard(ws)
from cello import App
from cello.enterprise import Database, Redis
app = App()
db = Database("postgresql://localhost/mydb", pool_size=20)
cache = Redis("redis://localhost:6379")
@app.get("/users/{id}")
async def get_user(request):
user_id = request.params["id"]
cached = await cache.get(f"user:{user_id}")
if cached:
return cached
user = await db.fetch_one("SELECT * FROM users WHERE id = $1", user_id)
await cache.set(f"user:{user_id}", user, ttl=300)
return user
Performance Characteristics¶
All features are optimized at the Rust level for minimal overhead:
| Feature | Overhead | Implementation |
|---|---|---|
| Routing | ~100ns | Radix tree lookup via matchit |
| JSON Parsing | ~1us/KB | SIMD acceleration via simd-json |
| JWT Validation | ~50us | Constant-time comparison via subtle |
| Rate Limiting | ~100ns | Lock-free counters via DashMap |
| Compression | ~1us/KB | Native gzip in Rust |
| Middleware Chain | ~1us | Zero-allocation pipeline |
| Session Lookup | ~200ns | In-memory with DashMap |
Version History¶
v0.1.0 -- Foundation
Routing | Request handling | Response types | SIMD JSON | Async support
v0.2.0 -- Middleware Engine
CORS | Compression | Logging | Blueprints
v0.3.0 -- Real-time & Uploads
WebSocket | SSE | Multipart uploads
v0.4.0 -- Security & Scale
JWT/Basic/API Key auth | Rate limiting | Sessions | Security headers | Cluster mode | TLS/SSL | HTTP/2 & HTTP/3
v0.5.0 -- Developer Experience
Dependency injection | RBAC guards | Prometheus metrics | OpenAPI/Swagger | Background tasks | Templates
v0.6.0 -- Smart Middleware
Smart caching with TTL | Adaptive rate limiting | DTO validation | Circuit breaker
v0.8.0 -- Data Layer
Async database pooling | Redis integration | :material-swap-vert: Transaction management
v0.9.0 -- API Protocols
GraphQL | gRPC | Kafka, RabbitMQ & SQS
v0.10.0 -- Advanced Patterns
Event Sourcing | CQRS | Saga pattern
Next Steps¶
-
Core Features
Start with routing, requests, and responses
-
Middleware
Add CORS, compression, rate limiting and more
-
Security
Secure your app with JWT, guards, and headers
-
Real-time
Build with WebSocket and Server-Sent Events
-
Advanced
Dependency injection, tasks, templates and DTOs
-
Enterprise
Database, Redis, GraphQL, gRPC, and more