Laravel Rust in Practice
Build a real app with Laravel for Rust, from the first command to deploy
Laravel now runs on Rust. This book builds a complete blog with the official Laravel for Rust, from laravel new to your own server, and shows every place where a name you know from PHP behaves in a way you don't expect.
About the book
Laravel for Rust keeps Laravel's names: models, migrations, Form Requests, queues, mail, the scheduler, feature tests. That's what makes it easy to start, and it's also the trap. A familiar name with different behaviour is exactly the kind of bug that passes your tests and shows up in production.
This book builds one real application end to end and checks every step twice: the tests pass, and every page, form and button was clicked through in a browser. That second check is where most of the book comes from. Links that pointed at the wrong page. A Back button that emptied the search page. A whole page appearing inside a comment list. A migration that would have silently dropped every existing subscriber. Each one is in the chapter where it happened, with the fix and the reason a Laravel developer wouldn't see it coming.
You finish with a blog running in Docker on your own server: PostgreSQL, a queue worker, a scheduler, WebSockets and HTTPS.
The book keeps up with the framework. Laravel for Rust is in beta and moves fast. Each new release is checked against the blog: every step's code is rebuilt and tested on it, and the chapters are revised where something changed. On Leanpub every update is free.
What's inside
- Installing Laravel for Rust, the generated app, and a folder-by-folder map to the Laravel you know
- Models with typed columns and compile-time checks for required fields, factories, seeders and hooks
- MiniJinja templates instead of Blade, routes, and the template
route()trap - Relationships and eager loading, where nothing loads unless you ask
- Session login with rate limiting, policies, forms with validation, transactions, file uploads
- Queued jobs that wait for the commit, mail, console commands with prompts, the scheduler in UTC
- RSS, a sitemap, caching, titles, social cards and structured data
- Live search and inline actions with htmx, and the Back-button bug almost everyone ships
- Live comments with feature flags, broadcasting and rate limits
- A durable workflow that waits three days without holding a worker, plus signed URLs
- A JSON API with hashed bearer tokens, and an author's dashboard in React with Inertia
- 78 tests in one place, and a deploy with Docker Compose and Caddy
- 20 chapters, each step a tag in the companion repository axvilab/laravel-rust-in-practice
Who this book is for
Laravel developers who want to build with Laravel for Rust. You don't need to know Rust well: every Rust construct is explained the first time the blog needs it. For a proper foundation in the language, Rust for Laravel Developers covers exactly that. The two books also come as a bundle on Leanpub, from $32, less than buying them separately.
Free sample
The sample is a 54-page PDF with the introduction and the first three chapters: installing the framework, the posts model and the public pages. The full book is on Leanpub, in PDF and EPUB.