Skip to content

Hordekiller/TypeFigma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TypeFigma

Figma to WordPress Theme Converter β€” Turn any Figma design into a fully functional WordPress theme with Elementor support, WooCommerce compatibility, and production-ready code.

TypeScript License Node Tests PRs


Features

  • πŸ”Œ Figma API Integration β€” Full REST API client with rate limiting, retry logic, caching, and webhook support
  • 🎯 Automatic Component Detection β€” Identifies 20+ component types (header, hero, product cards, testimonials, forms, galleries, etc.)
  • 🎨 Design Token Extraction β€” Extracts colors (50–900 shade scale), typography, spacing, shadows, border-radius, breakpoints, and transitions from Figma variables and styles
  • πŸ’» Multi-Format Code Generation β€” HTML/CSS, Tailwind v4 @theme, WordPress theme.json, DTCG tokens, WP block patterns/templates
  • πŸ“¦ Elementor Mapper β€” Generates complete Elementor JSON (containers, global settings, 50+ section templates)
  • πŸ—οΈ WordPress Theme Builder β€” Produces 58+ theme files: style.css, functions.php, templates, patterns, WooCommerce templates, Customizer settings
  • βš™οΈ Configuration Layer β€” WordPress Customizer with sections for colors, typography, layout, social links, and WooCommerce shop settings
  • πŸ›’ WooCommerce Integration β€” Auto-detects e-commerce projects, generates Cart/Checkout/My Account templates, product cards with gallery/badge/rating/wishlist
  • βœ… Built-in Validator β€” Checks PHP syntax, WordPress coding standards, WCAG AA contrast ratios, CSS quality, Elementor structure, accessibility
  • πŸ“¦ Package & Export β€” Generates screenshot.png (880Γ—660), demo-content.xml (WXR), readme.txt, robots.txt, and ZIP archive
  • πŸ–₯️ REST API β€” Express server with 5 endpoints for headless integration
  • 🌐 CLI Tool β€” Single generate command for CI/CD pipelines

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Figma Design URL                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  1. Fetch & Analysis    (figma-client)                   β”‚
β”‚     β””β†’ JSON + Metadata + Variables + Styles              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  2. Component Detection  (analyzer)                      β”‚
β”‚     β””β†’ 20+ component types, project type classification  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  3. Token Extraction     (analyzer)                      β”‚
β”‚     β””β†’ Colors, Typography, Spacing, Shadows, Breakpoints β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  4. Code Generation      (code-generator)                β”‚
β”‚     β””β†’ HTML/CSS + Tailwind + theme.json + DTCG + Blocks  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  5. Elementor Mapping    (elementor-mapper)              β”‚
β”‚     β””β†’ JSON containers + global settings + templates     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  6. Theme Structure      (theme-builder)                 β”‚
β”‚     β””β†’ 58+ WP theme files + Customizer + Admin panel     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  7. Validation           (validator)                     β”‚
β”‚     β””β†’ PHP syntax / WCAG / CSS / Elementor / WP stds     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  8. Package & Export     (CLI / API)                     β”‚
β”‚     β””β†’ ZIP + screenshot.png + demo-content.xml + README  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  WordPress Theme (.zip)     β”‚
        β”‚  + Elementor Import Ready   β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Package Overview

Package Description Status
@typefigma/figma-client Figma REST API client with rate limiting & caching βœ… 85%
@typefigma/analyzer Component detection, token extraction, layout engine βœ… 90%
@typefigma/code-generator HTML/CSS, Tailwind, theme.json, DTCG, WP blocks βœ… 85%
@typefigma/elementor-mapper Elementor JSON containers & 50+ templates βœ… 80%
@typefigma/theme-builder WordPress file builder, Customizer, Admin panel βœ… 90%
@typefigma/validator PHP syntax, WCAG, CSS, Elementor, WP standards βœ… 90%
@typefigma/cli Command-line interface βœ… 70%
@typefigma/api Express REST API βœ… 70%

Tech Stack

  • Runtime: Node.js β‰₯ 18, TypeScript 5.x (strict mode, NodeNext modules)
  • Pipeline: 8 monorepo packages (npm workspaces)
  • Build: TypeScript compiler (tsc), Vitest for testing
  • Key Libraries: archiver (ZIP), zlib (PNG), Express (API), Commander (CLI)
  • Output Formats: HTML5, CSS3, Tailwind v4 @theme, theme.json (FSE), DTCG tokens, WXR (WordPress eXtended RSS), Elementor JSON
  • Testing: 504 tests across 5 packages

Quick Start

Prerequisites

Installation

git clone https://github.com/Hordekiller/TypeFigma.git
cd TypeFigma
npm install
npm run build

CLI Usage

# Generate a theme from a Figma URL
npx typefigma generate "https://www.figma.com/file/abc123/design" \
  --token "figd_xxxxx" \
  --name "My Theme" \
  --output "./my-theme" \
  --zip

API Usage

# Start the API server
npx tsx packages/api/src/index.ts

