Unflatten is an AI-powered design tool that converts static mobile app screenshots into editable, auto-layout ready Figma designs.
It uses Gemini 3 Flash to "vibe code" the visual design into a React + Tailwind implementation, then programmatically traverses the rendered DOM to extract computed styles (flexbox, padding, colors) for Figma.
- Frontend: Next.js 14, Tailwind CSS, Framer Motion
- AI: Google Gemini 3 Flash
- Figma: Plugin API
You need a Google Gemini API Key.
- Create a
.env.localfile in the root directory:GEMINI_API_KEY=AIza-your-key-here
-
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
To create a distributable zip file for the Figma plugin:
- Run the build command:
npm run build:plugin
- This will create a
public/unflatten-plugin.zipfile. - You can download and install this zip file via the
/installpage in the running app.
- Upload: Drop a screenshot into the web app.
- Generate: Wait for the AI to generate the code.
- Copy JSON: Click the Copy for Figma button in the preview window.
- Open Figma:
- Go to Main Menu > Plugins > Development > Import plugin from manifest...
- Select
figma-plugin/manifest.jsonfrom this project folder. - Run the Unflatten Paster plugin.
- Paste: Paste the JSON data into the plugin window and click Draw.
- Icons: Currently assumes standard Lucide icons; custom icons in screenshots may be replaced or missing.
- Complex Layouts: Highly complex grids may fall back to simple frames if the AI generation is ambiguous.
- Images: Images are currently replaced with placeholders or their source URLs if accessible.
MIT