Skip to content

punyamahajan/SketchFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SketchFlow AI

Sketch β†’ Intent β†’ Audit β†’ Blueprint β†’ Production React Code

Upload a wireframe. Get a full frontend. In minutes.

Python FastAPI React TypeScript TailwindCSS Claude


What is SketchFlow?

SketchFlow AI transforms a hand-drawn wireframe or whiteboard photo into a fully structured, production-ready React application β€” using Claude's vision and reasoning capabilities across a five-stage pipeline.

Most teams fail not because they can't code, but because they start coding before requirements are complete. SketchFlow forces the right order: understand first, build second.


The Pipeline

πŸ“Έ Sketch Image
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  1. Vision Extract  β”‚  Claude reads your sketch and extracts structured product intent
β”‚     (Claude API)    β”‚  β€” screens, features, user flows, layout, open questions
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  2. Intent Editor   β”‚  You review and edit the extracted intent before anything proceeds
β”‚     (Human step)    β”‚  β€” correct names, add screens, remove wrong assumptions
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  3. Product Audit   β”‚  Claude acts as a PM reviewer β€” finds missing screens,
β”‚     (Claude API)    β”‚  broken flows, missing UI states, UX issues, industry requirements
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  4. Blueprint       β”‚  Architecture document: screen inventory, component inventory,
β”‚     (Claude API)    β”‚  design system, user flows, responsive requirements, libraries
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  5. Code Generation β”‚  Two-pass React generation using image + intent + audit + blueprint
β”‚     (Claude API)    β”‚  β†’ Download a ready-to-run ZIP with package.json + README
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

  • Claude Vision β€” reads any wireframe: hand-drawn, Figma export, whiteboard photo, napkin sketch
  • Intent Editor β€” fully editable before anything is locked in; add/remove screens, features, flows
  • PM-grade Audit β€” missing screens, broken user flows, missing UI states, UX issues, industry compliance
  • Frontend Blueprint β€” screen inventory, component inventory, design system, responsive requirements
  • Two-pass Code Generation β€” core structure first, then pages and config; image-grounded output
  • Smart package.json β€” named after your product, includes all libraries the blueprint recommends
  • Step-by-step README β€” every generated ZIP includes a README so anyone can run it immediately
  • Truncation recovery β€” if Claude's response is cut short, the parser salvages the valid portion
  • SQLite persistence β€” every project step is saved; nothing is lost on restart

Tech Stack

Layer Technology
AI Anthropic Claude (Vision + Generation)
Backend Python 3.10, FastAPI, SQLAlchemy, SQLite
Frontend React 18, TypeScript, Vite, TailwindCSS
Output React + Vite + TypeScript + TailwindCSS project

Getting Started

Prerequisites


1. Clone the repo

git clone https://github.com/yourusername/sketchflow-v2.git
cd sketchflow-v2

2. Backend setup

cd backend

# Create and activate virtual environment
python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Create a .env file in the backend/ directory:

ANTHROPIC_API_KEY=sk-ant-your-key-here
CLAUDE_MODEL=claude-haiku-4-5-20251001
DATABASE_URL=sqlite:///./sketchflow.db

Start the backend:

uvicorn main:app --reload --port 8000

API docs available at: http://localhost:8000/docs


3. Frontend setup

cd frontend
npm install
npm run dev

Open http://localhost:5173 in your browser.


Project Structure

