Skip to content

Transform UI/UX designs into code with AI. Upload Figma designs, screenshots, or mockups and instantly generate HTML, CSS, and React components using GPT-4 Vision API. Features real-time preview, responsive layouts, and modern design conversion.

Notifications You must be signed in to change notification settings

priymavani/Design2Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Design2Code πŸš€

πŸ“‹ Project Overview

Design2Code is a full-stack AI-powered web application that converts website design images and natural language prompts into clean, responsive HTML code. Built during a Hackathon, this project leverages Google's Gemini AI API to analyze visual designs and generate production-ready front-end code in seconds.

Whether you're a designer who wants quick prototypes, a developer looking to accelerate development, or a student learning web development, Design2Code eliminates repetitive coding and lets you focus on what matters.

The Problem It Solves

  • ⏳ Slow Prototyping: Converting design mockups to code manually takes hours
  • 🎨 Designer-Developer Gap: Designers struggle to communicate exact styling to developers
  • πŸ“± Responsive Design: Building responsive layouts requires extensive media queries and testing
  • πŸ’‘ Ideation Speed: Rapid iteration and prototyping becomes a bottleneck

Target Users

  • 🎨 UI/UX Designers - Convert mockups to working prototypes instantly
  • πŸ‘¨β€πŸ’» Frontend Developers - Generate boilerplate code and focus on complex logic
  • 🏒 Startups & Agencies - Speed up project delivery and reduce development time
  • πŸ“š Students & Learning - Understand HTML/CSS best practices through AI-generated code

✨ Core Features

1. Image-to-Code Generation

  • Upload website design screenshots (PNG/JPEG)
  • AI analyzes layout, colors, typography, and spacing
  • Generates semantic HTML5 with embedded CSS
  • Creates responsive designs automatically

2. Prompt-to-Code Generation

  • Describe your website idea in natural language
  • AI generates complete HTML structure with modern styling
  • Supports complex design descriptions
  • Produces pixel-perfect, responsive code

3. Live Preview

  • Real-time HTML preview within the application
  • Test generated code before downloading
  • Visual validation of AI output
  • Interactive component testing

4. Multiple Creation Modes

  • πŸ“Έ Upload Mode - Convert design images to code
  • πŸ’¬ Prompt Mode - Generate code from descriptions
  • πŸ“ Whiteboard Mode - Sketch and convert
  • 🎨 Template Mode - Start from pre-built templates

5. Code Features

  • βœ… Semantic HTML5 structure
  • βœ… Modern CSS with Flexbox/Grid
  • βœ… Fully responsive (desktop, tablet, mobile)
  • βœ… Smooth animations and transitions
  • βœ… Professional styling (gradients, shadows, effects)
  • βœ… Accessibility-ready

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React 18 UI framework
TypeScript Type-safe development
Vite Fast build tool
Tailwind CSS Utility-first styling
Shadcn/ui High-quality component library
Framer Motion Smooth animations
GSAP Advanced animations
React Three Fiber 3D graphics
TanStack Query Data fetching & caching
React Router Client-side routing

Backend

Technology Purpose
Node.js JavaScript runtime
Express.js Web framework
Google Gemini AI API Code generation engine
Multer File upload handling
CORS Cross-origin support
Dotenv Environment variables

Languages & Styling

  • TypeScript: 85% of codebase
  • JavaScript: 9.9% (backend scripts)
  • CSS: 4.6% (custom styling)
  • HTML: 0.5% (markup)

