Deploy HuggingChat
Hugging Face's open-source chat app for any OpenAI-compatible model
HuggingChat
Just deployed
MongoDB
Just deployed
/data/db
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.
Template Content
HuggingChat
aalfath/huggingchat-railway-templateOPENAI_API_KEY
Required: API key for the endpoint below (a Hugging Face token hf_... for the default router, or your OpenAI/OpenRouter key).
MongoDB
mongo:7.0.48
