another conversion to Rust...
8x to 13x faster
Rebuilding the global town square from scratch
a summary of the X Engineering blog post detailing how the engineering team rebuilt X.com from scratch:
Overview & Motivation
- The Problem: The legacy web app (
rweb) relied on three separate servers to handle different audiences (regular users, search engine crawlers, and link-preview bots). This caused code fragmentation, slow performance on slow connections (taking over 22 seconds to show the first post), and maintenance overhead. - The Solution: A small team of engineers—utilizing AI coding agents—built a brand-new web application in under six months that consolidates all three servers into one single server.
Key Technical Stack
- Built using Vite, React (with streaming server-side rendering and Suspense), Fastify, Platformatic Watt (running on Node.js v26), Relay + GraphQL, TypeScript, and Tailwind CSS.
- XDS: A new component library built on Base UI and Tailwind CSS shared across multiple X web apps.
- Rust: The link-preview card image generator was completely rewritten in Rust for massive speed improvements.
Tailored Server-Side Rendering
The new server intelligently adapts its response based on who is making the request:
- Real People: Receive fast streaming HTML so content appears immediately.
- Verified Search Crawlers: Receive complete, fully-rendered documents (without client bundles or unnecessary router state) while carefully staying under Google's 2 MB limit.
- Link-Preview Bots: Receive only the required metadata headers, titles, descriptions, and card images without rendering unnecessary page bodies.
Development with AI Agents
- The team leveraged AI coding agents to handle heavy implementation tasks, port behavior, and write tests.
- Guardrails were strictly enforced via an explicit
AGENTS.mdinstruction file, customoxlintplugins (including an "anti-slop" filter), and pre-commit hooks to maintain high code quality.
Performance & Rollout Strategy
- Gradual Rollout: Logged-out traffic was moved first (retiring the old servers along the way), followed by signed-in users being migrated country by country using edge routing and feature switches.
- Dramatic Speed Gains: On throttled slow connections, the new app renders profiles and posts 8x to 13x faster than the old stack, cutting initial load times down to roughly 2.7 seconds.
