Inspiration
Front-end teams lose days translating Figma files into React, then spend more days fixing “design drift” and wiring business logic. We wanted a deterministic, picture-perfect Figma→React pipeline that preserves design intent, scaffolds logic cleanly, and ships production-ready UI with measurable gains (cycle time, defects, accessibility).
What it does
LayoutSmith turns a Figma file into a typed React app and gives engineers a clean place to add logic:
Pixel-faithful React + TypeScript components from Figma frames/components.
Design tokens (color/typography/spacing/shadows) and responsive layouts (Tailwind by default).
Variants → props: Figma variants become typed component APIs with Storybook controls.
Business-Logic Bay: attach Redux slices/RTK Query hooks without editing generated UI.
Visual fidelity QA: headless render + SSIM/pixel-diff with annotated reports and “self-healing” CSS hints.
Docs & tests: Storybook, Jest/RTL, Playwright E2E, Axe accessibility checks.
One-command preview deploy for a judge-friendly demo.
How we built it
Intake: Figma Plugin + REST pull; secure token storage via OS keychain.
Parser: extracts tokens, auto-layout rules, constraints/grids, and variant matrices.
Mapper: converts layout semantics → JSX structure, responsive patterns, and theme hooks.
Writer: emits TSX + Tailwind classes, assets, and constants.ts for environment-based endpoints.
Logic Bay: composable wrappers (container pattern) to bind slices/hooks to components.
Verifier: headless render → SSIM/pixel-diff; generates a clickable diff report per screen.
Tooling & CI: CLI (pull | generate | diff | deploy), Docker for reproducibility, CI gates (lint, typecheck, tests, accessibility, visual diff).
Optional SLM assist (local): on-device model to suggest prop names/docstrings; can be fully disabled.
Stack: Node + TypeScript, React 18 + Vite, Tailwind, Storybook, Jest/RTL, Playwright, Axe, Docker. Repo skeleton:
/layoutsmith /cli /parser /tokens /mapper /writer /verifier /logic /docs /demo Dockerfile Makefile README.md
Challenges we ran into
Auto-layout edge cases (nested constraints, absolute/flex mixes) → deterministic fallbacks + warnings.
Font metric drift (kerning/line-height) causing sub-pixel diffs → curated font packs + guards.
Variant explosion → prop synthesis and Storybook controls to keep APIs ergonomic.
Idempotence so reruns don’t churn Git diffs; stable hashing and ordered traversal.
Performance on large files → incremental generation and cached Figma responses.
Accessibility at generation time (roles, labels, focus order) → baked into templates and CI.
Accomplishments that we’re proud of
Pixel-true fidelity: mean SSIM ≥ 0.98 on reference kits with hotspot diff reports.
Cycle-time reduction: early tests show 60–80% faster from handoff to usable UI.
Idempotent codegen: identical inputs yield identical bytes; clean PR diffs.
AA accessibility baseline: zero critical Axe issues on generated pages.
DX win: add a slice + API and bind to a component in < 5 minutes via the Logic Bay.
Demoable: one command builds + deploys a preview with metrics and before/after slider.
What we learned
Capturing design intent (constraints, variants, semantics) matters more than raw pixels for reuse.
Transparency builds trust: explain-generation traces + visual diffs turn skeptics into users.
Determinism > cleverness in team workflows; reproducibility calms code review.
Accessibility upfront is cheaper than retrofitting later.
Metrics drive adoption with leaders: time-saved counters, defect deltas, and fidelity scores.
What’s next for LayoutSmith
Two-way sync: auto-open PRs on design changes with linked visual diffs.
Framework targets: Next.js (SSR/ISR) first; Vue/Solid adapters later.
Deeper tokens: first-class Figma Variables → theme packs (light/dark/brand) with live preview.
Team workspace: RBAC, shareable diff reports, opt-in usage analytics.
Design-system export: publish tokens + components as a versioned NPM package.
Advanced inference: richer on-device SLM hints for layout/prop naming (with strict off switch).
Edge-case toolkit: interactive fixer UI for fonts/icons; commit fixes back to code.
Log in or sign up for Devpost to join the conversation.