ravel-cli-0.1.0 is not a library.
Ravel
A Laravel-inspired Rust web framework built on Axum, SeaORM, and Tokio — bringing Laravel's developer experience to the Rust ecosystem.
Quick Start
# Install the CLI
# Create a new project
# Start the dev server
Ravel running at http://127.0.0.1:3000
Features
CLI (ravel-cli)
ravel new <name> Create a new Ravel project
ravel serve Start the development server
ravel route:list List all registered routes
ravel key:generate Generate an application key
ravel make:controller <n> Scaffold a Controller
ravel make:middleware <n> Scaffold a Middleware
ravel make:model <n> Scaffold a SeaORM entity
ravel make:migration <n> Scaffold a migration
ravel make:seeder <n> Scaffold a Seeder
ravel make:provider <n> Scaffold a ServiceProvider
ravel make:request <n> Scaffold a FormRequest
ravel migrate Run pending migrations
ravel migrate:rollback Rollback migrations
ravel migrate:refresh Rollback all + re-apply
ravel migrate:fresh Drop all tables + re-apply
ravel migrate:status Show migration status
ravel db:seed Run database seeders
Service Container (ravel-core)
- DI Container — TypeId-based with singleton, transient factory, and pre-built instance support
- Freeze mechanism —
container.freeze()makes reads thread-safe for concurrent HTTP serving - Config repository — Load
.tomlfiles fromconfig/, access via dot-notation keys (app.name,database.port) - Env override —
APP_*environment variables automatically override TOML config values - Service Providers — Two-phase bootstrap (
register->boot), inspired by Laravel - Event dispatcher — Lightweight publish/subscribe event system
- Cache — In-memory TTL cache
use ;
let app = new
.load_config?
.register_provider
.boot?;
HTTP Layer (ravel-http)
- Route Builder — Fluent DSL with method chaining, grouping, and middleware
- Controller trait — Organize handlers into controller structs
- RavelRequest — Laravel-style request helpers (
req.query("page"),req.header("auth")) - ResponseBuilder — Fluent response construction (
response().json(data),response().redirect("/")) - FormRequest — Automatic JSON parsing + validation with 422 responses
- Validation — Rules: Required, Min, Max, Email, Regex, In
- Middleware — Built-in: error handler, request logger, CORS builder, Bearer token auth
- Unified error handling —
RavelErrorenum implementsIntoResponse, handlers can use? - ServerBuilder — Graceful shutdown via Ctrl+C, shared state injection
- View engine — Tera template rendering
use Route;
use middleware;
let router = new
.get
.post
.group
.middleware
.build;
use RavelError;
use response;
async
Database (ravel-db-core + ravel-db-seaorm)
- Multi-connection — Named connections from
config/database.toml - Lazy connection — Thread-safe, pools connections on first use
- Migration runner — CLI-driven with SeaORM migrations
- Pagination —
Page<T>withhas_more(),last_page(),count() - Decoupled —
ravel-db-coredefines traits;ravel-db-seaormis the SeaORM implementation
# config/database.toml
[]
= "postgres"
= "localhost"
= 5432
= "myapp"
= "user"
= "secret"
= 20
= 5
use ConnectionManager;
let manager = from_config?;
let db = manager.connect.await?;
Job Queue (ravel-support)
- Async jobs —
Jobtrait withasync fn handle(&self) -> Result<()> - Pluggable drivers — In-memory (default), Redis, and DB backends
- Retry with backoff — Configure
max_attempts()per job type - Dead-letter queue — Failed jobs tracked with error details and retry support
- Delayed dispatch —
queue.dispatch_later(job, Duration::hours(1)) - Task scheduler — Cron-style recurring tasks with
SchedulerDrivertrait - File storage —
Storagefacade withLocalDiskimplementation - Derive macro —
#[derive(Job)]with#[job(name = "...", queue = "...", max_attempts = N)]
use ;
use Job;
Project Structure
ravel/
├── crates/
│ ├── ravel-cli/ CLI tool (clap)
│ ├── ravel-core/ DI container, config, env, events, cache
│ ├── ravel-http/ Route builder, server, middleware, request/response
│ ├── ravel-db-core/ Database abstraction traits
│ ├── ravel-db-seaorm/ SeaORM implementation
│ ├── ravel-generator/ Code scaffolding (Tera templates)
│ ├── ravel-support/ Queue, scheduler, storage
│ ├── ravel-macros/ Proc-macros (#[derive(Job)])
│ └── ravel-test/ TestClient and response assertions
└── testblog/ Reference application + integration tests
Requirements
- Rust 1.82+ (edition 2024)
- PostgreSQL / MySQL / SQLite (for database features)
License
MIT