πŸ—οΈ System Architecture & Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      USER INTERFACE (React)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Landing Page β”‚ Create Page  β”‚ Preview & Download       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              INPUT PROCESSING LAYER                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Image Upload β”‚ Text Prompt  β”‚ File Management          β”‚ β”‚
β”‚  β”‚ (Multer)     β”‚ Processing   β”‚ (Validation)             β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              EXPRESS BACKEND SERVER                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Image Route  β”‚ Prompt Route β”‚ Middleware (Error)       β”‚ β”‚
β”‚  β”‚  /upload     β”‚  /generate   β”‚ Handler, CORS            β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            AI PROCESSING LAYER (Controllers)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ imageToCode.js       β”‚ generationController.js          β”‚ β”‚
β”‚  β”‚ Process & Send to AI β”‚ Handle Generation Requests       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         SERVICES LAYER (External API Calls)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ imageService.js      β”‚ generationService.js             β”‚ β”‚
β”‚  β”‚ - Buffer to Base64   β”‚ - Build API request              β”‚ β”‚
β”‚  β”‚ - Send to Gemini API β”‚ - Parse Gemini response          β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       GOOGLE GEMINI AI (External Service)                    β”‚
β”‚         πŸ€– AI Code Generation Engine                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              GENERATED HTML RESPONSE                         β”‚
β”‚  β”œβ”€ Semantic HTML5 Structure                                β”‚
β”‚  β”œβ”€ Embedded CSS with Flexbox/Grid                          β”‚
β”‚  β”œβ”€ Responsive Media Queries                                β”‚
β”‚  └─ Modern Design Patterns                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Request Flow

  1. User Input β†’ Frontend captures image/prompt
  2. Upload/Send β†’ Data sent to Express backend via API
  3. Processing β†’ Backend validates and processes input
  4. AI Call β†’ Service layer sends to Google Gemini API
  5. Generation β†’ Gemini AI analyzes and generates code
  6. Response β†’ HTML code returned to frontend
  7. Preview β†’ Live preview rendered in iframe
  8. Download β†’ User downloads/uses generated code

πŸ“‘ API Documentation

Base URL

http://localhost:5000/api

Endpoints

1. Generate Code from Image

POST /upload/image-to-code
Content-Type: multipart/form-data

Body:
  image: <File> (PNG or JPEG)

Response (Success - 200)

{
  "code": "<!DOCTYPE html>\n<html>...",
  "timestamp": "2025-12-17T10:30:00Z"
}

Response (Error - 400/500)

{
  "error": "Error message describing what went wrong"
}

cURL Example:

curl -X POST http://localhost:5000/api/upload/image-to-code \
  -F "image=@design.png" \
  -H "Accept: application/json"

2. Generate Code from Prompt

POST /generate/prompt-to-code
Content-Type: application/json

Body:
{
  "prompt": "Create a modern landing page with a hero section, features grid, and CTA button"
}

Response (Success - 200)

{
  "code": "<!DOCTYPE html>\n<html>...",
  "timestamp": "2025-12-17T10:30:00Z"
}

cURL Example:

curl -X POST http://localhost:5000/api/generate/prompt-to-code \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Create a modern dashboard"}'

Request/Response Details

Aspect Details
Max File Size 10 MB
Supported Formats PNG, JPEG
Timeout 30 seconds
Rate Limit No limit (development)
Authentication None (development)

πŸš€ Installation & Setup Guide

Prerequisites

Before installing, ensure you have:

  • Node.js (v16.0.0 or higher)

  • npm (v7.0.0 or higher) - Comes with Node.js

    • Verify: npm --version
  • Git - For cloning the repository

  • Google Gemini API Key - Required for AI functionality

Step 1: Clone the Repository

git clone https://github.com/priymavani/Design2Code.git
cd Design2Code

Step 2: Set Up Backend

# Navigate to backend directory
cd backend

# Install dependencies
npm install

# Create .env file
echo "GEMINI_API_KEY=your_api_key_here" > .env
echo "PORT=5000" >> .env

# Verify .env
cat .env

Backend Dependencies Installed:

  • express - Web server framework
  • cors - Cross-origin resource sharing
  • multer - File upload handling
  • dotenv - Environment variables
  • nodemon - Auto-reload server
  • uuid - Unique ID generation

Step 3: Start Backend Server

# Start with nodemon (auto-reload on changes)
npm run dev

# OR start normally
npm start

Expected Output:

Server is running on port 5000

Step 4: Set Up Frontend (New Terminal)

# From project root, navigate to frontend
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

Expected Output:

Local: http://localhost:5173

Step 5: Access the Application

  1. Open browser: http://localhost:5173
  2. Navigate to "Create" page
  3. Choose mode (Upload Image or Enter Prompt)
  4. Generate and preview your code!

Common Setup Issues

Issue Solution
Port already in use Change PORT in .env or kill process on that port
Module not found Run npm install in the correct directory
GEMINI_API_KEY error Ensure .env file exists in backend/ with valid key
CORS error Verify frontend URL in server.js matches your dev URL
Build fails Delete node_modules and .lock files, run npm install again

πŸ“ Folder Structure Explanation

