AI-Powered Design-to-Code Tool with High-Fidelity UI Restoration
💬 Contact: WeChat Group | Email
- What is CodeRio?
- Examples
- Quick Start
- All Commands
- Key Features
- How It Works
- Roadmap
- Contributing
- License
CodeRio is an intelligent Figma-to-Code automation tool that transforms designs into production-ready React code. Unlike traditional converters, CodeRio employs a multi-agent system that validates visual accuracy and iteratively refines misalignments, pursuing high-fidelity UI restoration and production-ready code structure tailored for developers.
framework-hd.mp4
Perfect for:
- 🎯 Frontend developers who want accurate design implementation
- 🚀 Teams looking to accelerate development workflows
- 💎 Designers who want their vision precisely realized in code
After installing CodeRio, you can execute commands directly in the CLI. CodeRio excels at restoring complex landing page styles, handling intricate layouts, identifying and downloading diverse image resources, and encapsulating component structures. By selecting "FULL" mode, a visual fidelity evaluation report is generated upon completion. This report displays deviations between the design and the webpage using both annotation and overlay modes, providing effective guidance for further development by engineers. This example demonstrates a landing page converted from Figma (Design Link).
report.mp4
📊 View Interactive Validation Report
CodeRio can be seamlessly integrated into Cursor as a Skill. Simply input a prompt like "Create a React project and restore this design with high fidelity," along with your output directory, Figma URL(Design Link), and Token. The Agent will guide you step-by-step through the page generation process. For Landing Pages, it achieves high-fidelity restoration, accurately reproducing images and styles. It also automatically encapsulates reusable components (such as cards) and strictly adheres to frontend development best practices.
coderio-skill-demo.mp4
Best for one-click generation.
- Node.js >= 18.0.0 (< 25.0.0)
- Figma Personal Access Token
- LLM API Key (Anthropic | OpenAI | Google)
# Install globally (recommended)
npm install -g coderio
# Or using pnpm
pnpm add -g coderioNote for pnpm v9+ users: If you see a warning about "Ignored build scripts", run:
pnpm approve-buildsThis allows native dependencies (better-sqlite3) to compile properly.
Note:
playwrightandsharpare required only for validation features. They will be automatically installed when you first run a command that needs them (liked2c --mode full).
Create ~/.coderio/config.yaml:
mkdir -p ~/.coderio
cat > ~/.coderio/config.yaml << 'EOF'
model:
provider: openai # anthropic | openai | google
model: gemini-3-pro-preview
baseUrl: https://api.anthropic.com
apiKey: your-api-key-here
figma:
token: your-figma-token-here
debug:
enabled: false
EOF# Convert Figma design to code (default mode: code only)
coderio d2c -s 'https://www.figma.com/design/your-file-id/...'
# Full mode: Generate code + visual validation + auto-refinement
coderio d2c -s 'https://www.figma.com/design/your-file-id/...' -m full# Navigate to generated project
cd coderio/<design-name_node-id>/my-app
# Install dependencies
pnpm install
# Start dev server
pnpm dev
# 🎉 Open http://localhost:5173# Open validation report in browser
open coderio/<design-name_node-id>/process/validation/index.html| Command | Alias | Description |
|---|---|---|
design2code |
d2c |
Full pipeline: Figma → Protocol → Code → Validation |
design2protocol |
d2p |
Extract design protocol only |
protocol2code |
p2c |
Generate code from existing protocol |
validate |
val |
Run validation on generated code |
images |
- | Download and process Figma assets |
Best for control and precision using AI Agents.
Prerequisites: Copy the Skill file to your Cursor configuration directory:
mkdir -p ~/.cursor/skills/design-to-code
cp docs/skills/SKILL.md ~/.cursor/skills/design-to-code/SKILL.mdUsing in Cursor:
- Open Cursor Chat (
Cmd+L). - Type: "Use design-to-code skill to convert this design: [Your Figma URL]"
- The Agent will guide you step-by-step through protocol extraction and code generation.
Using in Claude Code:
- Start Claude Code.
- Type: "Read docs/skills/SKILL.md and perform design conversion: [Your Figma URL]"
Generates comprehensive frontend protocols combining page component structure, CSS code, and static assets:
- Component Hierarchy: Automatically identifies component structure and data states, forming a component hierarchy skeleton that aligns with frontend development practices
- Style Extraction: Translates Figma JSON into CSS properties, including colors, spacing, shadows, animations, etc.
- Asset Optimization: Automatically identifies and processes image nodes
interface Protocol {
id: string; // Component identifier (e.g., "Header", "Hero")
data: {
name: string; // Component name
purpose: string; // Semantic description
elements: FigmaFrameInfo[]; // Original Figma node data
layout?: LayoutInfo; // Position, size, spacing, direction
componentName?: string; // Reusable component identifier
props?: PropDefinition[]; // Component props schema
states?: StateData[]; // Component state variations
};
children?: Protocol[]; // Nested child components
}Ensures pixel-perfect accuracy with automated visual testing:
- Position Calibration: Measures exact element positioning using computer vision
- Visual Diff Reports: Interactive HTML reports with heatmaps and side-by-side comparisons
- Automated Refinement: Iteratively fixes misalignments until accuracy threshold is met
- Quantifiable Metrics: MAE, visual image assistance
Visual Report Features:
- Annotated screenshots highlighting misalignments
- Heatmap overlays showing pixel differences
- Component-level accuracy breakdown
Built-in interruption recovery system:
- Auto-Checkpointing: Saves state after each major operation
- Resume from Anywhere: Pick up exactly where you left off
- Crash Recovery: Handles network failures, API timeouts, process interruptions
Beyond visual fidelity, the generated code is built for long-term maintenance:
- Component-Based Architecture: Automatically decomposes semantic components (Header, Footer, Hero, etc.), avoiding spaghetti code.
- Scientific Styling: Prefers Flexbox/Grid layouts over rigid absolute positioning, ensuring responsiveness across different screen sizes.
- Modern Tech Stack: Defaults to React + TypeScript + Tailwind CSS for type safety and scalability.
- Clean File Structure: Automatically organizes
components/,assets/,utils/directories following industry best practices.
- Support for incremental development
- Style and content validation
- Component library integration
- Vue.js and Svelte support
- Custom design system integration
Welcome to contribute. Thanks to all our contributors! 🎉
Apache-2.0 © CodeRio Contributors