MCPcopy Create free account
hub / github.com/SawyerHood/draw-a-ui

github.com/SawyerHood/draw-a-ui @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
25 symbols 49 edges 11 files 0 documented · 0% 3 cross-repo links updated 13mo ago★ 13,58035 open issues

Browse by type

Functions 21 Types & classes 4
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

draw-a-ui

This is an app that uses tldraw and the gpt-4-vision api to generate html based on a wireframe you draw.

The spiritual successor to this project is Terragon Labs.

A demo of the app

This works by just taking the current canvas SVG, converting it to a PNG, and sending that png to gpt-4-vision with instructions to return a single html file with tailwind.

Disclaimer: This is a demo and is not intended for production use. It doesn't have any auth so you will go broke if you deploy it.

Getting Started

This is a Next.js app. To get started run the following commands in the root directory of the project. You will need an OpenAI API key with access to the GPT-4 Vision API.

Note this uses Next.js 14 and requires a version of node greater than 18.17. Read more here.

echo "OPENAI_API_KEY=sk-your-key" > .env.local
npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 15
Method 6
Class 2
Interface 2

Languages

TypeScript100%

Modules by API surface

lib/png.ts10 symbols
components/PreviewModal.tsx4 symbols
lib/getSvgAsImage.ts3 symbols
app/page.tsx3 symbols
lib/getBrowserCanvasMaxSize.ts2 symbols
lib/blobToBase64.ts1 symbols
app/layout.tsx1 symbols
app/api/toHtml/route.ts1 symbols

Dependencies from manifests, versioned

@tldraw/tldraw2.0.0-alpha.17 · 1×
@types/canvas-size1.2.1 · 1×
@types/node20 · 1×
@types/prismjs1.26.3 · 1×
@types/react18 · 1×
@types/react-dom18 · 1×
autoprefixer10.0.1 · 1×
canvas-size1.2.6 · 1×
eslint8 · 1×
eslint-config-next14.2.3 · 1×
next14.2.3 · 1×
openai4.47.1 · 1×

For agents

$ claude mcp add draw-a-ui \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page