# Execute the entire transformation pipeline
./run_complete_pipeline.shThis single command will:
- ✓ Fetch Figma design from API and convert to XMI
- ✓ Validate your Figma model using OCL constraints
- ✓ Transform Figma model to React model (M2M)
- ✓ Generate React.js application code (M2T)
- ✓ Display summary report
./run_complete_pipeline.shConfiguration Options:
# Skip Figma fetch (use existing figma_instance.xmi)
FETCH_FIGMA=false ./run_complete_pipeline.sh
# Skip validation (not recommended for production)
VALIDATE_FIGMA=false ./run_complete_pipeline.sh
# Bypass strict validation (debugging only)
STRICT_VALIDATION=false ./run_complete_pipeline.sh
# Only M2M transformation
FETCH_FIGMA=false RUN_REFINEMENT=false ./run_complete_pipeline.sh
# Only M2T transformation (requires react_new_instance.xmi)
FETCH_FIGMA=false RUN_TRANSFORMATION=false ./run_complete_pipeline.sh🔒 Validation Enforcement (Default):
By default, the pipeline STOPS if OCL validation fails:
- ✅ Valid model → Proceeds to transformation
- ❌ Invalid model → Pipeline STOPS (protects quality)
See VALIDATION_ENFORCEMENT.md for details.
cd python_code
python3 main.py
cd ..Fetches and converts:
- Input: Figma API (file key + token)
- Output:
Model/figma_instance.json+Model/figma_instance.xmi
Requirements:
- Python 3.7+
requestsandpython-dotenvpackages.envfile withFIGMA_TOKEN- Figma file key in
main.py
# Validate Figma model (default)
./validate_models.sh
# Validate specific model
./validate_models.sh figma
./validate_models.sh react
# Validate all models
./validate_models.sh allValidates against:
- 50+ OCL constraints
- Structural integrity
- Data consistency
- Business logic rules
./transform_figma_to_react.shTransformation:
- Input:
Model/figma_instance.xmi - Output:
Model/react_new_instance.xmi - Rules:
Transformations/tranform.atl(2000+ lines)
What it does:
- Figma Frames → React Components/Divs
- Figma Components → React Components
- Figma Auto-layout → CSS Flexbox
- Figma Styles → Inline React Styles
- Component instances with props
./refine_react.shCode Generation:
- Input:
Model/react_new_instance.xmi - Output: Complete React.js application
- Query:
Transformations/refine2.atl(600+ lines)
Generates:
package.json- Dependenciesvite.config.js- Build configindex.html- Entry pointsrc/main.jsx- React entrysrc/App.jsx- Routersrc/pages/*.jsx- Page componentssrc/components/*.jsx- Reusable components
The React app is generated in a folder named after your Figma design.
# Navigate to generated app (use your Figma design name)
cd <YourFigmaDesignName>
# Install dependencies
npm install
# Start dev server (http://localhost:5173)
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewExample: If your Figma file is named "Untitled":
cd Untitled
npm install
npm run devHow to find your app name:
- Check the pipeline output for "Detected application name"
- Or look at the folder created in the project root
- The name matches your Figma file name
FigmaToReact/
├── run_complete_pipeline.sh ⭐ Run this for complete pipeline
├── validate_models.sh 🔍 Model validation
├── transform_figma_to_react.sh 🔄 M2M transformation
├── refine_react.sh 📝 M2T code generation
│
├── Metamodel/
│ ├── figma_meta_model.ecore # Source metamodel
│ ├── figma_meta_model.ocl # OCL constraints (50+ rules)
│ └── react_meta_model.ecore # Target metamodel
│
├── Model/
│ ├── figma_instance.xmi # Input: Figma design
│ └── react_new_instance.xmi # Output: React model
│
├── Transformations/
│ ├── tranform.atl # M2M rules (2000+ LOC)
│ └── refine2.atl # M2T query (600+ LOC)
│
└── ocl-validator/
├── build.sh # Build validator
└── validate.sh # Run validation
python3 --version
# Required: Python 3.7+
# Install dependencies
cd python_code
pip3 install -r requirements.txt
cd ..
# Configure Figma API token
cp python_code/.env.example python_code/.env
# Edit .env and add your FIGMA_TOKENjava -version
# Required: Java 11+# Update ECLIPSE_HOME in scripts:
# - transform_figma_to_react.sh
# - refine_react.shmvn -version
# Required for building OCL validatornode -version
npm -version
# Required for running generated apps# 1. Setup Python environment and Figma API
cd python_code
pip3 install -r requirements.txt
cp .env.example .env
nano .env # Add your FIGMA_TOKEN
cd ..
# 2. Build OCL validator
cd ocl-validator
./build.sh
cd ..
# 3. Verify scripts are executable
ls -lh *.sh
# Should show -rwxrwxr-x permissions
# 4. Update Eclipse path if needed
nano transform_figma_to_react.sh
# Change ECLIPSE_HOME="/home/ivantom/tool/eclipse"
# 5. Update Figma file key if needed
nano python_code/main.py
# Change file_key = "your_figma_file_key"
# 6. Run the complete pipeline
./run_complete_pipeline.sh# Complete transformation with validation
./run_complete_pipeline.sh > pipeline_output.log 2>&1
# Check results
cat pipeline_output.log
ls -lh Model/figma_instance.xmi Model/react_new_instance.xmi
# Find generated app (will be named after your Figma design)
ls -d */ | grep -v -E 'Model|Metamodel|Transformations|python_code|ocl-validator|atl-runner|images|workspace'
# Run the generated app
cd <YourAppName> # Use the name from the Figma design
npm install && npm run dev# Step 1: Fetch Figma design
cd python_code && python3 main.py && cd ..
# Step 2: Validate source model
./validate_models.sh figma
# Step 3: Run transformation only
FETCH_FIGMA=false VALIDATE_FIGMA=false RUN_REFINEMENT=false ./run_complete_pipeline.sh
# Step 4: Inspect intermediate model
# (Use Eclipse to view Model/react_new_instance.xmi)
# Step 5: Generate code
FETCH_FIGMA=false RUN_TRANSFORMATION=false ./run_complete_pipeline.sh# Skip fetch if XMI exists
FETCH_FIGMA=false ./run_complete_pipeline.sh
# Or run steps individually:
# 1. Fetch
cd python_code && python3 main.py && cd ..
# 2. Transform M2M
./transform_figma_to_react.sh
# 3. Manually check react_new_instance.xmi in Eclipse
# 4. Generate code M2T
./refine_react.sh# Create .env file
cp python_code/.env.example python_code/.env
nano python_code/.env
# Add: FIGMA_TOKEN=your_token_herecd python_code
pip3 install -r requirements.txt
cd ..# Check:
# 1. FIGMA_TOKEN is valid (get from figma.com/settings)
# 2. File key is correct in main.py
# 3. Internet connection works# Update ECLIPSE_HOME in scripts
export ECLIPSE_HOME="/path/to/your/eclipse"cd ocl-validator
./build.sh
cd ..chmod +x *.sh
chmod +x ocl-validator/*.sh# Install ATL in Eclipse:
# Help > Eclipse Marketplace > Search "ATL" > Install================================================================================
FIGMA TO REACT - COMPLETE TRANSFORMATION PIPELINE
================================================================================
Pipeline Configuration:
Fetch Figma Design: true
Validate Figma Model: true
Run M2M Transformation: true
Validate React Model: false
Run M2T Refinement: true
================================================================================
[STEP 1] Fetching Figma Design from API
────────────────────────────────────────────────────────────────────────────
✓ Figma design fetched and converted to XMI
Output: Model/figma_instance.xmi (234567 bytes)
JSON: Model/figma_instance.json
[STEP 2] Validating Figma Instance Model
────────────────────────────────────────────────────────────────────────────
✓ Figma model validation PASSED
[STEP 3] Model-to-Model Transformation (Figma → React)
────────────────────────────────────────────────────────────────────────────
✓ Model-to-Model transformation COMPLETED
Output size: 45678 bytes
[STEP 4] Model-to-Text Transformation (React Model → React Code)
────────────────────────────────────────────────────────────────────────────
✓ Model-to-Text transformation COMPLETED
Generated React application at: ./MyApp
================================================================================
PIPELINE EXECUTION SUMMARY
================================================================================
✓ Pipeline completed successfully!
Total execution time: 28 seconds
Generated Artifacts:
✓ Model/figma_instance.xmi
✓ Model/react_new_instance.xmi
Pipeline Steps Executed:
✓ Fetch Figma Design (API → XMI)
✓ Figma Model Validation (OCL)
✓ Model-to-Model Transformation
✓ Model-to-Text Transformation
================================================================================
After running the pipeline, collect these metrics:
# Line count of transformation rules
wc -l Transformations/tranform.atl
wc -l Transformations/refine2.atl
# Model size
ls -lh Model/figma_instance.xmi
ls -lh Model/react_new_instance.xmi
# Generated code size
cd <AppName>
find src -name "*.jsx" | xargs wc -l# Number of OCL constraints
grep -c "^inv" Metamodel/figma_meta_model.ocl
# Validation execution time
time ./validate_models.sh figma# Number of generated files
find <AppName>/src -type f | wc -l
# Component count
find <AppName>/src/components -name "*.jsx" | wc -l
# Page count
find <AppName>/src/pages -name "*.jsx" | wc -l# 1. Show pipeline execution
./run_complete_pipeline.sh
# 2. Show validation details
./validate_models.sh figma
# 3. Show generated application
cd <AppName>
npm install
npm run dev
# Open browser to http://localhost:5173Capture these for your thesis:
- Pipeline execution output
- OCL validation results
- Generated file structure
- Running React application
- Component hierarchy in browser DevTools
Include these in your thesis appendix:
PIPELINE_README.md- Complete documentationTransformations/tranform.atl- Transformation rulesTransformations/refine2.atl- Code generationMetamodel/figma_meta_model.ocl- OCL constraints- Generated React application code samples
- ✓ Run the complete pipeline
- ✓ Verify generated application works
- ✓ Document transformation patterns
- ✓ Measure code quality metrics
- ✓ Compare with manual React development
- ✓ Write thesis sections
For issues or questions:
- Check
PIPELINE_README.mdfor detailed documentation - Review transformation logs
- Validate input models
- Check Eclipse ATL installation
Quick Reference Card
| Task | Command |
|---|---|
| Run everything | ./run_complete_pipeline.sh |
| Fetch Figma | cd python_code && python3 main.py && cd .. |
| Validate only | ./validate_models.sh figma |
| Transform only | ./transform_figma_to_react.sh |
| Generate code | ./refine_react.sh |
| Build validator | cd ocl-validator && ./build.sh |
| Run app | cd <YourFigmaDesignName> && npm install && npm run dev |
| Skip fetch | FETCH_FIGMA=false ./run_complete_pipeline.sh |
| Find app folder | ls -d */ | grep -v Model | grep -v Metamodel |
Last Updated: November 2025