---
title: "Deploy ComfyUI"
description: "Self-hosted node-based UI for Stable Diffusion image generation."
category: "AI/ML"
url: https://railway.com/deploy/comfy-ui
---

# Deploy ComfyUI

Self-hosted node-based UI for Stable Diffusion image generation.

**[Deploy ComfyUI on Railway](https://railway.com/template/comfy-ui)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/comfy-ui/manifest.json

- **Creator:** Tasha
- **Category:** AI/ML
- **Total deploys:** 5

## Template content

### comfyui-railway

- **Source:** Amritasha/comfyui-railway
- **Public domain:** Yes

## Documentation

# Deploy and Host ComfyUI on Railway

ComfyUI is a node-based interface for Stable Diffusion and other diffusion models. Instead of a single prompt box, you wire up a graph — loaders, samplers, conditioning, upscalers, ControlNet — and every step is inspectable and reusable. It's the tool people move to when a simple text-to-image UI stops being enough, and this template runs it with a persistent volume for your models.

## Read This First: No GPU

Railway does not offer GPUs, so this deployment runs **CPU-only**. A single 512×512 SDXL image that takes seconds on a consumer GPU can take several minutes here, and large batches or video workflows are not practical.

That makes this template a good fit for building and sharing workflow graphs, testing custom nodes, running small or heavily quantised models, and giving a team a persistent ComfyUI instance they can reach from a browser — and a poor fit for production image generation at volume. If you need speed, point a GPU host at the same workflows and use this as the place you design them.

## About Hosting ComfyUI

The hard part of hosting ComfyUI is not the app, it's the weights. Checkpoints run from two to seven gigabytes each, LoRAs and VAEs add more, and none of it belongs in a container image — baking models into the image means a multi-gigabyte rebuild every time you add one.

This template mounts a volume at `/root/ComfyUI/models`, so checkpoints, LoRAs, VAEs, embeddings and ControlNet weights persist across redeploys. Download a model once and it stays. `HF_TOKEN` is passed through for gated Hugging Face repositories, such as the licence-gated Stable Diffusion releases, and `CLI_ARGS` lets you pass ComfyUI's own flags — `--cpu` and memory-management options are the useful ones here.

## Common Use Cases

- Design and debug node graphs that you'll later run on GPU hardware.
- Give a team one shared ComfyUI instance with a common model library, reachable from any browser.
- Test a custom node or an extension without installing anything locally.
- Run small, quantised or CPU-friendly models where minutes-per-image is acceptable.
- Keep a reference workflow permanently available instead of rebuilding it each time.

## Dependencies for ComfyUI Hosting

- **A volume at `/root/ComfyUI/models`** — provisioned by this template. Size it for the weights you intend to keep; checkpoints are measured in gigabytes.
- **Model weights.** None are bundled. Download them into the volume after first boot.
- **A Hugging Face token (`HF_TOKEN`)** — only if you pull from gated repositories.
- **Patience, or a GPU elsewhere.** See the note above.

### Implementation Details

`CLI_ARGS` is passed straight to ComfyUI at startup, so CPU mode and VRAM or RAM management flags are set there rather than baked into the image.

Custom nodes install into ComfyUI's own directory, which is outside the mounted volume, so anything you add through the Manager is lost on redeploy. If you depend on a custom node, add it to the repository this template builds from so it is installed at build time.

## After You Deploy

1. Open the public URL — ComfyUI loads with its default workflow.
2. Download a checkpoint into `models/checkpoints`, either from the Manager or with `wget` against a direct URL.
3. Expect the first generation to be slow. Start with a small resolution and few steps to confirm the pipeline works before queueing anything large.

## Scaling and Cost

CPU inference is bound by cores and memory, so a larger instance genuinely helps — but it will not approach GPU speed. The volume is the other cost to watch: it grows quickly once you keep more than a couple of checkpoints, and you pay for the space whether the service is running or not.

## Why Deploy ComfyUI 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 ComfyUI 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 v0.1 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/comfy-ui
