All posts

Your first Laravel Rust app: install, structure, and the build times nobody mentions

Published December 2, 2026 · by Majd Ghithan, written with the help of AI

Your first Laravel Rust app: install, structure, and the build times nobody mentions

If you've run laravel new a hundred times, the first ten minutes of Laravel Rust feel familiar. Then you hit your first cold build, and you remember you're in a compiled language now.

This is a walkthrough of getting a first app running, based on the official installation, structure, development and routing docs. Laravel Rust is in beta (0.1.x), and the docs say releases before 1.0 "may include breaking changes to APIs and configuration", so check the docs before copying anything into a real project.

What you need

According to the installation docs, you need Rust, Node.js and Git, and "Laravel needs Rust 1.99 or later."

Laravel ships a new installer for its CLI:

curl -fsSL https://laravel.com/install.sh | sh

It puts the laravel command in ~/.laravel/bin. One gotcha: Herd and the older Composer-based installer also provide a laravel command, so check which one you're running with laravel --version. The output should start with "Laravel CLI".

Create and run the app

laravel new example-app --rust
cd example-app

Then run the migrations and start everything:

laravel migrate
laravel dev

laravel dev starts your application, a queue worker, and Vite Plus all at once. Visit http://127.0.0.1:8000. There's also a health check at /up. To try a production build locally, run npm run build then cargo run --release.

Out of the box you get Inertia, React, TypeScript, Tailwind and Vite Plus, so the frontend side will feel like a modern Laravel starter kit.

The project structure

The root will look partly familiar: database/migrations/, database/seeders/, resources/, public/, storage/, tests/. The new pieces are Rust's: Cargo.toml and build.rs. The docs explain build.rs well: it "Rebuilds your application when you add a migration, because your migrations compile into the binary."

Inside src/:

  • app.rs configures the app, next to main.rs, lib.rs and testing.rs
  • routes/ with web.rs, api.rs and channels.rs
  • http/handlers and http/middleware
  • models/, config/ (database.rs, cors.rs, services.rs), console/, events/, listeners/

Your application's library is always named app.

One line from the structure docs deserves a sticky note on your monitor: "If you forget a mod line, Rust skips the file without a warning, and nothing in it runs." Coming from PHP autoloading, this is the mistake I expect every Laravel developer to make in week one. You create a file, nothing happens, no error. Check your mod lines first.

Routing and a handler

Route files are functions that receive a Router. They live in src/routes and are registered in src/app.rs. Routes in web.rs get sessions, encrypted cookies and CSRF protection. Routes in api.rs are stateless and get the /api prefix. Same split you know from PHP.

Here's route model binding, straight from the routing docs:

use crate::models::User;

pub fn routes(route: &mut Router) {
    route.get("/users/{user}", async |user: User| user.name);
}

The closure takes a User, so Laravel loads the user whose ID is in the URI. If no user has that ID, Laravel responds with a 404. Exactly the behavior you'd expect from Laravel PHP.

For anything bigger than a closure, Laravel Rust uses handlers, not controllers. The docs define them as "an async function that handles a request", with related handlers grouped in a module under src/http/handlers. A handler that renders a server-side view looks like this:

use laravel::prelude::*;
use laravel::view::View;

pub async fn show() -> View {
    view("greeting", data! { name => "James" })
}

The view is a .html file in resources/views, written in Jinja syntax, and every value is HTML-escaped automatically. Most new apps will lean on Inertia and React instead, but it's good to know plain server-rendered pages are there.

And since you'll ask: middleware is "an async function marked with #[middleware]" that receives the request and next:

use laravel::http::{Next, Request, Response, middleware};

#[middleware]
pub async fn ensure_token_is_valid(request: Request, next: Next) -> laravel::Result<Response> {
    if request.header("x-api-token") != Some("my-secret-token") {
        laravel::abort!(403);
    }

    Ok(next.run(request).await)
}

If you've written Laravel middleware, you can read this without knowing Rust.

Build times, honestly

This is the part the launch posts don't hide, and neither will I. Laravel's own Cloud post says: "There's a catch, and it's build time."

Median cold build on Laravel Cloud (Laravel benchmark)
27181Laravel PHPLaravel Rust
s

That's 3m 1s for Laravel Rust against 27s for Laravel PHP, with the slowest Rust build at 6m 4s. Locally, on an Apple M4 Pro, the cold dev build median was 19.4s, and an incremental rebuild after adding a small /foo endpoint was a median of 1.1s. The benchmark post adds that "these timings will be longer in larger applications", and those numbers come from a tiny app.

Watch your disk too. The development docs warn that "compiled artifacts can grow to tens of gigabytes on disk". New apps share a build cache at ~/.cargo/build/laravel-rust to soften that.

So the day-to-day loop is fine. The first build, and CI and deploy builds, are where you feel it.

My take

Walking through the docs for a first app felt a lot like my early laravel new days: familiar commands, familiar folders, routes that read like Laravel. The two things to prepare for are the compiler's pace on cold builds and the missing mod line trap. Start with a small tool, keep PostgreSQL running, give your disk some room, and treat it as beta. Next in this series, I'll get into models and why the ORM refuses to hide N+1 queries from you.

🤖 Heads up: this post was drafted with AI. Spot something wrong or off?Email me the correction →
Majd Ghithan

Majd Ghithan

Full-Stack Engineer & Tech Lead

More posts

Laravel in PracticeDec 2, 20266 min read

Laravel Go is here. What it is, how it differs from Laravel Rust, and where Goravel stands

On December 1, Laravel released the first beta of Laravel Rust. One day later, on December 2, Taylor Otwell published the first beta of Laravel Go. Two new official Laravel fram…

Laravel in PracticeDec 2, 20265 min read

The same Laravel ideas in three languages: PHP, Rust, and Go

The fastest way to understand a framework is to look at code you already know written in it. So instead of another feature list, this article puts the same Laravel concepts next…

Beyond the CodeDec 2, 20266 min read

Laravel PHP, Laravel Rust, or Goravel? Picking by fit, not by hype

As of December 2026 there are three ways to write an app with Laravel's ideas: the original in PHP, the new Laravel Rust beta, and Goravel in Go. They share a philosophy. They d…

Laravel in PracticeDec 2, 20265 min read

What is Goravel? Laravel's ideas, written in Go

Laravel Rust went into beta on December 1, 2026. It is the first time the Laravel team itself has taken the framework's conventions into a compiled language. It is not the first…

Beyond the CodeDec 2, 20264 min read

Laravel Rust is out. Should your team switch?

A week after the Laravel Rust beta landed on December 1, the question I keep getting is the same one: "Should we move our app to Rust?" For almost every team asking, my answer i…

Beyond the CodeDec 2, 20264 min read

Every new Laravel Rust app ships instructions for your AI agent

When I create a new Laravel project, one of the first things I do is add instructions for the coding agent: how this codebase is structured, which conventions to follow, which m…