Skip to content

Back to the catalog

Lovable’s OJ Rewrites Vite’s Dev Server in Rust as AI Lowers the Cost of Forking Open Source
socket.devarticle

Lovable’s OJ Rewrites Vite’s Dev Server in Rust as AI Lowers the Cost of Forking Open Source

Lovable built OJ, a Rust-based replacement for Vite's dev server built on the same Rolldown and Oxc components used by Vite 8, to serve roughly one million daily short-lived cloud dev sandboxes; OJ cut median sandbox acquisition time from 14.5s to 3s and reduced dev-server memory use roughly 6.5x. The article uses OJ as a case study for Vite creator Evan You's argument that AI is collapsing the cost of reimplementing open-source dependencies, leading companies to maintain narrow tailored forks optimized for their own workloads rather than upstreaming changes, with fragmentation risks for maintenance and security patching.

TL;DR Lovable's AI-assisted Rust rewrite of Vite's dev server (OJ) illustrates how AI is lowering the cost of forking open-source infrastructure.
Document

What it adds beyond the summary

The summary gives the headline production numbers (14.5s→3s, ~6.5x memory) and Evan You's forking thesis. What it omits is the architecture of the rewrite, the disputed benchmarks, and the compatibility caveats that an engineer evaluating OJ would need.

How it works

OJ is not a full Vite rewrite — only the dev server layer. It moves the file watcher, module graph, compiler coordination, hot updates, and WebSocket handling into a Rust binary, while reusing the same Rolldown (bundling) and Oxc (parsing/transform) components that power Vite 8. It reads an existing vite.config.ts and runs Vite/Rollup-style plugins through a compatibility bridge, spawning a small Node process only when an app needs JavaScript plugins or server-side modules.

flowchart TD
    A[vite.config.ts] --> B[OJ Rust binary]
    B --> C[watcher / module graph / HMR / WebSocket]
    B --> D{needs JS plugin<br/>or SSR module?}
    D -->|yes| E[spawn small Node process]
    D -->|no| C

The narrow target is the whole point: OJ only covers the code paths Lovable's preview sandboxes use, so it can optimize aggressively where Vite must stay general.

Evidence

The benchmark story is more contested than the summary implies:

  • Lovable's original comparison (10,000-component synthetic React app): OJ cold-start ~1.2s vs Vite 4.9s, memory ~115 MB vs >1.5 GB. But this pitted bundle-mode OJ against Vite's unbundled default.
  • Evan You called that "somewhat misleading." Bundled-vs-bundled cold start is nearly even: 1,315 ms OJ vs 1,528 ms Vite. HMR was effectively even.
  • Memory is where the real gap survives: 115 MB vs 1,751 MB bundled. Even with the Node plugin host running against a real config, OJ reportedly used under one-third of Vite's memory. This matters because, per Lovable's Jonathan Grahl, memory is a dedicated (non-shareable) resource, so lower memory means more sandboxes per host. OJ idles around 400 MB.
  • Compatibility was tested against Excalidraw and Twenty (frontend ~15,000 modules), both running "unchanged"; covered regex aliases, source files outside app root, TypeScript enums, import.meta.env, and plugin virtual modules.

Limits

  • One of Lovable's real-app speed comparisons ran vite-plugin-checker (a TypeScript worker) on the Vite side, which OJ doesn't support and skipped — inflating the largest speed win. The memory advantage is not explained away by this.
  • The impressive cold-start numbers largely evaporate under a fair bundled comparison; adopt OJ for memory density, not startup speed.
  • Fragmentation risk is concrete: a Vite-compatible server does not automatically receive fixes or security patches made to Vite's Node dev server, and "compatibility" means something different per fork. This is the "slop fork" future You flags (alongside TanStack's Redact as another "tailored projection").

Organisations named here

  • Lovable
  • VoidZero
  • TanStack
  • Evan You
  • Jonathan Grahl
  • Raphael Amorim
  • Redact
  • Twenty

Technologies named here

  • OJ
  • Vite
  • Rolldown
  • Oxc
  • pnpm
  • SWC
  • Biome
  • Oxc-related tooling / Rolldown ecosystem
  • Rspack
  • Turbopack
  • TanStack Redact
  • Rollup
  • webpack
  • vite-plugin-checker
  • Rust
  • Excalidraw

Techniques named here

  • Compatibility bridge
  • Tailored projection of an open source dependency