Four Packages for Laravel Rust: Trees, Comments, Maintenance Mode and Templates
Four packages I needed while moving my projects to Laravel Rust: nested set trees, comments with replies, maintenance mode for several servers, and email and document templates your team edits.
While moving my projects to Laravel Rust, I kept missing the same things: category trees, comments with replies, a proper maintenance mode, and emails whose text someone other than a programmer can change. So I built them as separate packages. All four are on crates.io and tested on SQLite, PostgreSQL and MySQL.
laravel-nestedset: trees in the database
Shop categories, site menus, comment threads, org charts. A whole subtree or every ancestor of a node is one indexed query. Moving a subtree takes a fixed number of UPDATEs, and every write locks its tree, so concurrent requests can't corrupt it.
shop.descendants().get().await?; // Phones, Android, iPhone, Laptops, Tablets
android.ancestors().get().await?; // Shop, Phones: breadcrumbs
shop.children().get().await?; // Phones, Laptops, Tablets
Category::leaves().get().await?; // Android, iPhone, Laptops, Tablets, Blog
Each of these is an ordinary model Builder, so you can keep filtering, paginating or counting it.
laravel-comments: comments on any model
Posts, products, tasks. Replies to any depth, moderation, reactions, @ mentions. A page of threads, with authors, reactions and the reader's own reactions, is read in seven queries, however many comments it holds.
let comment = Comment::post(post, Author::user(&user), "Great post!").await?;
let reply = comment.reply(Author::user(&user), "Thanks!").await?;
let page = Comment::threads(post)
.sort(Sort::Best)
.depth(3)
.get()
.await?;
The package is the backend only. You draw the UI with whatever your application uses: a template, Inertia and React, or htmx.
laravel-maintenance: maintenance mode for several servers
The state lives in the database, so every server behind a load balancer goes down and comes back together. While the site is down, your team still gets in: by IP address, by a token in a cookie or a header, or through a secret URL. Everyone else sees a 503 page with a countdown.
laravel maintenance:down \
--message="We'll be back in 30 minutes" \
--allow=192.168.1.1 \
--secret=let-me-in \
--ends-at="2026-12-24 03:00:00"
If you forget to run the migrations, the site doesn't go down: the package lets every request through and logs a warning.
laravel-template-engine: emails and documents your team edits
Your code declares a template type with its data, and everything else lives in the database: the text in every language, the subject, the sender, the recipients. A manager changes an email without a deploy. The same templates make documents, such as invoices, as HTML or PDF, and attach them to emails.
#[derive(Serialize, TemplateData)]
#[template(key = "order.placed", description = "A customer placed an order")]
pub struct OrderPlaced {
pub customer: Recipient,
pub order: Order,
}
laravel_template_engine::send(OrderPlaced { customer, order }).await?;
Templates run in a sandbox. They see only their type's data and can't call code or read files. Mistakes show up before saving, with the line number and a hint like "did you mean order.number?".
What's next
All four packages are open source, MIT or Apache-2.0. Laravel Rust is in beta, so I check the packages against every new release of the framework. If something is missing or doesn't work, open an issue on GitHub.
If you'd like to see how to build a complete application on Laravel Rust, from the first command to deployment, that's what my book Laravel Rust in Practice is about.