---
title: "Deploy HuggingChat"
description: "Hugging Face's open-source chat app for any OpenAI-compatible model"
category: "AI/ML"
url: https://railway.com/deploy/huggingchat
---

# Deploy HuggingChat

Hugging Face's open-source chat app for any OpenAI-compatible model

**[Deploy HuggingChat on Railway](https://railway.com/template/huggingchat)**

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

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

## Template content

### HuggingChat https://raw.githubusercontent.com/huggingface/chat-ui/v0.10.0/static/huggingchat/icon-512x512.png

- **Source:** https://github.com/aalfath/huggingchat-railway-template
- **Health check:** /healthcheck
- **Public domain:** Yes

### MongoDB https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/mongodb.png

- **Image:** mongo:7.0.48@sha256:41e8195b2791692695e1dc9bd21cd51d0a3af05fff8ace9304a5c1acf94f1ae1
- **Start command:** `/bin/sh -c 'printf "%s" "$MONGO_REPLICA_KEY" > /tmp/rs.key; chmod 400 /tmp/rs.key; chown 999:999 /tmp/rs.key; (until mongosh --quiet -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --eval "try { rs.status().ok } catch (e) { rs.initiate({ _id: \"rs0\", members: [{ _id: 0, host: \"localhost:27017\" }] }).ok }" 2>/dev/null | grep -qx 1; do sleep 3; done; echo "replica set rs0 ready") & exec docker-entrypoint.sh mongod --replSet rs0 --keyFile /tmp/rs.key --ipv6 --bind_ip_all --wiredTigerCacheSizeGB 0.25'`

## Documentation

# Deploy and Host HuggingChat on Railway

HuggingChat is Hugging Face's open-source chat app (the `huggingface/chat-ui` project behind huggingface.co/chat). It gives you a ChatGPT-style web interface for any OpenAI-compatible API, with conversation history, model switching, file and image uploads, sharing, reasoning display and MCP tool calling.

## About Hosting HuggingChat

This template runs two services. **HuggingChat** builds from a small public wrapper repo around the official `chat-ui` image, pinned by digest, and puts a Caddy login prompt in front, because chat-ui has no user accounts unless you set up OpenID. **MongoDB 7** stores conversations, settings and uploaded files on a Railway volume and runs as a single-node replica set, which chat-ui's migrations need. The password, database credentials and replica key are generated at deploy. You only enter one value: the API key for your model provider. The Hugging Face Inference router is the default endpoint, and any other OpenAI-compatible URL works.

## Common Use Cases

* A private, password-protected chat UI for yourself or a small team, on your own API key
* One interface for many open models through the Hugging Face router, OpenRouter, Groq or Together
* A front end for your own vLLM, TGI, LM Studio or Ollama server that speaks the OpenAI API

## Dependencies for HuggingChat Hosting

* An API key for an OpenAI-compatible endpoint (a Hugging Face token `hf_...` for the default router)
* MongoDB, included in this template on its own volume

### Deployment Dependencies

* chat-ui source and releases: https://github.com/huggingface/chat-ui (latest release v0.10.0)
* chat-ui configuration reference: https://huggingface.co/docs/chat-ui
* Template wrapper repo: https://github.com/aalfath/huggingchat-railway-template
* Hugging Face access tokens: https://huggingface.co/settings/tokens

### Implementation Details

| Service | What it does |
|---|---|
| HuggingChat | chat-ui (official image built from upstream `main` at 152ee7d, one CSS commit before the v0.10.0 tag, whose release image was never published) behind a Caddy login prompt. Public domain, health check `/healthcheck`. |
| MongoDB | `mongo:7.0.48`, volume at `/data/db`, private network only, generated password. |

**After deploy:** open the HuggingChat URL and sign in as `admin` with the `BASIC_AUTH_PASSWORD` shown in the HuggingChat service's Variables tab. Your signed-in name keeps your conversations together across browsers. Pick a model from the list (discovered from `OPENAI_BASE_URL/models`) and start chatting. To change provider, edit `OPENAI_BASE_URL` and `OPENAI_API_KEY` and redeploy. Further chat-ui settings from its `.env` (for example `MODELS`, `TASK_MODEL`, `PUBLIC_APP_NAME`, `OPENID_*`, `MCP_SERVERS`) can be added as variables on the HuggingChat service.

**Memory:** each service runs within 0.5 GB RAM and 1 vCPU (tested at those limits; Node's heap and MongoDB's cache are capped). If a process stops, the container exits with an error so Railway restarts it.

**Updates:** the HuggingChat service builds from the wrapper repo, so Railway shows you an update notice when a new version lands on its `main` branch, and you choose when to apply it. Read `CHANGELOG.md` in the repo first. MongoDB is not updated automatically.

## Why Deploy HuggingChat 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 HuggingChat 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/huggingchat
