draw-a-ui README

The project's README from github.com/SawyerHood/draw-a-ui. As one markdown file: README.md.

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.

draw-a-ui (SawyerHood/draw-a-ui)

Searching Database…

13.6K ·GitHub
What is this?An app that lets you draw a UI wireframe on a canvas and uses GPT-4 Vision to generate a working HTML page (with Tailwind) based on the sketch.
How does it actually turn my drawing into HTML?It takes the current canvas as an SVG, converts it to a PNG, and sends that image to GPT-4 Vision with instructions to return a single HTML file styled with Tailwind.
How do I run it?It's a Next.js app: install dependencies and run the dev commands from the project root, then open it in your browser.
What do I need before running this?You need an OpenAI API key with access to the GPT-4 Vision API, and Node.js greater than version 18.17 since it uses Next.js 14.
Is this safe to deploy for other people to use?No — it's explicitly a demo with no authentication, so deploying it publicly means anyone can rack up OpenAI API charges on your key.
Where does this run?It runs as a local web app in your browser, built on Next.js.
What drawing tool does it use for the canvas?It uses tldraw, an open-source infinite canvas library, as the drawing surface for sketching the wireframe.
Is there a successor project worth checking out?The README notes that the spiritual successor to this project is Terragon Labs.
What output do I get from a sketch?A single generated HTML file styled with Tailwind CSS that approximates the wireframe you drew.
Creator
SawyerHood
Size
1 MB
Stars
13.6K
Updated
CommitJul 26
Age
2y
Commits · 90 Days