IR-First Architecture: Why We Support React, Flutter, and Vue from One Design
Engineering

IR-First Architecture: Why We Support React, Flutter, and Vue from One Design

CodeFlow Lab

CodeFlow Team

Engineering

January 5, 20257 min read

The Generation Problem

Most AI coding tools treat each framework as a separate black-box generation task. Feed in a design, get out React. Feed in the same design, get out Flutter. No shared understanding. No preserved constraints. No consistency.

The result? Code that looks plausible but drifts semantically across frameworks. A button in React gets different accessibility attributes than the "same" button in Flutter. Layout constraints are interpreted differently. Design tokens don't map consistently.

When internal representations are implicit and untyped, entropy accumulates with every generation.

We took a different approach.

IR-First: Compilation, Not Generation

CodeFlow Lab uses an Intermediate Representation (IR)—a framework-agnostic, typed AST that captures the semantic structure of your design before any code is emitted.

Think of it as a compiler's parse tree. The IR is the single source of truth that preserves:

  • Component hierarchy with explicit parent-child relationships
  • Semantic roles (button, navigation, header, form input)
  • Design tokens (colors, typography, spacing) as typed constants
  • Layout constraints (flex direction, grid template, positioning rules)
  • Accessibility requirements (ARIA roles, labels, semantic HTML mappings)
  • Responsive breakpoints with explicit condition logic
  • The IR isn't just metadata—it's an executable specification of design intent.

    Why This Matters

    Without an explicit IR layer, you're asking an LLM to:

  • Parse visual design
  • Infer semantic structure
  • Map to framework idioms
  • Preserve accessibility
  • Maintain consistency
  • ...all in one opaque step.

    That's why most tools achieve 20-30% fidelity. Intent is lost. Constraints aren't preserved. Each generation is a fresh hallucination.

    With IR-first architecture:

  • Design intent is parsed once and preserved in typed structure
  • Semantic constraints are explicit, not implicit
  • Framework generation becomes deterministic transformation
  • Quality is measurable and reproducible
  • We don't ask LLMs to be oracles. We ask them to be stateless emitters operating on stable, typed input.

    Pipeline Architecture

    Figma Design
        ↓
    [Extraction Layer]
        ↓
    Intermediate Representation (IR)
        ↓
    [Semantic Enhancement]
        ↓
    Enhanced IR
        ↓
    [Framework Codegen]
        ↓
    React / Flutter / Vue

    Stage 1: Extraction

    The Figma API provides raw node data—positions, fills, text properties. Our extraction layer transforms this into structured IR:

  • Component boundary detection through multi-signal analysis of Figma's native component system
  • Semantic pattern recognition to identify UI primitives and composite patterns
  • Design token extraction into typed, reusable constants
  • Asset optimization with proper management and delivery strategies
  • Layout relationship capture preserving spatial and hierarchical constraints
  • Output: Raw IR with structural relationships and design system primitives.

    Stage 2: Semantic Enhancement

    This is where the IR gains intelligence through structured analysis:

  • Semantic role inference: Visual patterns are mapped to appropriate framework-native elements based on structural analysis and accessibility requirements
  • Accessibility enrichment: Proper ARIA roles, labels, and semantic attributes applied systematically
  • Responsive strategy detection: Layout patterns analyzed to generate explicit breakpoint logic
  • Layout optimization: Complex nesting reduced to idiomatic framework patterns
  • Token normalization: Raw values mapped to design system references
  • Output: Enhanced IR with explicit semantic structure and accessibility guarantees.

    Stage 3: Code Generation

    The enhanced IR is transformed into framework-specific code through deterministic emission:

    React:

  • TypeScript interfaces from component structure
  • Functional components with proper hooks
  • Tailwind CSS with design token mapping
  • Accessibility attributes preserved
  • Flutter:

  • Dart classes with null-safety
  • Widget tree matching IR structure
  • ThemeData integration for tokens
  • Material Design compliance
  • Vue 3:

  • Composition API with TypeScript
  • Template structure from IR
  • Tailwind CSS with scoped styles
  • Reactive bindings where needed
  • The key: same IR, different emission. Semantic structure is preserved. Quality is consistent.

    Quality Scoring: The 8+/10 Standard

    Every generated output passes through our validation pipeline:

    Static Analysis:

  • TypeScript/Dart analyzer compliance (zero errors)
  • Linting rules (Prettier, ESLint, Dart analyzer)
  • Import resolution and dependency verification
  • Semantic Correctness:

  • Component structure matches IR specification
  • Props and attributes correctly typed
  • Design tokens properly referenced
  • Framework idioms followed
  • Accessibility Audit:

  • ARIA roles present where required
  • Semantic HTML elements used correctly
  • Focus management for interactive elements
  • Color contrast compliance (WCAG AA minimum)
  • Fidelity Validation:

  • Visual rendering matches design specification
  • Layout constraints preserved across breakpoints
  • Responsive behavior matches intended breakpoints
  • Asset rendering and optimization verified
  • Each dimension contributes to a composite quality score. We target 8+/10 across all frameworks—a measurable standard that most tools don't even attempt to define.

    The Result

    One Figma design → production-ready code for React, Flutter, or Vue—with:

  • 85% design fidelity (vs industry 20-30%)
  • Consistent semantic structure across all frameworks
  • Full accessibility compliance out of the box
  • Auditable transformations at every stage
  • Reproducible quality with measurable scores
  • Why Competitors Can't Do This

    Most tools skip the IR layer because:

  • Building a robust IR requires deep domain modeling - months of iteration on type systems and constraint representation
  • Maintaining semantic consistency across frameworks is hard - each framework has different idioms and capabilities
  • It's slower than "just ask the LLM to generate code" - requires upfront architectural investment
  • But speed without fidelity isn't velocity—it's technical debt at scale.

    We optimize for correctness first, speed second. The result is code you can actually ship, maintain, and govern.

    The architectural complexity pays dividends: when you add a new framework target, you're not rebuilding everything—you're adding a new emission layer on top of the same semantic foundation.

    What's Next

    Our IR architecture is evolving to support:

  • Interaction states and animations (hover, active, disabled, transitions)
  • Data binding patterns (forms, lists, conditional rendering, state management)
  • Cross-framework component libraries (design system → multi-framework SDK with consistent APIs)
  • Additional framework targets (Svelte, Angular, React Native)
  • Advanced layout patterns (container queries, advanced grid, custom layouts)
  • The IR isn't just infrastructure—it's the abstraction layer the design-to-code space has been missing.

    Each enhancement to the IR automatically improves output quality across all supported frameworks. This is the compounding advantage of compilation over generation.

    Technical Philosophy

    The IR-first approach reflects a fundamental belief: design-to-code is a compilation problem, not a generation problem.

    Compilers have solved multi-target code generation for decades. LLVM compiles C to x86, ARM, and RISC-V from a single IR. WebAssembly runs on any browser through a shared intermediate format.

    The same principles apply to design systems. The semantic structure is framework-agnostic. Only the final emission needs to be framework-specific.

    By treating LLMs as stateless emitters rather than end-to-end oracles, we get:

  • Reproducible outputs from identical inputs
  • Auditable transformation steps
  • Testable quality at each stage
  • Governable systems that enterprises can trust
  • This isn't just better engineering—it's the only architecture that scales to production requirements.

    Try It Yourself

    Want to see the difference between generation and compilation? Try our framework-specific converters:

  • [Figma to React](/figma-to-react) - TypeScript, Tailwind CSS, semantic HTML
  • [Figma to Flutter](/figma-to-flutter) - Null-safe Dart, Material Design, ThemeData
  • [Figma to Vue](/figma-to-vue) - Composition API, TypeScript, Tailwind CSS
  • Upload a Figma design and generate production-ready code—all from the same semantic IR foundation.

    Learn more about why this matters in our [alignment by construction](/blog/alignment-by-construction) article and why [most tools only achieve 20-30% fidelity](/blog/figma-to-code-fidelity).

    Architecture
    IR
    React
    Flutter
    Vue
    Compilation
    0 comments

    Comments (0)

    No comments yet. Be the first to share your thoughts!

    Previous Article

    Why Most Figma-to-Code Tools Only Achieve 20-30% Fidelity

    Ready to Try Design-to-Code?

    Convert your Figma designs with 85% fidelity. Start free today.