Deploy Screenshot to Code
Turn screenshots and mockups into HTML, Tailwind or React code with AI
Screenshot to Code
Just deployed
Just deployed
/data
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 (commit
f2e5bbd, 2026-11-15) - Template repo, Dockerfiles and changelog: aalfath/screenshot-to-code-railway-template
- Model providers: OpenAI, Anthropic, Google AI Studio
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
/datafor design systems, saved image assets and run logs.
After deploy:
- Copy
BASIC_AUTH_PASSWORDfrom the Screenshot to Code service's variables and open its public URL; the user name isadmin. - Click the gear icon and paste an OpenAI, Anthropic or Gemini key. The browser stores it and sends it with each request.
- 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.
Template Content
Screenshot to Code
aalfath/screenshot-to-code-railway-template