sketchflow-v2/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                        # FastAPI app entry point
β”‚   └── app/
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   └── routes.py              # All API endpoints
β”‚       β”œβ”€β”€ core/
β”‚       β”‚   β”œβ”€β”€ config.py              # Settings from .env
β”‚       β”‚   └── database.py            # SQLAlchemy + SQLite setup
β”‚       β”œβ”€β”€ models/
β”‚       β”‚   └── models.py              # DB models (Project, Intent, Audit, Blueprint, Generation)
β”‚       β”œβ”€β”€ schemas/
β”‚       β”‚   └── schemas.py             # Pydantic request/response schemas
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ vision_service.py      # Stage 1: Claude Vision intent extraction
β”‚       β”‚   β”œβ”€β”€ audit_service.py       # Stage 3: PM audit via Claude
β”‚       β”‚   β”œβ”€β”€ blueprint_service.py   # Stage 4: Architecture blueprint via Claude
β”‚       β”‚   └── codegen_service.py     # Stage 5: Two-pass React code generation
β”‚       └── utils/
β”‚           └── zip_utils.py           # ZIP packaging for generated projects
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ App.tsx                    # Root component, step state machine
    β”‚   β”œβ”€β”€ api/client.ts              # All backend API calls
    β”‚   β”œβ”€β”€ types/index.ts             # TypeScript interfaces
    β”‚   └── pages/
    β”‚       β”œβ”€β”€ UploadStep.tsx         # Step 1: Sketch upload with drag-and-drop
    β”‚       β”œβ”€β”€ IntentStep.tsx         # Step 2: Intent review and edit
    β”‚       β”œβ”€β”€ AuditStep.tsx          # Step 3: Audit results display
    β”‚       β”œβ”€β”€ BlueprintStep.tsx      # Step 4: Blueprint viewer
    β”‚       └── GenerateStep.tsx       # Step 5: Generate and download
    └── vite.config.ts

API Reference

Method Endpoint Description
GET /api/health Health check
POST /api/projects/upload Upload sketch image, extract intent
GET /api/projects/{id}/intent Get extracted intent
PATCH /api/projects/{id}/intent Save intent edits
POST /api/projects/{id}/intent/confirm Lock in intent, proceed to audit
POST /api/projects/{id}/audit Run PM audit
GET /api/projects/{id}/audit Get audit results
POST /api/projects/{id}/blueprint Generate frontend blueprint
GET /api/projects/{id}/blueprint Get blueprint
POST /api/projects/{id}/generate Generate React frontend ZIP
GET /api/projects/{id}/download Download ZIP file

What Gets Generated

Every downloaded ZIP contains a complete, runnable React project:

your-project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.tsx                  # Root with React Router
β”‚   β”œβ”€β”€ main.tsx                 # Entry point
β”‚   β”œβ”€β”€ index.css                # Tailwind imports
β”‚   β”œβ”€β”€ types/index.ts           # TypeScript interfaces
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   β”œβ”€β”€ Layout.tsx       # App shell
β”‚   β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx      # Navigation sidebar
β”‚   β”‚   β”‚   └── Navbar.tsx       # Top navbar
β”‚   β”‚   └── ui/
β”‚   β”‚       β”œβ”€β”€ StatCard.tsx     # KPI card component
β”‚   β”‚       β”œβ”€β”€ DataTable.tsx    # Reusable data table
β”‚   β”‚       └── Badge.tsx        # Status badge
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx
β”‚   β”‚   β”œβ”€β”€ Orders.tsx
β”‚   β”‚   └── Products.tsx
β”‚   └── hooks/
β”‚       └── useSidebar.ts
β”œβ”€β”€ package.json                 # Named after your product, correct deps
β”œβ”€β”€ vite.config.ts
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ index.html
└── README.md                    # Step-by-step run instructions

Run it with:

npm install
npm run dev

How the Code Generation Works

SketchFlow uses a two-pass generation strategy to stay within Claude's output limits while producing a complete project:

Pass 1 β€” Claude receives the sketch image + full context and generates the core structure: App.tsx, Layout.tsx, Sidebar.tsx, Navbar.tsx, types/index.ts, and the primary Dashboard.tsx page.

Pass 2 β€” Claude receives the Pass 1 output as context and generates the remaining files: additional pages, reusable UI components, hooks, and all config files.

package.json and README.md are always generated in Python β€” not by Claude β€” so they are always present, valid, and reflect the actual product name and libraries from the blueprint.


Environment Variables

Variable Description Default
ANTHROPIC_API_KEY Your Anthropic API key Required
CLAUDE_MODEL Claude model to use claude-haiku-4-5-20251001
DATABASE_URL SQLAlchemy DB URL sqlite:///./sketchflow.db

Known Limitations

  • Generated code is a strong starting point, not a finished product β€” expect to customise routing, data fetching, and business logic
  • Very complex sketches with 15+ screens may produce incomplete output from the haiku model; switch to a larger model in .env for better results
  • The SQLite database is local and single-user; for team use, swap to PostgreSQL via DATABASE_URL

Built With


About

AI-powered platform that transforms sketches into frontend-ready React applications through intent extraction, product auditing, and implementation blueprint generation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors