Overview
The Figma Generator is Phase 4 of the Omni Architect pipeline. It transforms validated Mermaid diagrams into organized, styled design assets within a Figma file, creating frames, components, flows, and developer annotations using the Figma REST API.Version: 1.0.0
Author: fabioeloi
Pipeline Phase: 4 of 5
Author: fabioeloi
Pipeline Phase: 4 of 5
Purpose
The Figma Generator bridges the gap between validated product logic and visual design. By automatically creating structured Figma assets, it eliminates manual translation work and ensures design assets directly reflect validated requirements.Inputs & Outputs
Inputs
Array of validated Mermaid diagrams with
status=approved from Phase 3 (Logic Validator).The Figma file key extracted from the Figma URL:
https://www.figma.com/file/<FILE_KEY>/...Personal access token from Figma with write permissions. Generate at:
Figma Account Settings → Personal Access Tokens
Base design system for styling components:
material-3: Google Material Design 3apple-hig: Apple Human Interface Guidelinestailwind: Tailwind CSS design tokenscustom: Use custom design tokens from config
Project name used as the prefix for all generated pages and components in Figma.
Outputs
Array of created Figma assets, each containing:
- node_id: Figma node identifier for the created element
- type: Asset type (page, frame, component, flow)
- name: Human-readable name
- preview_url: PNG preview image URL
- figma_url: Direct link to the asset in Figma
Diagram-to-Asset Mapping
| Mermaid Diagram | Figma Asset | Description |
|---|---|---|
flowchart | User Flow Page | Wireframe representations of screens with navigation arrows |
sequenceDiagram | Interaction Spec Component | Detailed interaction specifications per screen/component |
erDiagram | Data Model Documentation | Visual data model documentation with entity cards |
stateDiagram | State Management Component | UI state visualization showing component states |
C4Context | Architecture Overview Page | Stylized architectural diagram with system boundaries |
journey | User Journey Map Frame | Visual user journey with touchpoints and emotions |
Generation Process
Connect to Figma API
Authenticate using
figma_access_token and establish connection to Figma REST API v1.Create/Locate Project Page
Check if project page exists in the file; create new page named
{project_name} - Omni Architect if not found.Create Frame Structure
For each diagram, create a top-level Frame with auto-layout enabled and appropriate spacing.
Map Nodes to Components
Transform each Mermaid node into a Figma component:
- Decision nodes → Diamond shapes with conditional text
- Process nodes → Rectangle components with rounded corners
- Actors → Person icons with labels
- Entities → Table-like structures with attribute rows
Apply Design Tokens
Apply design system tokens for:
- Colors: Primary, secondary, success, error, warning
- Typography: Font family, sizes, weights
- Spacing: Padding, margins, gaps using base scale
Create Visual Connections
Draw arrows and lines between components to represent flow relationships using vector networks.
Generate Responsive Variants
If flowchart represents UI screens, create mobile, tablet, and desktop variants with appropriate breakpoints.
Add Developer Annotations
Create annotation components with:
- Feature ID references
- User story IDs
- Acceptance criteria
- Technical notes
Figma File Structure
The generator creates an organized hierarchy:Design System Application
Material Design 3 (default)
Apple HIG
API Integration
Figma REST API Calls
The generator uses the following Figma API endpoints:Rate Limiting
The generator implements exponential backoff to handle Figma API rate limits:Batch Creation
To minimize API calls, the generator batches component creation:Example Asset Output
Developer Annotations
Each Figma frame includes developer handoff annotations:Annotation Component Structure
Usage in Pipeline
The Figma Generator is automatically invoked as Phase 4:Best Practices
Use Dedicated Figma File
Create a separate Figma file for Omni Architect outputs to avoid conflicts.
Configure Design Tokens
Customize design tokens in config to match your brand guidelines.
Review Before Handoff
Manually review generated assets before developer handoff.
Maintain Component Library
Reuse the generated component library across manual design work.
Security Considerations
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| ”403 Forbidden” | Token lacks write permissions | Regenerate token with write scope |
| ”404 File not found” | Invalid figma_file_key | Verify file key from Figma URL |
| ”429 Rate limited” | Too many API requests | Generator auto-retries with backoff |
| ”Assets not visible” | Page not selected in Figma | Navigate to project page in Figma |
| ”Missing design tokens” | Custom design system incomplete | Provide all required token values |
| ”Timeout on large diagrams” | Complex diagram structure | Split diagram or increase timeout |
Advanced Configuration
Custom Design Tokens
Responsive Variants
Enable automatic responsive variant generation:Next Phase
Once Figma assets are created, the pipeline proceeds to:Phase 5: Asset Delivery
Consolidate all pipeline outputs into a structured delivery package with documentation.