Runique
A Django-inspired Rust web framework
Runique is a modern web framework that combines Rust's safety and performance with Django's ergonomics. It offers a familiar development experience for Django developers while leveraging the power of Rust's type system.
🚀 Main Features
Django-like Architecture
- Declarative routing with
urlpatterns!macro - Intuitive ORM based on SeaORM with Django-style API
- Template system Tera with custom preprocessing
- Automatic form generation via procedural macros
- Flash messages between requests
- Static and media file management
Built-in Security
- ✅ CSRF Protection (HMAC-SHA256)
- ✅ Content Security Policy (CSP) with nonces
- ✅ XSS Sanitization (ammonia)
- ✅ Automatic Security Headers (HSTS, X-Frame-Options, etc.)
- ✅ ALLOWED_HOSTS Validation
- ✅ Integrated Argon2id Hashing
Multi-database Support
- PostgreSQL
- MySQL / MariaDB
- SQLite
Modern Development
- Native Async/await with Tokio
- Type-safe thanks to Rust's type system
- Zero-cost abstractions
- Hot reload in development
- Complete documentation in French and English
📦 Installation
Prerequisites
- Rust 1.75+ (install Rust)
- Cargo
Add Runique to Your Project
# Cargo.toml
# Minimal configuration (SQLite by default)
[]
= "1.0.0"
# With PostgreSQL
[]
= { = "1.0.0", = ["postgres"] }
# With MySQL
[]
= { = "1.0.0", = ["mysql"] }
# With MariaDB
[]
= { = "1.0.0", = ["mariadb"] }
# With all databases
[]
= { = "1.0.0", = ["all-databases"] }
Available Cargo Features
| Feature | Description | Default |
|---|---|---|
default |
Enables ORM support with SQLite | ✅ |
orm |
Enables SeaORM | ✅ (included in default) |
sqlite |
SQLite driver | ✅ (included in orm) |
postgres |
PostgreSQL driver | ❌ |
mysql |
MySQL driver | ❌ |
mariadb |
MariaDB driver (uses MySQL driver) | ❌ |
all-databases |
Enables all drivers simultaneously | ❌ |
Configuration examples:
# SQLite only (default configuration)
[]
= "1.0.0"
# PostgreSQL + MySQL
[]
= { = "1.0.0", = ["postgres", "mysql"] }
# All databases
[]
= { = "1.0.0", = ["all-databases"] }
# Without ORM (minimal framework)
[]
= { = "1.0.0", = false }
Create a New Project
Add Runique to Cargo.toml:
[]
= { = "1.0.0", = ["postgres"] }
= { = "1", = ["full"] }
= { = "1", = ["derive"] }
🏁 Quick Start
Minimal Application
// src/main.rs
use *;
async
async
async
pub async
pub async
Configuration (.env)
HOST=127.0.0.1
PORT=8000
SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1
DEBUG=true
# PostgreSQL
DB_ENGINE=postgres
DB_USER=user
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydb
Launch
📚 Complete Documentation
📚 Documentation (English)
- 🚀 Getting Started
- ⚙️ Configuration
- 🗄️ Database
- 📝 Forms
- 🎨 Templates
- 🔒 Security
- 🛣️ Macro
- 🔧 changelog
- 🚀 Contribuer
- 🆕 New project
- 📖 Documentation Overview
📚 Documentation (French)
- 🚀 Getting Started
- ⚙️ Configuration
- 🗄️ Database
- 📝 Forms
- 🎨 Templates
- 🔒 Security
- 🛣️ Macro
- 🔧 changelog
- 🚀 Contribuer
- 🆕 New project
- 📖 Documentation Overview
🎯 Complete Example
Project Structure
my_app/
├── Cargo.toml
├── .env
├── src/
│ ├── main.rs
│ ├── models/
│ │ └── mod.rs
│ ├── views/
│ │ └── mod.rs
│ ├── forms/
│ | └── mod.rs
│ └── urls/
│ └── mod.rs
├── templates/
│ ├── base.html
│ └── index.html
└── static/
├── css/
└── js/
Model (models/mod.rs)
use *;
use impl_objects;
// Django-like API
impl_objects!;
Form (forms/mod.rs)
use *;
View (views/mod.rs)
use *;
use crate;
use cratePostForm;
pub async
pub async
Template (templates/posts/list.html)
{% extends "base.html" %}
{% block content %}
Articles
{% for post in posts %}
{{ post.title }}
{{ post.content|truncate(200) }}
Read more
{% endfor %}
Create article
{% endblock %}
Routes (main.rs)
use *;
🔒 Security
Runique integrates multiple security layers by default:
CSRF Protection
new.await?
.middleware
.routes
.run
.await?;
In templates:
{% csrf %}
<!-- form fields -->
Content Security Policy
use CspConfig;
let csp_config = CspConfig ;
new.await?
.middleware
.with_default_middleware
.routes
.run
.await?;
Security Headers
new.await?
.middleware
.with_default_middleware
.routes
.run
.await?;
Headers automatically configured:
Strict-Transport-SecurityX-Content-Type-OptionsX-Frame-OptionsX-XSS-ProtectionReferrer-PolicyPermissions-Policy
🗄️ Database
Django-like API
use crate;
// Retrieval
let all_users = objects.all.all.await?;
let user = objects.get.await?;
// Filtering
let active_users = objects
.filter
.filter
.all
.await?;
// Ordering and pagination
let recent_users = objects
.order_by_desc
.limit
.all
.await?;
// Count
let count = objects.count.await?;
Migrations
Use sea-orm-cli for migrations:
# Create a migration
# Apply
# Rollback
🎨 Templates
Custom Tags
<!-- Static files -->
<!-- Media files -->
<!-- CSRF token -->
{% csrf %}
<!-- ... -->
<!-- Flash messages -->
{% messages %}
<!-- Links with reverse routing -->
Details
<!-- CSP nonce (if enabled) -->
📦 Utility Macros
Runique provides macros to simplify common operations.
Flash Messages
use *;
async
Advantages:
- Concise and expressive syntax
- Automatic handling of
.await.unwrap() - Support for multiple messages
- More readable and maintainable code
Available macros:
success!(message, "text")- Success messageserror!(message, "text")- Error messagesinfo!(message, "text")- Information messageswarning!(message, "text")- Warning messages
🚀 Performance
Runique leverages Rust and Tokio performance:
- Zero-cost abstractions: No runtime overhead
- Native async/await: Efficient concurrency with Tokio
- Connection pooling: Optimized DB connection management
- Optimized compilation: Highly optimized binary
Benchmark (example)
Requests/sec: ~50,000
Latency p50: ~1ms
Latency p99: ~5ms
Memory: ~20MB
🛠️ Development
Tests
Linting
Formatting
Documentation
🤝 Contributing
Contributions are welcome! Here's how to contribute:
- Fork the project
- Create a branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Guidelines
- Write tests for new features
- Follow Rust code conventions (rustfmt)
- Document public APIs
- Add examples if relevant
📝 Roadmap
Version 1.1 (Q1 2026)
- Integrated authentication system
- Auto-generated admin panel
- Rate limiting middleware
- WebSocket support
- Cache layer (Redis)
Version 1.2 (Q2 2026)
- CLI for scaffolding
- Improved hot reload
- GraphQL support
- Background jobs (Tokio tasks)
Version 2.0 (Q3 2026)
- Plugin system
- Multi-tenancy
- Internationalization (i18n)
- Advanced ORM features
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
🙏 Acknowledgments
Runique builds upon excellent libraries from the Rust ecosystem:
- Axum - Web framework
- Tokio - Async runtime
- SeaORM - ORM
- Tera - Template engine
- Tower - Middleware
- Argon2 - Password hashing
- ammonia - HTML sanitization
📧 Contact
- GitHub Issues: github.com/seb-alliot/runique/tree/issues
- Discord: Join the server
- Email: alliotsebastien04@gmail.com
⭐ Support the Project
If Runique is useful to you, consider:
- ⭐ Starring on GitHub
- 🐛 Reporting bugs
- 💡 Suggesting features
- 📖 Improving documentation
- 🤝 Contributing code
Build secure and performant web applications with Runique!
Version: 1.0.0 (Corrected - January 2, 2026) License: MIT
Documentation created with ❤️ by Claude for Itsuki