Open the service · Local installation · Download source (ZIP)
Screenshot to Code turns a screen image into an interface starting point. Use it to build a separate prototype from your mockup, compare it with the reference and move suitable parts into your project.
What it is useful for
For example, a screenshot shows a catalogue with filters and cards. The app can generate markup and styles, but filter behaviour, loading states and data sources need separate decisions. A still image cannot reveal them.
The official project supports HTML with CSS or Tailwind, React with Tailwind, Vue with Tailwind and other README options. Choose the technology for the existing site. Open generated code separately first; do not replace a working shop with a prototype and its sample data.
Compare three routes. The cloud service is easier to try without local setup; the local app suits changes to the generator itself; direct implementation in Codex can reuse existing components immediately. For one small screen, direct implementation may take less work than installing an app.
How to start and prepare access
The shortest route is to open the official service, check current terms and upload an authorised screenshot. For a local run, ask Codex to read the README and find an existing copy. This separate app has two processes: a FastAPI server and React/Vite frontend. This installation does not create a Codex MCP.
- Check Python, Poetry, Node.js and pnpm against the selected version's dependencies. The current
pyproject.tomlrequires Python 3.10 or later, below 4; check Node.js against actual frontend dependencies. Agree on missing installations first. - If no copy exists, approve downloading the official repository into a separate folder. The assistant determines its location and records the source version.
git clone https://github.com/abi/screenshot-to-code.git
- Local generation needs at least one model-provider key: OpenAI, Anthropic or Gemini. Extra keys enable other features; a first trial does not need all of them. The assistant checks available settings and helps store the key privately in the intended location, such as
backend/.env. Do not paste the key into prompts, Git or reports. - After dependency approval, start a separate process in the actual
backendfolder:
poetry install
poetry run uvicorn main:app --host 127.0.0.1 --reload --port 7001
- In a second process from
frontend, start the interface:
pnpm install
pnpm dev --host 127.0.0.1
The default address is http://localhost:5173; use the address actually printed by the process. For a different backend port, align VITE_HTTP_BACKEND_URL and VITE_WS_BACKEND_URL in frontend/.env.local.
Local execution still sends the screenshot and task to the chosen external provider. Before sending, remove personal data, keys and other parties' private materials. API costs are separate from chat subscriptions; check cloud-service terms before uploading.
How to get the first prototype
Choose one screen of your own with a clear main action. If the mockup is desktop-only, decide how cards and filters should behave on a phone.
- Find the screenshot, text and authorised images. Record the reference width and select a target technology.
- After approving transmission, upload the screenshot and request only this screen. Clarify unseen states: empty results, errors, loading and button actions.
- Open generated code in a separate preview. Compare content width, wrapping, spacing and images at the reference width.
- Check the keyboard, long Russian labels, 390-pixel width and main action. State explicitly if a button uses examples, then connect real data separately.
The app has an optional Chromium screenshot-preview tool, whose availability appears in Settings. Without its browser, the app skips the check; the assistant must not claim it viewed the result. Agree separately on browser installation. The project's available browser can also check the prototype.
Where it is used
In the site or app design plan, choosing a transfer method, compare a separate generated prototype with direct project work. Then build a local prototype.
For analysing a reference's design rules first, use Design DNA. It saves a design profile before application.
How to check results and fix errors
If the app opens but generation does not start, check the server process, connection address, selected provider and key availability separately. Show errors without secrets. A page loading on port 5173 does not confirm a working model API.
If the design matches only at one size, check width limits, fixed dimensions and grid behaviour. Replace random images with your authorised assets. A screenshot cannot test form submission, data storage or permissions; run those flows separately against the real system.
The task is complete when the editable prototype reopens, checked actions work and agreed differences are recorded. Review changes and preserve previous components before moving code into the main project. Undo transferred changes to revert; stop both local processes to shut down the app.
Continue to the overall interface check, including real data and errors.
Prompt for Codex
Paste into Codex or Work with project access and your mockup. The assistant will find files and propose a transfer method.
Help create a testable prototype from my screen image. Find the current project, mockup, text, authorised images and existing components. Read https://github.com/abi/screenshot-to-code. Compare direct implementation, the official cloud service and the local app. Explain the shortest route for this task, external-provider data transmission and possible costs. Use existing connections; ask before missing installations, keys and screenshot transmission. Do not expose secrets or save them in Git.
For a local run, find an existing copy or prepare a separate one and check Python, Poetry, Node.js and pnpm for the chosen version. After dependency approval, start the server and frontend on local addresses and verify their connection. Use one authorised screenshot and the project's technology for the first trial. Clarify button actions, data, loading, empty results, errors and mobile behaviour that the image does not show. Open a separate prototype and compare at equal width. Check 390 pixels, long Russian text, keyboard navigation and the main action. Distinguish sample data from a real connection, and code checks from browser viewing. Show changes before transferring code, then save selected parts while preserving project functions. Keep the editable result, start, stop and undo instructions, completed checks and the next step.