Skip to content

shubhamjha16/FigmaAgent

Repository files navigation

FigmaAgent

Project Overview

FigmaAgent is an intelligent web application designed to accelerate the development process by bridging the gap between design and code. It allows developers to paste CSS extracted from a Figma design and, using AI, automatically generate key development artifacts.

The core functionalities include:

  1. Multi-Language Code Generation: It generates frontend and backend code in three different languages:
    • React: Creates a functional React component styled with Tailwind CSS.
    • TypeScript: Infers and generates relevant TypeScript types and interfaces based on the design's structure.
    • Python: Produces a basic GUI script using a library like Tkinter or PyQt.
  2. Interactive Flowchart Generation: It creates a markdown flowchart that visualizes the UI elements and their potential interactions.
  3. AI-Powered Clarification: If the initial CSS has logical gaps or ambiguities (e.g., how two buttons should interact), the AI agent asks the user targeted multiple-choice questions. Based on the user's answers, it regenerates a more accurate and complete flowchart.

This tool streamlines the handoff from design to development, ensuring consistency and saving developers significant time.


Weekly Development Breakdown

Here is a summary of the work completed over the last three weeks to build the FigmaAgent application.

Week 8: Foundation & Core Generation Engine

This week focused on setting up the project's foundation and implementing the primary AI generation capabilities.

  • Project Initialization:
    • Set up a new Next.js 14 application.
    • Integrated ShadCN UI library and configured Tailwind CSS for a modern, component-based design system.
    • Established the basic file structure, including components, AI flows, and server actions.
  • UI Scaffolding:
    • Developed the main user interface in src/app/page.tsx, featuring a large textarea for CSS input and a tabbed layout to display the different outputs.
    • Added the FigmaAgentLogo and styled the header and layout for a professional look.
  • Initial AI Flow Implementation:
    • Created the initial server-side AI flows using Genkit for code generation.
    • Implemented three separate flows: generateReactCode, generateTypeScriptCode, and generatePythonCode.
    • These flows were designed to take CSS as input and return the corresponding generated code as a string.
  • Backend-Frontend Integration:
    • Wrote Next.js server actions (actions.ts) to connect the frontend "Generate" button to the backend AI flows.
    • Implemented loading states and result display, showing the generated code in the appropriate tabs upon completion.

Week 9: Introducing Flowchart Generation & Interactivity

This week's goal was to move beyond simple code generation and introduce the more complex, interactive flowcharting feature.

  • Flowchart Generation Flow:
    • Developed a new Genkit flow, generateFlowchartFromFigma, trained to analyze Figma CSS and produce a logical interaction flowchart in markdown format.
  • Implementing the Clarification Loop (Q&A Feature):
    • Upgraded the generateFlowchartFromFigma flow to identify logical ambiguities in the design.
    • When an ambiguity is found, the AI now formulates a set of multiple-choice questions to ask the user for clarification.
  • UI for Q&A:
    • Modified the frontend in src/app/page.tsx to handle the new interactive flow.
    • Added logic to conditionally display the clarification questions sent by the AI.
    • Implemented state management to store the questions and the user's selected answers, preparing for the refinement step.

Week 10: Flowchart Refinement and UI Polish

This week was dedicated to completing the interactive flowchart feature and polishing the user experience.

  • Flowchart Refinement Logic:
    • Implemented the final step of the interactive loop. The application now successfully takes the user's answers and sends them back to the AI.
    • The AI uses these answers to generate a new, more accurate, and logically complete flowchart, which is then displayed to the user.
  • UI and State Management Polish:
    • Improved the loading indicators and button states to give the user clearer feedback during the multi-step generation process (initial generation vs. refinement).
    • Ensured all UI states—initial, loading, displaying results, asking questions, and displaying the refined flowchart—transition smoothly.
  • Final Integration:
    • Completed the integration of all features, ensuring that code generation, initial flowcharting, the Q&A loop, and flowchart refinement all work together seamlessly within the user interface.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages