1 unstable release
| new 0.0.1 | Dec 30, 2025 |
|---|
#14 in #django
105KB
1K
SLoC
Ferreiro
A Django-inspired web framework for Rust, built on hexagonal architecture. For developers who want to build, not configure.
⚠️ Alpha Release: Ferreiro is in early development (v0.0.x). The core architecture is solid, but many features are still being implemented.
What Works Now
- ✅ Domain modeling with value objects and events
- ✅ In-memory repositories for testing
- ✅ HTTP server (Axum-based)
- ✅ Template engines (Tera, MiniJinja)
- ✅ Session management
Quick Start
use ferreiro::prelude::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Setup repositories
let repo = Arc::new(InMemoryPostRepository::new());
let events = Arc::new(InMemoryEventPublisher::new());
// Create service
let service = Arc::new(PostServiceImpl::new(repo, events));
// Create a post
let post = service.create(CreatePostCommand {
title: "Hello World".to_string(),
slug: "hello-world".to_string(),
body: "My first post".to_string(),
author_id: UserId::generate(),
}).await?;
// Build HTTP API
let app = Router::new()
.route("/", get(|| async { "Welcome to Ferreiro!" }));
// Start server
serve(app, "127.0.0.1", 8000).await?;
Ok(())
}
Architecture
Ferreiro follows hexagonal (ports and adapters) architecture:
- Domain: Pure business logic with zero framework dependencies
- Ports: Trait interfaces for repositories and services
- Adapters: Implementations for HTTP, databases, templates, etc.
This keeps your domain clean and makes everything swappable and testable.
Modules
domain: Domain models, value objects, and portsapplication: Service implementations and use cases- [
db]: Database adapters (currently in-memory, PostgreSQL/SQLite coming) http: HTTP server and routingtemplates: Template engines (Tera, MiniJinja)session: Session managementadmin: Admin interface (coming soon)prelude: Convenient imports for common use cases
Dependencies
~45–61MB
~1M SLoC