How we rewrote VisualCI in Laravel Rust
VisualCI's server now runs on Laravel Rust. Taylor Otwell announced its first beta on 1 December 2026. We decided to move VisualCI to it the next day, and production switched over on 3 December (New Zealand time). Until then, VisualCI ran on Loco and SeaORM.
Why Laravel Rust stood out
When I saw DHH rewrite Campfire in Rust, I started to get excited. Campfire in Rust is backwards compatible with the existing Rails app's database and sessions. So I started to think about what a Rust rewrite of DocSpring might look like, and I was even tempted to start porting some of Campfire's crates and modules to see how big the job would be.
We've also already started rewriting DocSpring's PDF engine in Rust, to get away from Prawn and some other unmaintained Ruby libraries we were using, and to fix a whole host of bugs to do with layout and formatting, especially in editable form fields.
That's the background to why the Laravel Rust announcement stood out to me so much. We had also already chosen Loco for our software search engine, Talira, so I already had some history with Rust for web development. When I saw the list of features Laravel Rust was offering, I was very impressed, and I knew I had to try it out for VisualCI.
I probably won't rewrite the search engine in Laravel Rust, because it's already very far along and working well with Loco. But we'll see.
Starting again before launch
VisualCI hadn't launched yet, so a rewrite was cheap: nobody had a setup we had to keep working, and we could start again with a fresh database. All of the code is open source, in DocSpring/visualci, so you can read the new server in app/ and compare it with the old one in the git history.
How the port went
We decided on 2 December, after the launch, and built a throwaway spike that night to decide go or no-go (below). It passed, so the port started straight away.
Two coding-agent sessions did the porting, each on its own pull requests. Over about 24 hours they merged 41 pull requests into app/, and 52 into main in all. Every pull request was reviewed independently before it merged. The new server is about 34,000 lines of Rust in app/, counting its source, tests and migrations, with 42 test files.
What we kept
Most of VisualCI isn't the web server. The fingerprints, the image and text diffing, baseline matching, the CLI and the renderers that draw PDF pages are plain Rust crates (visualci-core, snapshot-diff, visualci-cli, visualci-renderer). None of them depended on Loco or SeaORM, so they moved over without changes. The framework is only the shell around them: routes, models, queues and commands.
The old server had about 26,600 lines of Rust, 44 migrations and 33 model files. The models and the tests took most of the time, as we expected, since they were most of the code.
Checks before porting
Before porting anything, we built a throwaway app with two checks. If either failed, we'd stay on Loco.
- An MCP server under Laravel Rust. VisualCI's coding-agent interface is an MCP server built on rmcp, signed in with OAuth. The spike mounted rmcp's Streamable HTTP service at
/mcp, behind the OAuth guard from our own oauth-provider-laravel crate. A client registered, signed in, got a token and called the tools. - The data layer: migrations for a slice of the new schema, a model for each table, a model over a view, and a query that reads unchanged snapshots from an earlier build.
Both passed, along with a queued job and a stream of server-sent events. Laravel Rust's bundled docs answered every question we had during the spike.
The spike also gave us a first look at build times: on our build machine, a clean release build of the spike, which was only a slice of the app, took 77 seconds, against 125 seconds for the whole Loco server.
The finished server builds in about the same time as the old one. In CI's image job, with the shared compile cache warm, the dependencies took 28 seconds and the app crate 1 minute 58 seconds, about 2 minutes 26 seconds in all. The Loco server's release build step in the same job took 2 minutes 18 seconds. The binary is bigger: 59.2 MB stripped, against 41.8 MB for Loco, though the new server also does more than the old one did.
The old server's answers were the contract
Every MCP tool and REST endpoint had to answer exactly as before, because the CLI, the GitHub Action and coding agents already call them. The old server's tests recorded the JSON it returned for each request. The new server's tests replay the same requests and check all 150 recorded answers, field by field.
That made the port mostly mechanical. When an answer changed, the test showed which field and how, and we fixed the new code rather than the recording.
What fought the framework
Postgres arrays
A CI build stores its parent commits, and finding the nearest earlier build means a query like commit_sha = ANY($1). Laravel Rust 0.1.4 couldn't read a text[] column into a Vec<String>, and a bound Vec wasn't sent as an array, so Postgres answered "op ANY/ALL (array) requires array on right side".
For now, the parent commits are a jsonb column, and the lookup spreads the list into IN (...) with one parameter per commit. We sent laravel/rust-framework#527, which adds db::Array<T>: it binds as a native Postgres array and reads one back, in raw SQL and as a model column.
Composite primary keys
The new storage design records each unchanged group of snapshots once per build, in a build_groups table keyed by build and group. Laravel Rust models can't have a composite primary key yet (#499). We put the model's key on build_id and only ever query the table, never find or update a row by its key.
MCP tools and the request context
Laravel Rust keeps the current app, database connection and config in a task-local context. rmcp runs each tool call on a task of its own, so inside a tool, a query, a model or config() panicked: the context wasn't there.
Our handler puts the request's context into the request it forwards to rmcp, and each tool runs its database work inside that context. It's one helper, but every tool has to remember to use it. The fix belongs in the framework, so we sent laravel/rust-framework#520, which adds routing::service: a route served by any Tower service, called inside the request's context.
route.middleware(Authenticate).group(|route| {
route.any("/mcp", service(mcp::server()));
});
Both pull requests are still open. Until they merge, VisualCI uses the workarounds above.
Live updates without Laravel Cloud
The review page and the CLI's --wait follow a build as it's processed. Laravel Rust's bundled WebSocket server, Reverb, runs in a single process and is meant for local development. In production its docs point to managed Reverb on Laravel Cloud. VisualCI runs on our own Kubernetes cluster, so live updates will use the framework's server-sent events, with Postgres LISTEN/NOTIFY to reach every replica. They didn't make the cutover, and they're next.
What the tests didn't catch
The independent reviews caught real problems before anything went live: an open redirect after sign-in, repositories matched by their URL rather than their id, and the same email sent twice.
We also pointed VisualCI's own Playwright screenshot suite at the new app and reviewed the screenshots in VisualCI against the old server's baselines. That run found two things the unit tests had missed. The web app's JSON endpoints were missing entirely. And signing in failed with the database session driver, because a bigint column was holding a UUID. The unit tests used the memory session driver, so they never touched that column.
Before the switch
Just before the cutover, we squashed every migration into one initial schema, and checked it byte for byte against the old schema with pg_dump. We hadn't launched, so we kept no backwards compatibility: the production database was wiped and started fresh.
Two agents merging into one repository, with GitHub requiring each branch to be up to date with main, kept sending each other's green pull requests back through CI. We added a merge lock: an agent holds it from its final rebase until its merge, so only one pull request at a time goes through that last CI run.
What broke on the day
The bugs left at the end of a rewrite tend to be small ones, where the new code meets the old setup. These are the ones we hit on cutover day:
- Signing in sent you back to the homepage. The app looked for its session cookie by the old server's name, and Laravel Rust names it differently.
- Signing out showed the marketing homepage inside the app, for the same reason.
- Signing in could land you on a raw JSON response, because the framework had remembered an API call as the page to return you to.
- The MCP server refused every request. A guard in the MCP library accepted only the app's own hostname, not the MCP host.
- GitHub sign-in, Stripe and email were unset at first. The deploy config named the secrets' keys wrongly, and marking them optional hid the mistake.
- Sign-ups were open for a short time, because the old waitlist setting wasn't carried into the new config. No one got in.
- Processing stalled and uploads timed out: processing held a database lock on stored files while it did slow work.
- A deploy step still pointed at the old server's image name.
- Two behaviours we had copied faithfully from the old server turned out wrong in the new setup: the first build on any branch was approved automatically, and approvals on one branch could leak to others.
Each piece had passed its own tests, but the tests ran in a simpler setup than production: one host instead of four, sessions in memory, a fake GitHub sign-in. The parity run's two finds before the switch had the same cause.
So we're adding an end-to-end journey suite to CI that runs on a production-like setup, with all four hosts, database sessions and a GitHub stand-in. It walks through signing in, opening the app, signing out, MCP and onboarding, and every step's screenshot is reviewed in VisualCI. Each bug above is written first as a journey that fails without its fix.
What we published
- oauth-provider-laravel is an OAuth 2.1 server for MCP clients, as a Laravel Rust package, with PKCE, dynamic client registration, client ID metadata documents and token revocation. Version 0.1.1 added
OAUTH_AUTHORIZATION_ENDPOINT, because VisualCI's issuer is the MCP host while its consent page is on the web app's host, where people are signed in. - snapshot-testing-laravel takes browser screenshots and HTML, JSON and text snapshots in
#[laravel::test], with optional review in VisualCI. - We sent two pull requests to the framework:
routing::service(#520) anddb::Arrayfor Postgres arrays (#527).
What worked without fuss
In the spike, these worked the first time: raw-SQL migrations for a view, partial indexes and lz4 compression, a model over that view, JSON columns, jobs that hold models, the database queue with queue:work, and server-sent events.
If you build on Laravel Rust and want visual or snapshot tests for your app, that's what VisualCI does. Sign-ups are still closed while we finish the new onboarding, so signing in now puts you on the waitlist. Once they open, public open source projects get 1,000,000 credits a month free, and the quick start shows the setup.