Rust
Flock serves Laravel for Rust apps next to your PHP and Node.js sites, and brings what they need: the Rust toolchain and the laravel command.
Creating an app
cd ~/Code # a parked folder
laravel new my-app --rust
The laravel command comes with Flock, which keeps it at the newest release, and it makes PHP apps too (laravel new my-app --php). If you installed Laravel's installer with Composer before, your shell runs whichever laravel comes first on your PATH. flock rust list says when that is the old one: put Flock's bin folder, which it names, ahead of it.
Rust itself is a large download, so Flock gets it the first time a Rust app needs it: laravel new downloads it while it makes the app, from Flock's signed package list. The app is then at http://my-app.test.
Rust builds with your system's C compiler. On macOS that is Apple's Command Line Tools (xcode-select --install), on Linux your distribution's compiler package (build-essential, base-devel or gcc). On Windows the toolchain Flock installs links by itself.
How an app is served
A project whose Cargo.toml depends on laravel-rust is a Rust app: in a project folder it's served as one right away.
Flock runs the app's development processes for you. The first visit to http://my-app.test starts laravel dev in the project: the web server, a queue worker and Vite. A Rust app is compiled before it starts, which takes a few minutes the first time: the page that shows meanwhile says which crate is being compiled and how far the build is, and switches to the app once it answers. Later starts only build what changed. Changes to the code rebuild and restart the server, and changes to the frontend hot-reload.






If the code doesn't compile, the page shows the compiler's error until you fix it: save, and the app is built again.






The server gets a port of its own (SERVER_PORT), the same one every time while it's free, and the site's address as its APP_URL, so nothing in the project's .env needs to name either. After 30 minutes without visits it stops again, until the next one.
In Settings → Sites, a Rust app's Type is Rust. Its Dev server section shows whether it runs, with Start, Stop and Restart, and its output below.
flock type rust # serve the current project as a Rust app
flock logs my-app # the output of laravel dev
If Rust is missing when a Rust app is first served, Flock installs it in the background, and the site says so until it is there.
A Rust app can be shared at a public address like any other site.
The database
A new app uses PostgreSQL, in a database named laravel. With Flock's PostgreSQL running:
psql -c 'create database laravel'
laravel migrate
HTTPS
A secured site needs nothing in the project: Flock gives the app its https:// address as APP_URL, so the app knows it is served over HTTPS (its cookies are marked secure, for example).
Flock's web server sits in front of the app, so the app sees every request coming from your own machine. To have it read the forwarded headers instead, trust Flock's web server in src/app.rs:
.with_middleware(|middleware, _| {
middleware.trust_proxies(["127.0.0.1"]);
})
Rust and the Laravel CLI
Flock has one version of each, the newest release, with cargo, rustc, rustdoc and rustfmt on your PATH (cargo clippy and cargo fmt work too).
flock rust install # install them, or update to the newest
flock rust list # what the commands run
Flock updates the Laravel CLI by itself when a new release is out. Rust stays at the version it was installed with until you run flock rust install.
If you have Rust already, installed with rustup, Flock uses yours and installs only the Laravel CLI.
Windows: Smart App Control
Smart App Control, which is on for many new Windows 11 installs, only runs programs that are signed or that Microsoft's reputation service already knows. Rust's tools and the Laravel CLI are published unsigned, and so is every app you compile, so Windows may refuse to run them: laravel or cargo then ends with Windows blocked ..., or a build stops with An Application Control policy has blocked this file.
Flock can't allow a program there, and neither can an exclusion in Windows Security. To build Rust apps on such a machine, turn Smart App Control off under Windows Security → App & browser control → Smart App Control. On some versions of Windows 11 it can only be turned on again by resetting Windows, so check that first.