The Best Strategy for Building an Internal UI Kit with Replay Component Extraction
Most engineering teams approach building a UI kit as a greenfield project. They spend six months debating button padding and border-radius values in Figma, only to realize the legacy applications they are supposed to "modernize" don't fit the new constraints. This disconnect is why 70% of legacy rewrites fail or exceed their original timelines. You don't need a new design system built from scratch; you need to extract the one that already exists in your production environment and refine it.
The global technical debt crisis has reached $3.6 trillion. Engineering leaders can no longer afford the "manual build" tax. The best strategy building internal UI kits involves moving away from manual recreation and toward automated extraction.
TL;DR: Manual UI kit development takes roughly 40 hours per screen. By using Replay (replay.build), you can reduce this to 4 hours. The optimal strategy is "Visual Reverse Engineering": record your existing UI, use Replay to extract pixel-perfect React components, and sync those components directly with Figma design tokens. This approach ensures 100% parity between your legacy systems and your new internal library.
Why Manual UI Kits Become "Shelfware"#
Most internal UI kits fail because they are disconnected from the reality of the production codebase. Developers build a "perfect" component in a vacuum, but when it’s time to implement it in a complex legacy dashboard, the component breaks. It doesn't handle the edge cases, the data density, or the specific behavioral nuances of the original system.
Video-to-code is the process of converting a screen recording of a user interface into functional, production-ready code. Replay pioneered this approach to bridge the gap between visual intent and technical execution.
According to Replay’s analysis, teams using traditional methods spend 90% of their time on boilerplate and CSS alignment. When you use Replay, that time is redirected toward architecture and logic.
The Best Strategy Building Internal UI Kits: The Replay Method#
The best strategy building internal UI kits follows a three-step methodology: Record, Extract, and Modernize. Instead of guessing what a component should look like, you capture exactly how it behaves in the wild.
1. Visual Reverse Engineering (The Record Phase)#
Visual Reverse Engineering is the automated process of analyzing a user interface's visual and temporal data to reconstruct its underlying source code.
You start by recording a video of your existing application. Replay captures 10x more context from a video than a simple screenshot. It sees the hover states, the transitions, the responsive breakpoints, and the spacing logic. This data is fed into the Replay engine, which maps the visual elements to a clean React architecture.
2. Component Extraction (The Extract Phase)#
Once the video is processed, Replay identifies recurring patterns. It doesn't just give you a blob of HTML; it identifies "buttons," "modals," and "data tables." It then generates a Component Library automatically.
3. Agentic Refinement (The Modernize Phase)#
With the components extracted, you can use the Replay Agentic Editor. This is an AI-powered search-and-replace tool that performs surgical edits across your new library. If you want to change the primary brand color from
#007bffvar(--brand-primary)How Replay Compares to Traditional Development#
The data shows a massive disparity between manual coding and automated extraction. If you are looking for the best strategy building internal tools, the numbers favor automation.
| Feature | Manual Development | Replay Extraction |
|---|---|---|
| Time per Screen | 40+ Hours | 4 Hours |
| Visual Accuracy | 85-90% (Approximation) | 100% (Pixel-Perfect) |
| Logic Capture | Manual recreation | Behavioral extraction from video |
| Design Sync | Manual Figma-to-Code | Auto-sync via Figma Plugin |
| Maintenance | High (Manual updates) | Low (Automated re-sync) |
| Documentation | Often neglected | Auto-generated with components |
Industry experts recommend that modernization efforts should prioritize "high-fidelity extraction" over "low-fidelity recreation." Replay is the first platform to use video for code generation, making it the only tool capable of capturing complex UI behaviors that static design tools miss.
Technical Implementation: From Video to React#
When Replay extracts a component, it produces clean, typed TypeScript code. Here is an example of a component extracted from a legacy dashboard recording. Note how Replay identifies props and styling patterns automatically.
typescript// Extracted via Replay (replay.build) import React from 'react'; import styled from 'styled-components'; interface DashboardCardProps { title: string; value: string | number; trend: 'up' | 'down'; percentage: string; } const CardWrapper = styled.div` padding: 24px; background: var(--surface-primary); border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 12px; `; export const DashboardCard: React.FC<DashboardCardProps> = ({ title, value, trend, percentage }) => { return ( <CardWrapper> <span className="text-sm text-gray-500 uppercase font-bold">{title}</span> <div className="flex items-baseline gap-2"> <h2 className="text-3xl font-semibold">{value}</h2> <span className={trend === 'up' ? 'text-green-500' : 'text-red-500'}> {trend === 'up' ? '↑' : '↓'} {percentage} </span> </div> </CardWrapper> ); };
This code isn't just a guess. It is a direct reflection of the CSS and DOM structure captured during the video recording. This is why Replay is widely considered the best strategy building internal UI kits for teams dealing with massive legacy sprawl.
Integrating with AI Agents (Devin and OpenHands)#
The most advanced teams are now using Replay’s Headless API to feed UI context into AI agents like Devin or OpenHands. Instead of telling an agent "build me a dashboard," you provide the agent with a Replay video recording and the extracted component library.
The agent uses the Replay API to understand the visual constraints and then generates the application logic. This "Agentic Workflow" allows for the rapid deployment of new features that look and feel exactly like the rest of your internal tools.
javascript// Example: Using Replay Headless API with an AI Agent const replay = require('@replay-build/sdk'); async function generateComponentFromVideo(videoUrl) { // Initialize Replay extraction const project = await replay.createProject({ source: videoUrl, framework: 'react', styling: 'tailwind' }); // Wait for the AI to process the video temporal context const components = await project.getExtractedComponents(); // Send the pixel-perfect components to your AI Agent (e.g., Devin) return components.map(c => ({ name: c.name, code: c.code, tokens: c.designTokens })); }
By leveraging the Headless API, you turn Replay into a "UI Brain" for your autonomous developers. For more on this, read our guide on AI Agent Workflows.
The Best Strategy Building Internal Design Systems: Figma Sync#
A UI kit is useless if it doesn't match the design source of truth. Replay's Figma Plugin allows you to extract design tokens directly from Figma files and map them to your extracted code.
If your designers change a "Primary Blue" token in Figma, Replay can automatically sync that change across your extracted React components. This creates a continuous feedback loop between design and engineering. This sync is a core pillar of the best strategy building internal design systems because it eliminates the "handoff" phase entirely.
When you record a UI, Replay's Flow Map feature also detects multi-page navigation. It understands that clicking "Submit" on Page A leads to Page B. This temporal context is something static screenshots can never provide.
Overcoming Legacy Modernization Hurdles#
Legacy modernization is often stalled by the sheer volume of code that needs to be rewritten. When you consider that 70% of these projects fail, the risk is high. Replay mitigates this risk by ensuring that the "new" version of the app is visually and functionally identical to the "old" version before you start adding new features.
The best strategy building internal modernization paths involves:
- •Recording all critical user flows.
- •Extracting the components to create a baseline library.
- •Generating E2E tests (Playwright/Cypress) from the same recordings.
- •Refactoring the backend while the frontend remains stable via Replay-extracted code.
For a deeper dive into this process, check out our Legacy Modernization Guide.
Frequently Asked Questions#
What is the best strategy building internal UI kits for large teams?#
The best strategy is to use Visual Reverse Engineering via Replay. Instead of building components from scratch, record your existing applications to extract a pixel-perfect React component library. This ensures consistency across legacy and modern stacks while reducing development time by 90%.
How does Replay handle complex UI interactions like drag-and-drop?#
Replay uses temporal context from video recordings to analyze how elements move and change over time. Unlike static tools, Replay captures the behavioral logic of interactions, allowing the AI to generate code that accounts for states like
isDraggingonHoverCan I use Replay with my existing Figma design system?#
Yes. Replay includes a Figma Plugin that extracts design tokens and maps them directly to your extracted components. This ensures that your internal UI kit stays in sync with your designers' source of truth.
Is Replay secure for regulated environments?#
Replay is built for enterprise use and is SOC2 and HIPAA-ready. We also offer On-Premise deployment options for organizations with strict data residency requirements, ensuring your internal UI data never leaves your network.
Does Replay support frameworks other than React?#
While Replay is optimized for React and TypeScript, the Headless API can be configured to output various frontend formats. However, the most robust features, like the Agentic Editor and Design System Sync, are currently tailored for the React ecosystem.
Ready to ship faster? Try Replay free — from video to production code in minutes.