Design2Code/
β”œβ”€β”€ README.md                          # Project documentation
β”‚
β”œβ”€β”€ backend/                           # Express.js server
β”‚   β”œβ”€β”€ package.json                   # Backend dependencies
β”‚   β”œβ”€β”€ server.js                      # Main server file with routes
β”‚   β”‚
β”‚   β”œβ”€β”€ controllers/                   # Request handlers
β”‚   β”‚   β”œβ”€β”€ imageToCode.js             # Processes image uploads
β”‚   β”‚   β”œβ”€β”€ generationController.js    # Handles prompt generation
β”‚   β”‚   β”œβ”€β”€ chatController.js          # Chat functionality (future)
β”‚   β”‚   └── promptToCode.js            # Prompt processing
β”‚   β”‚
β”‚   β”œβ”€β”€ routes/                        # API endpoints
β”‚   β”‚   β”œβ”€β”€ imageRoute.js              # POST /api/upload/image-to-code
β”‚   β”‚   β”œβ”€β”€ generationRoute.js         # POST /api/generate/prompt-to-code
β”‚   β”‚   β”œβ”€β”€ chatRoute.js               # Chat endpoints (future)
β”‚   β”‚   └── promptRoute.js             # Prompt-related routes
β”‚   β”‚
β”‚   β”œβ”€β”€ services/                      # Business logic & API calls
β”‚   β”‚   β”œβ”€β”€ imageService.js            # Calls Gemini API for images
β”‚   β”‚   β”œβ”€β”€ generationService.js       # Calls Gemini API for prompts
β”‚   β”‚   β”œβ”€β”€ geminiService.js           # Shared Gemini utilities
β”‚   β”‚   └── conversationService.js     # Chat conversation logic
β”‚   β”‚
β”‚   β”œβ”€β”€ middleware/                    # Express middleware
β”‚   β”‚   └── errorHandler.js            # Global error handling
β”‚   β”‚
β”‚   └── .env                           # Environment variables (not in repo)
β”‚
β”œβ”€β”€ frontend/                          # React + TypeScript application
β”‚   β”œβ”€β”€ package.json                   # Frontend dependencies
β”‚   β”œβ”€β”€ vite.config.ts                 # Vite build configuration
β”‚   β”œβ”€β”€ tsconfig.json                  # TypeScript configuration
β”‚   β”œβ”€β”€ tailwind.config.ts             # Tailwind CSS config
β”‚   β”œβ”€β”€ postcss.config.js              # PostCSS configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.tsx                   # React entry point
β”‚   β”‚   β”œβ”€β”€ App.tsx                    # Root component with routing
β”‚   β”‚   β”œβ”€β”€ index.css                  # Global styles
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ pages/                     # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Index.tsx              # Landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ CreatePage.tsx         # Main code generation page
β”‚   β”‚   β”‚   β”œβ”€β”€ StickersPage.tsx       # Stickers/decorations page
β”‚   β”‚   β”‚   β”œβ”€β”€ RealisticRobot.tsx     # 3D robot component
β”‚   β”‚   β”‚   └── NotFound.tsx           # 404 page
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ components/                # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ LandingPage.tsx        # Hero section
β”‚   β”‚   β”‚   β”œβ”€β”€ CreatePage.tsx         # Creation workflow
β”‚   β”‚   β”‚   β”œβ”€β”€ LivePreview.tsx        # Code preview iframe
β”‚   β”‚   β”‚   β”œβ”€β”€ LoadingSpinner.tsx     # Loading animation
β”‚   β”‚   β”‚   β”œβ”€β”€ LogoGenerator.tsx      # Logo creation tool
β”‚   β”‚   β”‚   β”œβ”€β”€ OrbPreview.tsx         # 3D orb animation
β”‚   β”‚   β”‚   β”œβ”€β”€ ParticleBackground.tsx # Animated particles
β”‚   β”‚   β”‚   β”œβ”€β”€ ColorPaletteDisplay.tsx # Color picker
β”‚   β”‚   β”‚   β”œβ”€β”€ ExampleLogos.tsx       # Example templates
β”‚   β”‚   β”‚   β”œβ”€β”€ FeaturesTile.tsx       # Features showcase
β”‚   β”‚   β”‚   β”œβ”€β”€ ThemeToggleTile.tsx    # Dark mode toggle
β”‚   β”‚   β”‚   β”œβ”€β”€ ImpactTile.tsx         # Impact statistics
β”‚   β”‚   β”‚   β”œβ”€β”€ PreviewTile.tsx        # Code preview section
β”‚   β”‚   β”‚   β”œβ”€β”€ UploadTile.tsx         # File upload component
β”‚   β”‚   β”‚   β”œβ”€β”€ StickersTile.tsx       # Stickers showcase
β”‚   β”‚   β”‚   β”œβ”€β”€ FooterTile.tsx         # Footer component
β”‚   β”‚   β”‚   β”œβ”€β”€ SmoothScrollProvider.tsx # Scroll animation provider
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   └── ui/                    # shadcn/ui components
β”‚   β”‚   β”‚       β”œβ”€β”€ button.tsx         # Button component
β”‚   β”‚   β”‚       β”œβ”€β”€ card.tsx           # Card component
β”‚   β”‚   β”‚       β”œβ”€β”€ dialog.tsx         # Modal dialog
β”‚   β”‚   β”‚       β”œβ”€β”€ input.tsx          # Input field
β”‚   β”‚   β”‚       β”œβ”€β”€ textarea.tsx       # Text area
β”‚   β”‚   β”‚       β”œβ”€β”€ tabs.tsx           # Tab component
β”‚   β”‚   β”‚       β”œβ”€β”€ accordion.tsx      # Accordion
β”‚   β”‚   β”‚       β”œβ”€β”€ dropdown-menu.tsx  # Dropdown menu
β”‚   β”‚   β”‚       β”œβ”€β”€ skeleton.tsx       # Loading skeleton
β”‚   β”‚   β”‚       └── [20+ more UI components]
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ hooks/                     # Custom React hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ use-mobile.tsx         # Mobile detection hook
β”‚   β”‚   β”‚   └── use-toast.ts           # Toast notification hook
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ lib/                       # Utility functions
β”‚   β”‚   β”‚   └── utils.ts               # Helper functions
β”‚   β”‚   β”‚
β”‚   β”‚   └── vite-env.d.ts              # Vite type definitions
β”‚   β”‚
β”‚   β”œβ”€β”€ public/                        # Static assets
β”‚   β”‚
β”‚   └── index.html                     # HTML entry point
β”‚
└── .gitignore                         # Git ignore rules

