How We Rewrote 130K Lines from React to Svelte in Two Weeks
6 hours ago
- #AI-assisted development
- #performance optimization
- #frontend migration
- The team rewrote 130,000 lines of code from React to Svelte in two weeks using coding agents, resulting in a browser that is 2x faster.
- React's virtual DOM caused performance issues due to constant re-renders, especially with AI-driven UI updates, while Svelte's fine-grained reactivity reduced overhead.
- A strict Svelte ruleset was created to guide coding agents, enabling one engineer to complete most of the migration efficiently and maintain code quality.
- The migration was done feature-by-feature, testing each ported component, with tools like Cursor and Claude Code assisting in the process.
- Performance improvements included faster First Content Paint (from 300ms to 124ms), smoother AI token streams, and reduced re-renders by 10x.
- The rewrite allowed for codebase cleanup, removal of unused dependencies, and better test coverage, making it more manageable for LLMs and developers.