Skip to main content

Forge production-ready Angular components from Figma designs with AI-powered MCP integration

Project description

Figma Angular React Vue Python MCP

๐Ÿ”ฅ FigmaForge

Forge production-ready components from Figma designs

Multi-framework code generation (Angular, React, Vue, Web Components) via CLI & Copilot Chat

Features โ€ข Quick Start โ€ข Usage โ€ข Frameworks โ€ข Docs


โœจ Features

Core Features

Feature Description
๐ŸŽฏ Pixel-Perfect Exact positioning, colors, typography from your designs
๐Ÿค– AI-Driven Generate via VS Code Copilot Chat with natural language
โŒจ๏ธ CLI Support Command-line interface for scripting and CI/CD
๐ŸŽจ Design Tokens Extract colors, fonts, spacing as SCSS variables
๐Ÿ“ฆ Asset Export Automatic SVG/PNG extraction with inline optimization
๐Ÿ”„ Non-Destructive Regenerate without losing custom code

Multi-Framework Support

Framework Output Files Flag
Angular .ts, .html, .scss --framework angular
React .tsx, .module.css --framework react
Vue 3 .vue (SFC) --framework vue
Web Components .js (Custom Elements) --framework webcomponent

Advanced Features

Feature Description
โšก API Caching Local cache with ETag support for faster regeneration
๐ŸŒ Responsive Mode Flexbox layouts instead of absolute positioning
๐ŸŽจ Tailwind CSS Generate Tailwind utility classes instead of SCSS
๐Ÿ‘€ Watch Mode Auto-regenerate components when Figma file changes
๐Ÿ”€ Component Variants Detect Figma variants โ†’ typed @Input() properties
๐ŸŽญ Interaction States Map hover/focus/disabled variants to CSS pseudo-classes
๐Ÿ“ Figma Variables Extract design tokens from Figma Variables API

๐Ÿš€ Quick Start

# Clone & install
git clone https://github.com/aspect-developer/FigmaForge.git
cd FigmaForge

# Setup
python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # Mac/Linux
pip install -r requirements.txt

# Configure
cp .env.template .env
# Add your FIGMA_TOKEN to .env

๐Ÿ’ก Get your Figma token at figma.com/settings


๐ŸŽฎ Usage

๐Ÿค– AI-Driven (VS Code Copilot Chat)

  1. Open project in VS Code
  2. Reload window (Ctrl+Shift+P โ†’ "Developer: Reload Window")
  3. Open Copilot Chat (Ctrl+Shift+I)
  4. Chat naturally:
๐Ÿ“ "List all components in file ABC123XYZ"

๐Ÿ”ฅ "Generate a React component called hero-section from node 1:23 in file ABC123XYZ"

๐ŸŽฏ "Generate button from node 2:45 in file ABC123XYZ with tailwind styling and responsive layout"

โŒจ๏ธ CLI Commands

# Generate Angular component (default)
python cli.py generate -f FILE_KEY -n "1:23" -m my-button

# Generate React component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework react

# Generate Vue component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework vue

# Generate Web Component
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --framework webcomponent

# With Tailwind CSS
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --style tailwind

# Responsive flexbox layout
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --responsive

# Dry run (preview without writing)
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --dry-run

# Bypass cache
python cli.py generate -f FILE_KEY -n "1:23" -m my-button --no-cache

# Cache management
python cli.py cache          # View cache stats
python cli.py cache --clear  # Clear all cached data

# Watch mode (auto-regenerate on changes)
python cli.py watch -f FILE_KEY -n "1:23" -m my-button --interval 30

# Sync file and extract design tokens
python cli.py sync -f FILE_KEY

# Initialize project directories
python cli.py init

๐Ÿ”ง Frameworks

Angular (Default)

python cli.py generate -f FILE -n NODE -m button

Generates: button.component.ts, button.component.html, button.component.scss

React

python cli.py generate -f FILE -n NODE -m button --framework react

Generates: Button.tsx, Button.module.css

Vue 3

python cli.py generate -f FILE -n NODE -m button --framework vue

Generates: Button.vue (Single File Component with Composition API)

Web Components

python cli.py generate -f FILE -n NODE -m button --framework webcomponent

Generates: Button.js (Custom Element with Shadow DOM)


๐Ÿ” Finding Figma IDs

ID Location Example
File Key URL: figma.com/design/ABC123XYZ/... ABC123XYZ
Node ID Right-click โ†’ "Copy link" โ†’ ?node-id=1-23 1:23

๐Ÿ“‚ Project Structure

FigmaForge/
โ”œโ”€โ”€ cli.py                    # CLI entry point
โ”œโ”€โ”€ mcp_stdio_server.py       # MCP server for Copilot Chat
โ”œโ”€โ”€ .vscode/mcp.json          # VS Code MCP configuration
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ figma/                # Figma API client & normalizer
โ”‚   โ”œโ”€โ”€ generators/           # Angular, React, Vue, WebComponent generators
โ”‚   โ”œโ”€โ”€ extractors/           # Tokens, variants, assets, interaction states
โ”‚   โ””โ”€โ”€ utils/                # CSS utilities, console output
โ”œโ”€โ”€ tests/                    # Unit tests (33+ tests)
โ””โ”€โ”€ docs/                     # Documentation

โš™๏ธ Configuration

Variable Description Default
FIGMA_TOKEN Your Figma personal access token Required
ANGULAR_OUTPUT_PATH Component output directory ./src/app/components
ASSETS_OUTPUT_PATH Asset output directory ./src/assets/figma

๐Ÿ› ๏ธ MCP Tools (Copilot Chat)

Tool Description
generate_component Generate component (any framework)
sync_figma Sync file & extract tokens
list_components List all components in file
preview Get raw design JSON
extract_tokens Export SCSS variables

MCP Parameters

Parameter Values Description
framework angular, react, vue, webcomponent Target framework
styleFormat scss, tailwind Style output format
responsive true/false Use flexbox layouts
dryRun true/false Preview without writing
noCache true/false Bypass API cache

๐Ÿงช Testing

# Run all tests
python -m pytest tests/ -v

# Run with coverage
python -m pytest tests/ --cov=src --cov-report=term-missing

๐Ÿ“š Documentation


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ”ฅ FigmaForge โ€” Forging code from designs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

figmaforge-1.0.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

figmaforge-1.0.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file figmaforge-1.0.0.tar.gz.

File metadata

  • Download URL: figmaforge-1.0.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for figmaforge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9be32caa89f516fad2828ba874f08840a8c2991c1b787ffb0a84d3baaf0c4d18
MD5 803fb41cf5e13e9fc095085a95cde5c7
BLAKE2b-256 5df9b2d13182b352b9a9e5080de1335fd8f3149dae672c7e80251857e51d82a0

See more details on using hashes here.

File details

Details for the file figmaforge-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: figmaforge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for figmaforge-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2b9edf62d63605e469526533701e74e67bbe0a2216d5599a1f42704d92924f
MD5 9ada279587aa4e547686b6e6acf3d550
BLAKE2b-256 043276afe9bfc03343f7c682907618848fea08f0fa3f7d960e3f41a7fbfeaf5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page