# Analyze a Figma design
curl -X POST http://localhost:3001/api/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "figmaUrl": "https://www.figma.com/file/abc123/design",
    "figmaToken": "figd_xxxxx"
  }'

# Generate a full theme
curl -X POST http://localhost:3001/api/generate \
  -H "Content-Type: application/json" \
  -d '{
    "figmaUrl": "https://www.figma.com/file/abc123/design",
    "figmaToken": "figd_xxxxx",
    "themeName": "My Theme",
    "createZip": true
  }'

# Download the generated ZIP
curl -o theme.zip http://localhost:3001/api/download/my-theme

Run the Demo (No Figma Token Required)

node scripts/demo.mjs

Generates a complete e-commerce WordPress theme at ./output/shopdemo/ with 58 files, Elementor templates, WooCommerce support, and validation report.


Generated Theme Structure

theme-name/
β”œβ”€β”€ style.css                  # Theme metadata + WordPress header
β”œβ”€β”€ functions.php              # Theme setup, enqueue, Elementor integration
β”œβ”€β”€ index.php                  # WordPress entry point
β”œβ”€β”€ screenshot.png             # 880Γ—660 theme screenshot
β”œβ”€β”€ readme.txt                 # WordPress.org-compatible readme
β”œβ”€β”€ robots.txt                 # SEO crawl rules
β”œβ”€β”€ demo-content.xml           # WXR import file (pages, products, menus)
β”œβ”€β”€ theme.json                 # Full Site Editing configuration
β”œβ”€β”€ header.php / footer.php    # Site chrome
β”œβ”€β”€ page.php / single.php      # Content templates
β”œβ”€β”€ archive.php / search.php   # List templates
β”œβ”€β”€ 404.php / sidebar.php      # Utility templates
β”œβ”€β”€ inc/
β”‚   β”œβ”€β”€ customizer.php         # Color, typography, layout, WooCommerce settings
β”‚   β”œβ”€β”€ elementor-widgets.php  # Custom Elementor widget registration
β”‚   β”œβ”€β”€ fonts.php              # Google Fonts enqueue
β”‚   └── admin/settings.php     # Theme admin panel
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ css/global.css         # CSS custom properties + base styles
β”‚   β”œβ”€β”€ css/components.css     # Component-specific styles
β”‚   β”œβ”€β”€ css/woocommerce.css    # Shop styles
β”‚   └── js/theme.js            # Theme JavaScript
β”œβ”€β”€ elementor/
β”‚   β”œβ”€β”€ global-settings.json   # Elementor global colors, fonts, breakpoints
β”‚   └── templates/             # Header, Footer, Product Archive JSON
β”œβ”€β”€ patterns/                  # Block patterns (hero, products, testimonials)
β”œβ”€β”€ templates/                 # Block templates (page, archive, cart)
β”œβ”€β”€ woocommerce/               # Cart, Checkout, My Account, Archive, Single
└── styles/                    # Style variations (default, light, dark)

Development

# Setup
npm install
npm run build

# Run all tests (504 tests across 5 packages)
npm test

# Type-check all packages
npm run typecheck

# Development (watch mode)
npm run dev

# Clean build artifacts
npm run clean

Package Development

# Work on a specific package
cd packages/core/theme-builder
npx vitest run                  # Run tests
npx tsc --noEmit --watch        # Type-check in watch mode

Project Classification

TypeFigma automatically detects the project type using 13 indicators:

Indicator Description
hasProductCards Product grid/list with add-to-cart
hasAddToCart Individual add-to-cart buttons
hasCheckout Checkout forms/sections
hasWishlist Wishlist/bookmark functionality
hasProductGallery Image galleries with thumbnails
hasReviews Customer review sections
hasPricing Pricing tables/cards
hasBlogPosts Blog post listings
hasPortfolioItems Portfolio/project grids
hasContactForms Contact form sections
hasTeamSection Team member grids
hasServicesSection Service/feature cards

Detected types: ecommerce | corporate | blog | portfolio | landing | saas


Validation

Every generated theme runs through a comprehensive validation suite:

Check What It Validates
Structure 11 required WordPress theme files present
PHP Syntax Tag balance, curly brace matching, function declaration correctness
WP Standards Escaping functions, i18n, nonces, hooks, superglobal sanitization
Accessibility Alt text on images, form labels, ARIA roles, heading hierarchy, WCAG AA contrast (4.5:1)
CSS Quality Specificity, duplicate selectors, vendor prefixes, !important usage
Elementor Widget registration, global settings, template JSON validity
Performance File sizes, CSS/JS/PHP totals, image count, largest file

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting a pull request.

Areas for Contribution

  • WooCommerce Cart/Checkout/My Account template improvements
  • Web UI (Next.js) β€” live preview, component selection, progress display
  • Additional Elementor Pro widget support (slides, forms, price lists)
  • End-to-end testing with WordPress/Elementor
  • CSS Module / CSS-in-JS output formats

License

GPLv2 or later β€” Free to use, modify, and distribute.


Built with ❀️ for the WordPress community

About

Figma to WordPress Theme - 10-Step Pipeline Converter

Topics

Resources

License

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors