When building web applications in Rust, the common approach until now has been to start with an HTTP framework such as Axum or Actix Web and then pick separate crates for the ORM, routing, and so on. There were few full-stack options like PHP's Laravel, which comes with everything out of the box and lets you write code by following conventions.
On December 1, 2026, the Laravel team released the public beta of Laravel Rust, an official full-stack web framework written in Rust. Rather than a simple port of the PHP version, it is built on top of Axum and Tokio and combines Laravel's conventions with Rust's compile-time checks.
In this article, we'll build a task management CRUD app with Laravel Rust and see how it works in practice.
As of December 2, 2026, Laravel Rust is in public beta (0.1.x). Breaking changes to the API and configuration format may be introduced before the 1.0 release.
What Is Laravel Rust?
Laravel Rust is a full-stack Rust framework that embraces Laravel's full-stack philosophy, shipping with routing, middleware, an ORM, and more out of the box.
It is built on Axum for the HTTP layer and Tokio for the async runtime, so everything from HTTP handlers and DB queries to Redis, queues, S3, and WebSockets runs asynchronously. Blocking work such as local disk I/O is offloaded to Tokio's blocking thread pool, so a single slow operation is unlikely to hold up other requests.
In his letter to the community, creator Taylor Otwell explains that in an era where AI coding agents write large amounts of code, verification by a strict compiler, strong guardrails, and consistent conventions matter more than "the ease of writing code by hand in a dynamic language." He also makes clear that Laravel PHP is not entering maintenance mode and will continue to be developed in parallel.
Compared with Laravel for PHP, a key characteristic is that areas that used to rely on runtime checks or conventions have moved to compile-time checks.
- Route URL generation: Macros such as
route!(tasks::update, &task)andredirect!(index)generate URLs from handler functions, so path mismatches caused by route changes are detected at compile time - Input validation and authorization: Structs annotated with
#[laravel::input]must declare an authorization rule, and the build fails if it is missing.fills = Modelrestricts the allowed columns at the type level, so mass assignment caused by misconfigured$fillableor$guarded, as in the PHP version, can't happen - Models and N+1 query prevention: Column names, operators, and value types are checked at compile time, and relationships are never lazy-loaded implicitly; eager loading with
withis required - Migrations bundled into the binary: The Rust files in
database/migrations/are compiled into the executable, so you can run migrations without deploying source code to the production server
In the official benchmark on Laravel Cloud, the maximum error-free throughput was reported as 1,774 RPS for Laravel Rust versus 97 RPS for Laravel PHP (about 18x). Under a steady load of 50 RPS (measured over 5 minutes), peak CPU usage was 4.2% versus 52.4%. On the other hand, as a trade-off, the median cold build time in the cloud is longer for Laravel Rust at 3 minutes 1 second (27 seconds for the PHP version). For local development, the median incremental build time was reported as 1.1 seconds on an M4 Pro machine, for a change that adds one endpoint to a small test app (with a note that larger apps take longer).
Creating and Running a Project
Now let's create a project and get it running. You'll need Rust 1.99 or later, Node.js, and Git.
Installing the Laravel CLI
First, install the new Laravel CLI. Following the official installation guide, run the following command on macOS / Linux.
curl -fsSL https://laravel.com/install.sh | shOn Windows (PowerShell), run the following instead.
powershell -ExecutionPolicy Bypass -c "irm https://laravel.com/install.ps1 | iex"The binary is installed to ~/.laravel/bin/laravel. Open a new terminal and run laravel --version to confirm that the installation succeeded.
laravel --version
Laravel CLI 0.3.0Generating the Application
Create a project by passing the --rust option to laravel new. If you omit the option, you'll be asked interactively whether to use PHP or Rust.
laravel new task-app --rust
cd task-appThis command downloads the skeleton, creates .env and automatically generates APP_KEY, runs npm install, and performs the first Rust build, all in one go.
Switching to SQLite and Running the Initial Migrations
The default database for a newly created project is PostgreSQL. To try things out without setting up an extra database server locally, we'll switch to SQLite this time.
First, change database-postgres to database-sqlite in the features of laravel-rust in Cargo.toml.
[package]
name = "task-app"
version = "0.1.0"
edition = "2024"
rust-version = "1.99"
publish = false
# Keep `app` as the library name when renaming the package.
[lib]
name = "app"
[dependencies]
laravel-rust = { version = "0.1", features = ["database-sqlite", "redis", "sqs"] }
mimalloc = "0.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
tokio = { version = "1", features = ["fs", "io-util", "macros"] }
tracing = "0.1"
# Line tables keep panic and backtrace locations while making builds faster and binaries smaller.
[profile.dev]
debug = "line-tables-only"
[profile.dev.package."*"]
debug = falseBy convention, name = "app" in the [lib] section is kept even if you rename the project, and test code refers to the application's internals via app::*. Also, mimalloc is included in place of the default memory allocator, and the [profile.dev] section at the end contains settings that reduce build time and binary size.
Next, rewrite the two lines DB_CONNECTION and DATABASE_URL in .env for SQLite.
DB_CONNECTION=sqlite
DATABASE_URL=sqlite://storage/app/database.sqlite?mode=rwcAppending ?mode=rwc makes the SQLite file be created automatically on the first connection. After saving the settings, run the initial migrations.
laravel migrateYou'll see the following output, and initial tables such as users, sessions, cache, and jobs are created.
Migrating `0001_01_01_000000_create_users_table`...
Migrating `0001_01_01_000001_create_cache_table`...
Migrating `0001_01_01_000002_create_jobs_table`...
3 migrations ran.Checking That the Development Server Starts
Running laravel dev starts the Rust HTTP server, a queue worker, and Vite+ (vp dev) for the frontend all at once.
laravel devOnce it's up, open http://127.0.0.1:8000 to see the Laravel Rust welcome page. When you edit Rust code or .env, nodemon automatically rebuilds and restarts the server, and the browser also receives a laravel:restarted event and reloads itself to the latest state.
The Generated Directory Structure
Right after generation, the main directories and files look like this.
task-app/
├── .agents/skills/ # Skills for AI coding agents
├── .cargo/config.toml # Shared build directory settings
├── AGENTS.md
├── CLAUDE.md
├── Cargo.toml
├── build.rs # Build script that detects migration changes
├── database/
│ ├── migrations/ # Migrations written in Rust
│ └── seeders/
├── resources/
│ ├── css/app.css # Tailwind CSS v4 entry point
│ ├── js/
│ │ ├── app.tsx # Inertia.js v3 client initialization
│ │ └── pages/ # Inertia page components (React + TypeScript)
│ └── views/app.html # MiniJinja root HTML template
├── src/
│ ├── app.rs # Registers routing, authentication, and middleware
│ ├── config/ # Configuration structs
│ ├── console/ # Console commands
│ ├── http/
│ │ ├── handlers/ # Handlers, equivalent to controllers in the PHP version
│ │ └── middleware/
│ ├── models/ # Models, factories, and policies
│ ├── routes/ # web.rs / api.rs / channels.rs
│ └── testing.rs # Test app configuration (refresh_database, etc.)
├── tests/ # Feature tests (#[laravel::test])
├── package.json
└── vite.config.tsIf you've used Laravel for PHP, you'll immediately understand what directories like database/migrations/, resources/js/pages/, src/routes/web.rs, and src/models/ are for.
Building a Task Management Feature
From here, we'll implement, step by step, a minimal CRUD feature that lets you list tasks, create new ones, toggle their completion state, and delete them.
1. Creating a Migration
First, use laravel make:migration to generate a migration file for the tasks table.
laravel make:migration create_tasks_tableThis generates database/migrations/<timestamp>_create_tasks_table.rs, which already contains the table name "tasks" along with id and timestamps. Add the title and completed columns to it.
use laravel::db::AnyTransaction;
pub async fn migrate(tx: &mut AnyTransaction<'_>) -> laravel::Result<()> {
tx.schema()
.create("tasks", |table| {
table.id();
table.string("title");
table.boolean("completed").default(false);
table.timestamps();
})
.await
}Unlike migrations in the PHP version, Laravel Rust migrations are forward-only: there is no down function or rollback command. To undo a schema change, add a new migration, and during local development use laravel migrate:fresh to rebuild the database. Also, because the function takes &mut AnyTransaction<'_> as its argument, the migration runs inside a transaction on SQLite and PostgreSQL.
The official migration documentation explains that the forward-only design was chosen because "rolling back schema changes in production carries a high risk of losing production data when tables and columns are dropped." Accordingly, even when you want to undo a change that has already been applied, the expected workflow is to move forward by adding a new migration that reverses the change, rather than rolling back past migrations.
2. Defining the Model and Factory
Next, create src/models/task.rs and define the Task model and a TaskFactory for generating test data.
use laravel::model::{Faker, IntoCreate, create, factory, model};
use laravel::time::Timestamp;
#[model]
pub struct Task {
pub id: i64,
pub title: String,
#[default]
pub completed: bool,
pub created_at: Timestamp,
pub updated_at: Timestamp,
}
#[factory(Task)]
pub struct TaskFactory;
impl TaskFactory {
fn definition(fake: &mut Faker) -> impl IntoCreate<Task> {
create!(Task {
title: fake.sentence(),
})
}
pub fn completed(self) -> Self {
self.state(|task, _| task.completed(true))
}
}Here are the key mechanisms in this definition.
- The
#[model]macro automatically generatesClone,Debug,Serialize, and typed column constants (such asTask::idandTask::completed) - The
completedfield marked with#[default]uses the database's default value, so it can be omitted when callingcreate!(Task { title: ... }) - Since Rust has no one-class-per-file constraint, the convention is to put the model, policy, and factory together in the same
src/models/task.rs
Re-export the model from src/models/mod.rs so that other modules can refer to it as crate::models::Task.
mod task;
mod user;
pub use task::{Task, TaskFactory};
pub use user::{User, UserFactory};3. Implementing Typed Validation and Handlers
Next, create the handlers that receive and process requests in src/http/handlers/tasks.rs. In Laravel Rust, the logic that would live in a controller in the PHP version is written as async functions under src/http/handlers/.
use laravel::inertia::{self, Page, props};
use laravel::model::{create, update};
use laravel::prelude::*;
use crate::models::Task;
#[laravel::input(fills = Task)]
#[validate(anyone)]
pub struct StoreTask {
#[validate(required, max_length(120))]
pub title: String,
}
pub async fn index() -> laravel::Result<Page> {
let tasks = Task::query().order_by(Task::id.desc()).get().await?;
Ok(inertia::render("Tasks/Index", props! { tasks }))
}
pub async fn store(Valid(input): Valid<StoreTask>) -> laravel::Result<Redirect> {
create!(Task { ..input }).await?;
Ok(redirect!(index))
}
pub async fn update(mut task: Task) -> laravel::Result<Redirect> {
update!(task {
completed: !task.completed,
})
.await?;
Ok(redirect!(index))
}
pub async fn destroy(task: Task) -> laravel::Result<Redirect> {
task.delete().await?;
Ok(redirect!(index))
}This is where you can really feel what it's like to write Laravel Rust. Let's go over the role of each part.
#[laravel::input(fills = Task)]andStoreTask: Equivalent to aFormRequestin the PHP version. When you putValid(input): Valid<StoreTask>as the last argument of a handler, request body parsing, the authorization check, and validation all run automatically before the handler executes. Also, becausefills = Taskis specified,create!(Task { ..input })writes onlytitle, the field declared inStoreTask, and ignores any extra fields in the requestTask::query().order_by(Task::id.desc()): Columns are specified with the typed constantTask::idrather than a string. Writing a column name that doesn't exist results in a compile errormut task: Task/task: Task: Route model binding, just like in the PHP version. The target record is fetched automatically from{task}in the URL, and a 404 is returned if it doesn't existredirect!(index): Instead of writing the route path as a string, the redirect target is generated by referring directly to the handler functionindex
In this sample, StoreTask is marked with #[validate(anyone)], and the authorization check is also omitted from update and destroy. In production, always add ownership checks with #[validate(authenticated)] or #[policy] in addition to authentication middleware.
As an experiment, if you remove #[validate(anyone)] on line 8 of StoreTask and run cargo check, you get the following compile error.
error[E0277]: `StoreTask` doesn't say who may submit it
--> src/http/handlers/tasks.rs:19:34
|
19 | ... store(Valid(input): Valid<StoreTask>) -> laravel::Result<Redirect> {
| ^^^^^^^^^^^^^^^^ `StoreTask` doesn't implement `ValidatesRequest`
|
= note: implement `ValidatesRequest` for `StoreTask` with `async fn authorize(request: &Request) -> laravel::Result<bool>`, or add `#[validate(authorize(PostPolicy::update))]` to check a policy, or `#[validate(authenticated)]` to let any logged-in user submit it, or `#[validate(anyone)]` to let anyone submit itBecause the error clearly states that "it isn't declared who may submit this input" and even lists possible fixes, you can catch a forgotten authorization rule before it reaches production. Once you've confirmed this, put #[validate(anyone)] back.
Register the handler module in src/http/handlers/mod.rs.
pub mod tasks;
pub mod welcome;4. Registering Routes and Running the Migration
Add four routes for /tasks to src/routes/web.rs.
use laravel::prelude::*;
use crate::http::handlers::{tasks, welcome};
pub fn routes(route: &mut Router) {
route.get("/", welcome::show);
route.get("/tasks", tasks::index);
route.post("/tasks", tasks::store);
route.patch("/tasks/{task}", tasks::update);
route.delete("/tasks/{task}", tasks::destroy);
route.fallback(async || laravel::abort(404));
}Now run the migration and check the list of routes.
laravel migrate
laravel route:listlaravel migrate applies create_tasks_table, and laravel route:list shows the four routes we registered.
Method URI Handler
GET|HEAD / welcome::show
GET|HEAD /tasks tasks::index
POST /tasks tasks::store
PATCH /tasks/{task} tasks::update
DELETE /tasks/{task} tasks::destroy
GET|HEAD /api/version Closure
POST /broadcasting/auth laravel::channels::Channels
GET|POST|HEAD /_workflow/resume laravel::url::accept
ANY /{fallback} Closure5. Building the UI with Inertia.js + React
Finally, create the React page component that corresponds to inertia::render("Tasks/Index", props! { tasks }) in resources/js/pages/Tasks/Index.tsx.
import { Form, Head } from '@inertiajs/react';
type Task = {
id: number;
title: string;
completed: boolean;
};
type Props = {
tasks: Task[];
};
export default function Index({ tasks }: Props) {
return (
<>
<Head title="Tasks" />
<main className="mx-auto max-w-xl px-4 py-10">
<h1 className="text-2xl font-bold text-neutral-900">Tasks</h1>
<Form action="/tasks" method="post" resetOnSuccess className="mt-6">
{({ errors, processing }) => (
<div>
<div className="flex gap-2">
<label htmlFor="task-title" className="sr-only">
Task title
</label>
<input
id="task-title"
type="text"
name="title"
placeholder="Add a new task"
aria-invalid={Boolean(errors.title)}
aria-describedby={errors.title ? 'task-title-error' : undefined}
className="flex-1 rounded-md border border-neutral-300 px-3 py-2 text-sm focus:border-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-900"
/>
<button
type="submit"
disabled={processing}
className="rounded-md bg-neutral-900 px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
>
Add
</button>
</div>
{errors.title && (
<p id="task-title-error" className="mt-2 text-sm text-red-600">
{errors.title}
</p>
)}
</div>
)}
</Form>
<ul className="mt-6 divide-y divide-neutral-200 border-t border-b border-neutral-200">
{tasks.map((task) => (
<li
key={task.id}
className="flex items-center justify-between gap-3 py-3"
>
<Form action={`/tasks/${task.id}`} method="patch">
<button
type="submit"
aria-pressed={task.completed}
className={`text-left text-sm ${
task.completed
? 'text-neutral-400 line-through'
: 'text-neutral-900'
}`}
>
<span aria-hidden="true">
{task.completed ? '[x] ' : '[ ] '}
</span>
{task.title}
</button>
</Form>
<Form action={`/tasks/${task.id}`} method="delete">
<button
type="submit"
aria-label={`Delete ${task.title}`}
className="text-xs text-red-600 hover:underline"
>
Delete
</button>
</Form>
</li>
))}
</ul>
</main>
</>
);
}With the <Form> component from @inertiajs/react v3, attaching the CSRF token, managing the processing state while submitting, reflecting server-side validation errors in errors, and resetting the input on success all work together automatically.
The tasks prop receives the list of tasks that the Rust index handler fetched from SQLite, as is.
Check TypeScript types with the following command.
npm run types:checkTrying It Out and Testing
Let's run the task management app we built and see it in action.
Start laravel dev and open http://127.0.0.1:8000/tasks in your browser to see the task list screen.

Try the following operations and confirm that they work.
- Click the "Add" button with the input left empty, and Rust's
#[validate(required, max_length(120))]kicks in, showingThe title field is required.below the input - Add a task, and it appears in the list while the input is cleared automatically
- Click a task's title, and
PATCH /tasks/{task}is sent, switching it to the completed state with[x]and a strikethrough - Click "Delete" on a task you no longer need, and it is deleted via
DELETE /tasks/{task}and disappears from the list - Reload the browser, and the remaining two tasks persisted in SQLite (one incomplete, one completed) are still displayed
Writing Feature Tests with #[laravel::test]
Next, add HTTP-level feature tests to tests/tasks.rs. When an async function annotated with #[laravel::test] takes app: Application, a test application boots in memory without starting an external server. Because .refresh_database() is enabled in the skeleton's src/testing.rs, each test runs in its own isolated transaction, which is rolled back automatically when the test finishes.
First, create a test in tests/tasks.rs that checks that existing tasks are passed to the list screen.
use app::http::handlers::tasks;
use app::models::Task;
use laravel::testing::prelude::*;
#[laravel::test]
async fn tasks_index_renders_existing_tasks(app: Application) -> laravel::Result<()> {
let task = Task::factory()
.state(|t, _| t.title("Write Laravel Rust post"))
.create()
.await?;
app.get(route!(tasks::index)?)
.await
.assert_ok()
.assert_inertia()
.component("Tasks/Index")
.has("tasks")
.equals("tasks.0.id", task.id)
.equals("tasks.0.title", "Write Laravel Rust post")
.equals("tasks.0.completed", false);
Ok(())
}After creating one test record with Task::factory(), the test sends GET /tasks with app.get(...). app.get is the equivalent of $this->get() in Laravel for PHP, and it executes the request directly through routing and middleware. Using route!(tasks::index)? for the URL avoids hard-coding paths in the tests as well, and the test asserts HTTP 200 with assert_ok() and then checks the component name (Tasks/Index) and the contents of the tasks prop with the assert_inertia() chain.
Next, add a test to tests/tasks.rs that verifies a task is created by a form submission.
#[laravel::test]
async fn users_can_create_a_task(app: Application) -> laravel::Result<()> {
app.post(route!(tasks::store)?)
.form([("title", "Try Laravel Rust")])
.await
.assert_redirect_to(route!(tasks::index)?);
app.assert_database_has(
"tasks",
json!({
"title": "Try Laravel Rust",
"completed": false,
}),
)
.await;
Ok(())
}Chaining .form(...) onto app.post(...) sends the request body as form input. The test checks that the user is redirected to the list screen after the task is created (assert_redirect_to) and that the expected record was saved to the tasks table (assert_database_has).
Then, add a test that verifies an empty title is rejected by validation.
#[laravel::test]
async fn creating_a_task_requires_a_title(app: Application) -> laravel::Result<()> {
app.post(route!(tasks::store)?)
.form([("title", "")])
.await
.assert_invalid(&["title"]);
app.assert_database_count("tasks", 0).await;
Ok(())
}The test submits an empty title and confirms with assert_invalid(&["title"]) that a validation error is returned for the title field, and with assert_database_count("tasks", 0) that no record was added to the database.
Finally, add a test that verifies toggling an existing task's completion state and deleting it, in sequence.
#[laravel::test]
async fn users_can_toggle_and_delete_a_task(app: Application) -> laravel::Result<()> {
let task = Task::factory().create().await?;
app.patch(route!(tasks::update, &task)?)
.await
.assert_redirect_to(route!(tasks::index)?);
let updated = Task::find_or_fail(task.id).await?;
assert!(updated.completed);
app.delete(route!(tasks::destroy, &task)?)
.await
.assert_redirect_to(route!(tasks::index)?);
app.assert_model_missing(&task).await;
Ok(())
}The test passes a task created by the factory to route!(tasks::update, &task)?, sends app.patch, and confirms that completed has changed to true on the record re-fetched with Task::find_or_fail. It then sends a delete request with app.delete and verifies with assert_model_missing(&task) that the record is gone from the database.
Running cargo test, all six tests passed, including the two existing ones.
cargo test Running tests/api.rs
running 1 test
test the_api_reports_laravels_version ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
Running tests/tasks.rs
running 4 tests
test creating_a_task_requires_a_title ... ok
test users_can_create_a_task ... ok
test users_can_toggle_and_delete_a_task ... ok
test tasks_index_renders_existing_tasks ... ok
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
Running tests/welcome.rs
running 1 test
test the_welcome_page_renders ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06sSummary
- Laravel Rust is an official framework that redesigns Laravel's full-stack conventions on top of Axum and Tokio, shipping with routing, typed validation, an ORM, migrations, Inertia.js, and testing helpers out of the box
- It raises the safety that the PHP version left to runtime checks and conventions to the level of compile-time checks
- Migrations are forward-only: there is no rollback, and to undo a change you add a new migration
- Model column names, types, and operators are checked at compile time
- Putting
Valid(input): Valid<StoreTask>in a handler's arguments automatically performs request body parsing, the authorization check, and validation - You can build an SPA with Inertia.js v3 + React + TypeScript, and the
<Form>component from@inertiajs/reactautomatically handles attaching the CSRF token, managing the submitting state, reflecting validation errors, and resetting the input on success - When an async function annotated with
#[laravel::test]takesapp: Application, a test application boots in memory without starting an external server, so you can run HTTP-level feature tests quickly




