---
title: "Deploy Screenshot to Code"
description: "Turn screenshots and mockups into HTML, Tailwind or React code with AI"
category: "AI/ML"
url: https://railway.com/deploy/screenshot-to-code
---

# Deploy Screenshot to Code

Turn screenshots and mockups into HTML, Tailwind or React code with AI

**[Deploy Screenshot to Code on Railway](https://railway.com/template/screenshot-to-code)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/screenshot-to-code/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### Screenshot to Code https://raw.githubusercontent.com/abi/screenshot-to-code/f2e5bbdd1dd5d93c259548d9bccf54e2a5f06a30/frontend/public/favicon/main.png

- **Source:** https://github.com/aalfath/screenshot-to-code-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

### Backend https://raw.githubusercontent.com/abi/screenshot-to-code/f2e5bbdd1dd5d93c259548d9bccf54e2a5f06a30/frontend/public/favicon/main.png

- **Source:** https://github.com/aalfath/screenshot-to-code-railway-template
- **Health check:** /

## Documentation

# Deploy and Host Screenshot to Code on Railway

Screenshot to Code is an open-source (MIT) app that turns screenshots, mockups, screen recordings and text prompts into working frontend code with large language models. It writes HTML with Tailwind or CSS, React, Vue, Bootstrap or Ionic, shows several variants side by side, and lets you refine the result with follow-up instructions.

## About Hosting Screenshot to Code

Screenshot to Code has two parts: a React frontend and a Python FastAPI backend that calls OpenAI, Anthropic or Gemini models and streams the code back over a WebSocket. This template builds both from upstream commit `f2e5bbd`, pinned in our GitHub repo. The public **Screenshot to Code** service serves the built frontend through Caddy with HTTP basic auth and a generated password, and forwards only the app's own API and WebSocket routes to a private **Backend** over Railway's private network. The backend includes Playwright Chromium for URL screenshots and keeps design systems and saved assets on a volume. You bring your own model API key.

## Common Use Cases

* Turn a screenshot of an existing site or app into editable HTML/Tailwind or React code
* Convert a design mockup or wireframe into a working first version of a page
* Record a short screen video of an interface and get an interactive prototype

## Dependencies for Screenshot to Code Hosting

* An API key from OpenAI, Anthropic or Google Gemini (billed by that provider)
* Two Railway services built from one repo, plus a volume for the backend

### Deployment Dependencies

* Upstream source: [abi/screenshot-to-code](https://github.com/abi/screenshot-to-code) (commit `f2e5bbd`, 2026-11-15)
* Template repo, Dockerfiles and changelog: [aalfath/screenshot-to-code-railway-template](https://github.com/aalfath/screenshot-to-code-railway-template)
* Model providers: [OpenAI](https://platform.openai.com/api-keys), [Anthropic](https://console.anthropic.com/), [Google AI Studio](https://aistudio.google.com/apikey)

### Implementation Details

Services:

* **Screenshot to Code** (public): Caddy 2.11.9 serving the frontend. Basic auth on every path except `/healthz`. Proxies `/generate-code`, `/api/*` and `/local-assets/*` to Backend; upstream's eval and debug routes are not exposed.
* **Backend** (private, no public domain): FastAPI with Playwright Chromium on Python 3.12. Volume on `/data` for design systems, saved image assets and run logs.

After deploy:

1. Copy `BASIC_AUTH_PASSWORD` from the **Screenshot to Code** service's variables and open its public URL; the user name is `admin`.
2. Click the gear icon and paste an OpenAI, Anthropic or Gemini key. The browser stores it and sends it with each request.
3. Upload a screenshot, pick a stack and generate.

To share one key with everyone who can log in, add `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` or `GEMINI_API_KEY` to the **Backend** service instead (optional: `OPENAI_BASE_URL`, `REPLICATE_API_KEY` for image generation).

Updates: when we bump the pinned upstream commit, Railway shows an update notice for both services; the changelog in the repo lists what changed. Data on the Backend volume is kept.

## Why Deploy Screenshot to Code on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Screenshot to Code on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/screenshot-to-code