Key Directory Purposes

Directory Purpose Key Files
backend/controllers Handle incoming requests imageToCode.js
backend/services Business logic & API calls imageService.js
backend/routes Define API endpoints imageRoute.js
frontend/pages Full page components CreatePage.tsx
frontend/components Reusable UI components LivePreview.tsx
frontend/components/ui Pre-built UI library 30+ shadcn components

πŸ” Environment Variables

Create a .env file in the backend/ directory:

# .env
GEMINI_API_KEY=your_actual_gemini_api_key_here
PORT=5000

Variable Details

Variable Type Required Description
GEMINI_API_KEY String βœ… Yes Google Gemini API key for code generation
PORT Number ❌ No Server port (default: 5000)

How to Get GEMINI_API_KEY

  1. Visit Google AI Studio
  2. Click "Create API Key"
  3. Copy the generated key
  4. Paste into .env file

Security Note

⚠️ Never commit .env to Git! It's already in .gitignore.


πŸ’» How to Use the Application

1. Landing Page

  • View project features and benefits
  • See example logos and stickers
  • Understand the technology stack
  • Browse theme options

2. Create Page - Main Workflow

Option A: Image to Code

1. Click "Upload Design Image" button
2. Select PNG or JPEG file from computer
3. Click "Generate Code"
4. AI analyzes image and generates HTML
5. Preview generated code in live preview
6. Download or copy code

Option B: Prompt to Code

1. Click "Describe Your Website" button
2. Type detailed description:
   - "Create a modern e-commerce landing page with 
      hero section, product cards, and contact form"
3. Click "Generate Code"
4. AI generates responsive HTML
5. Preview and download

Option C: Template Mode

1. Browse pre-built templates
2. Select "Modern Dashboard" or others
3. View template preview
4. Use as starting point or modify

3. Live Preview

  • Generated code displayed in live iframe
  • See responsive design in real-time
  • Test on different screen sizes
  • Interactive component testing

4. Download & Export

  • Copy code to clipboard
  • Download as .html file
  • Share preview link
  • Edit in your editor

5. Stickers Page

  • Browse decorative stickers
  • Add to your designs
  • Export as SVG/PNG

About

Transform UI/UX designs into code with AI. Upload Figma designs, screenshots, or mockups and instantly generate HTML, CSS, and React components using GPT-4 Vision API. Features real-time preview, responsive layouts, and modern design conversion.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •