ullun-api
Express.js-inspired web framework for Rust — simple, fast, batteries-included
⚠️ Production Note: Requires proper deployment (TLS, auth, rate limiting). See Production Readiness below.
ullun (уллун; Yakutian/Sakha) = "large/great" — powerful yet simple
Why ullun-api?
The Problem: Actix-web is fast but complex. Rocket is ergonomic but heavy. Axum ties you to Tokio internals.
The Solution: An Express.js-style framework for Rust — single-file APIs, minimal boilerplate, maximum performance.
use *;
async
Features
- 🚀 Fast: Built on hyper + tokio, ~150KB compiled binary
- 🎯 Simple: Express.js-style routing, zero boilerplate
- 🔒 Type-safe: Path parameters validated at compile-time
- 🔗 Middleware: Chain middleware like Express.js
- 📦 Batteries-included: JSON serialization, error handling, CORS built-in
- 🎨 Ergonomic: Result<T, E> maps to HTTP status codes automatically
⚠️ Production Readiness
ullun-api is production-ready for small-to-medium APIs (<100k users), but requires proper deployment practices:
✅ Framework Provides
- Memory safety (zero
unsafecode) - Type-safe routing
- Graceful error handling
- CORS & security headers middleware
⚠️ User Must Implement
- Authentication/Authorization - Use middleware (see
examples/todo_api.rs) - Rate Limiting - Use reverse proxy (nginx/Caddy) or custom middleware
- TLS/HTTPS - Use reverse proxy (never expose raw HTTP in production)
- Input Validation - Validate business logic (framework validates types)
- SQL Injection Prevention - Use parameterized queries (sqlx, diesel)
- XSS Protection - Sanitize HTML output (if serving HTML)
📋 Pre-Production Checklist
- ✅ Implement authentication middleware
- ✅ Use reverse proxy (nginx/Caddy) for TLS termination
- ✅ Add monitoring/observability (Prometheus, Sentry)
- ✅ Follow SECURITY.md checklist
- ✅ Load test your specific workload (
wrk,hey,ab) - ✅ Set up error logging and alerting
See SECURITY.md for comprehensive security guidelines.
Installation
[]
= "0.1"
= { = "1", = ["full"] }
= { = "1", = ["derive"] }
= "1"
Quick Start
Hello World
use *;
async
Path Parameters
new
.get_with_params
.run
.await
.unwrap;
JSON Request Body
async
new
.post
.run
.await
.unwrap;
Middleware
use ;
new
.middleware
.middleware
.get
.run
.await
.unwrap;
API Reference
App
let app = new
.get // GET route
.post // POST route
.put // PUT route
.delete // DELETE route
.get_with_params // GET with path params extractor
.middleware // Add middleware
.run; // Start server
Handlers
Handlers can be:
- Async functions taking
Request→Result<Response> - Closures with path params:
Params→Result<Response>
// Full request access
async
// Path params only
.get_with_params
Error Handling
Errors automatically map to HTTP status codes:
return Err; // 400
return Err; // 401
return Err; // 403
return Err; // 404
return Err; // 500
return Err; // Custom
Middleware
Create custom middleware:
async
new
.middleware
// ...
Examples
See the examples/ directory:
hello_world.rs- Minimal examplefull_api.rs- Full CRUD API with middlewaretodo_api.rs- Complete TODO API with authentication
Run examples:
Test the API:
# GET /
# GET with path params
# POST with JSON
Comparison
| Framework | Bundle Size | Learning Curve | Middleware | Type Safety |
|---|---|---|---|---|
| Actix-web | 500KB | High | Complex | ★★★★☆ |
| Rocket | 600KB | Medium | Good | ★★★★★ |
| Axum | 300KB | Medium | Tokio-coupled | ★★★★☆ |
| ullun-api | ~150KB | Low | Express-style | ★★★★★ |
Testing & Benchmarks
# Run tests
# Run benchmarks
# Check coverage
See TESTING.md and PERFORMANCE.md for details.
Security
✅ No unsafe code
✅ Memory safe (Rust guarantees)
✅ No unwrap() in production paths
✅ Header validation (prevents malformed headers)
✅ Graceful error handling (no panics)
⚠️ User Responsibilities:
- Authentication/authorization implementation
- Rate limiting (reverse proxy or middleware)
- Input validation (business logic)
- SQL injection prevention (parameterized queries)
- XSS protection (if serving HTML)
See SECURITY.md for comprehensive guidelines and best practices.
Roadmap
v0.2
- OpenAPI/Swagger generation
- WebSocket support
- Static file serving
- Form data parsing
- Cookie handling
v0.3+
- Template engine integration
- Database connection pooling helpers
- Rate limiting middleware
- JWT authentication helpers
- Compression middleware
CI/CD
GitHub Actions workflows:
- ✅ CI: Test on Linux/macOS/Windows + Rust stable/beta
- ✅ Security: cargo-audit checks
- ✅ Format: rustfmt checks
- ✅ Lint: clippy checks
- ✅ Coverage: Code coverage reports
- ✅ Benchmarks: Performance tracking
- ✅ Release: Automated builds & publishing
See .github/workflows/ for details.
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Documentation
- Architecture Guide - Technical deep-dive
- Deployment Guide - Production deployment
- Testing Guide - Testing strategies
- Performance Guide - Optimization tips
- Security Policy - Security best practices
Acknowledgments
- Built on hyper and tokio
- Routing by matchit
- Inspired by Express.js
Made with ❤️ by yedoma-labs