MCPcopy Index your code
hub / github.com/SawyerHood/draw-a-ui

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

repository ↗ · DeepWiki ↗
25 symbols 49 edges 11 files 0 documented · 0% 6 cross-repo links
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

TabButtonProps (Interface)
(no doc)
components/PreviewModal.tsx
CRCCalculator (Interface)
(no doc)
lib/png.ts

Core symbols most depended-on inside this repo

findChunk
called by 2
lib/png.ts
highlight
called by 1
components/PreviewModal.tsx
blobToBase64
called by 1
lib/blobToBase64.ts
crc
called by 1
lib/png.ts
isPng
called by 1
lib/png.ts
getChunkType
called by 1
lib/png.ts
readChunks
called by 1
lib/png.ts
setPhysChunk
called by 1
lib/png.ts

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