Self-host bolt.diy: an open-source AI app builder on Railway
Run bolt.diy, the open-source Bolt.new, on Railway. Bring your own model keys, build web apps by chatting, and keep the keys safe.By chin · Oct 29, 2026 · 5 min read
AI app builders let you describe a website in plain English and watch it appear, code and all. The hosted versions are quick to try, but they come with message limits, a subscription, and one company's choice of model.
bolt.diy is the open-source version of that idea. You host the app, you pick the model for every prompt, and you pay the model provider directly. This guide explains what the bolt.diy template deploys, how to get to your first project, and the one setting you must get right before sharing the URL.
What bolt.diy is
bolt.diy is the open-source sibling of StackBlitz's Bolt.new. It was started by Cole Medin and is now a community project under the
stackblitz-labs organisation on GitHub. It is a browser-based workspace with three parts on one screen:- a chat, where you describe what you want and ask for changes
- a code editor and terminal, where you can see and edit every file the model writes
- a live preview, which runs your app as you build it
The trick is WebContainers, a technology that runs a full Node.js environment inside your browser tab. Installing packages, running the dev server and previewing the result all happen on your machine, in the browser. The Railway service mostly serves the app and relays your prompts to the model provider.
bolt.diy supports more than 20 model providers, including OpenAI, Anthropic, Google, Groq, xAI, DeepSeek, OpenRouter, and local models through Ollama or LM Studio. When a project is ready, you can download it as a ZIP, push it to GitHub, or deploy it to Netlify, Vercel or GitHub Pages from inside the app.
The project's own README notes that current work focuses on bug fixes, dependency updates and reliability, with no new features planned. It is a mature tool rather than a fast-moving one.
What the template deploys
The template is deliberately small:
- One service,
app, running the officialghcr.io/stackblitz-labs/bolt.diyimage. - No database and no volume. There is nothing to back up on the server.
That works because bolt.diy keeps your work in the browser. Chat history is stored in your browser's IndexedDB, and API keys you enter in the settings are stored in browser cookies. The upside is a cheap, stateless service. The downside is that your chats live on one device, in one browser. Clear your site data and they are gone.
First-run setup
- Deploy the bolt.diy template. No variables are required, so you can deploy with the defaults.
- Open the service in Railway and generate a public domain under Settings → Networking. The app listens on the port in
PORT, which the template sets to5173. - Open the URL in a desktop browser. WebContainers need a recent browser, so use an up-to-date desktop one.
- Click the Settings icon in the sidebar, open Providers, pick a provider and paste your API key. A green checkmark means the key works.
- Choose a model in the chat box and describe your first project. Name the stack you want, for example "a Vite and React to-do app styled with Tailwind".
- When you like the result, download a ZIP or push it to GitHub so it exists somewhere other than your browser.
Settings worth knowing
The template ships with a list of optional variables. These are the ones that matter:
- Provider keys:
OPENAI_API_KEY,ANTHROPIC_API_KEY,GOOGLE_GENERATIVE_AI_API_KEY,GROQ_API_KEY,OPEN_ROUTER_API_KEY,XAI_API_KEY,TOGETHER_API_KEYandHuggingFace_API_KEY. All are empty by default. Read the security section below before filling any of them in. OLLAMA_API_BASE_URLpoints bolt.diy at an Ollama server if you run local or self-hosted models.TOGETHER_API_BASE_URLdoes the same for Together.DEFAULT_NUM_CTXsets the default context size for Ollama models (32768in the template). Lower it if your Ollama server runs short of memory.NODE_ENVis set todevelopmentandVITE_LOG_LEVELtodebug. Together with theVITE_HMR_*,CHOKIDAR_USEPOLLINGandWATCHPACK_POLLINGvariables, these mirror the project's development Docker setup. Leave them alone unless you know why you are changing them.
Keep your API keys to yourself
This is the important part. bolt.diy has no login screen. Anyone who knows your Railway URL can open the app and send prompts.
That changes how you should handle keys:
- Keys entered in the browser settings stay in your browser's cookies. Other visitors cannot use them, because their browsers do not have them.
- Keys set as Railway variables live on the server and are available to every visitor. Anyone who finds the URL can build apps on your bill.
So for a public URL, leave the provider variables empty and enter keys in the settings panel instead. Only use server-side keys if the URL is private to you or your team, and set a spending limit with your model provider either way.
When to use it
bolt.diy is a good fit when you want to:
- prototype quickly: a landing page, an internal tool or a demo for a meeting
- compare models on the same task, since you can switch provider per prompt
- learn by watching: every file is visible and editable, so you can see how the model structured the app
- avoid a subscription and pay only for the tokens you use
It is less suited to large, long-lived codebases. Once a project grows, move it to GitHub and continue in your usual editor. If what you want is a chat assistant rather than an app builder, see self-hosted ChatGPT alternatives. New to deploying templates? Start with the Railway template deploy guide.
Cost and security checklist
- Leave server-side provider keys empty on any public URL.
- Set a monthly spending limit with each model provider you use.
- Set a usage limit in Railway. The service is light, because the heavy work runs in your browser.
- Export or push projects you care about. Browser storage is not a backup.
- Review generated code before you deploy it anywhere public, especially anything that handles logins or user data.
- If you deploy apps to Vercel or Netlify from bolt.diy, use tokens scoped to what you need.
Frequently asked questions
Is bolt.diy the same as Bolt.new?
No. Bolt.new is StackBlitz's hosted product. bolt.diy is the open-source, community-driven version you run yourself, with your choice of model provider.
Where are my projects saved?
In your browser. Chat history uses IndexedDB, so it stays on the device and browser you used. Download a ZIP or push to GitHub to keep a copy elsewhere.
Which model should I use?
The bolt.diy FAQ recommends a capable coding model with a large context window for full projects, and a smaller, faster model for quick edits. Try a small task first and compare.
Can I use it commercially?
bolt.diy is MIT licensed. It relies on the WebContainers API, which has its own commercial licensing terms for enterprise use, so check those before building a business on it.
Templates in this guide
More guides
- Build a self-hosted Perplexity alternative with Morphic, SearXNG and FirecrawlSelf-host an AI answer engine with cited sources. Compare Morphic, Open DeepResearch and Fireplexity, and add private search with SearXNG or Whoogle.
- How to self-host Excalidraw with real-time collaborationRun your own Excalidraw whiteboard with live, end-to-end encrypted collaboration on Railway. Covers how the two services fit together, setup, and common fixes.
- Self-hosted ChatGPT alternatives: Open WebUI vs LibreChat vs big-AGICompare three open-source ChatGPT-style interfaces you can self-host on Railway, where each one stores your chats, and which to pick for you or your team.