explaingit

huggingface/chat-ui

10,708TypeScriptAudience · developerComplexity · 3/5Setup · moderate

TLDR

The open-source web app behind HuggingChat, run your own AI chat interface that connects to any OpenAI-compatible model endpoint, including local models via Ollama or llama.cpp.

Mindmap

mindmap
  root((repo))
    What it does
      Self-hosted chat UI
      Conversation history
      Model-agnostic frontend
    Tech Stack
      SvelteKit frontend
      MongoDB storage
      Docker image
    Model Support
      OpenAI compatible APIs
      Local models Ollama
      Third-party services
    Setup
      Two env variables
      Auto embedded database
      npm dev server
    Deployment
      Docker single command
      Managed MongoDB option
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Self-host a full chat interface for any AI model using just two environment variables to point at your chosen API endpoint

USE CASE 2

Run a local AI chat app in Docker with a single command, the image includes an embedded database so nothing else is needed

USE CASE 3

Build a customized internal chat tool for your company by cloning this codebase and swapping in your own model endpoint

Tech stack

TypeScriptSvelteKitMongoDBNode.jsDocker

Getting it running

Difficulty · moderate Time to first run · 30min

Needs an OpenAI-compatible API endpoint and key, MongoDB is optional for local dev as an embedded database starts automatically.

In plain English

Chat UI is the open-source code behind HuggingChat, Hugging Face's publicly available chat assistant website. If you want to run your own chat interface for AI models, this is the codebase you would use. It is a web application built with SvelteKit, a framework for building websites, and it stores conversation history and user data in a MongoDB database. The application connects to AI models through any API that follows the OpenAI protocol. That is a widely adopted standard, so it works with Hugging Face's own model hosting, with locally-run models through tools like Ollama or llama.cpp, and with third-party services like OpenRouter. You configure which endpoint to use by setting two environment variables: the API address and an access key. No code changes are needed to swap between providers. Setting it up locally takes a few minutes. You clone the repository, create a small configuration file with your API credentials, install dependencies with npm, and run the development server. For the database, if you do not supply a MongoDB connection string, the app starts an embedded database automatically so you can get going without extra setup. For more permanent deployments, you can point it at a managed MongoDB service or run MongoDB in a Docker container. A Docker image is also available that bundles everything together, including the database, so you can launch the whole stack with a single command and a couple of environment variables. The README notes that the current version removed older provider-specific integrations in favor of the unified OpenAI-compatible approach. A legacy branch preserves the previous version for anyone who relied on the older configuration style.

Copy-paste prompts

Prompt 1
I want to self-host a chat UI using the huggingface/chat-ui repo. Walk me through cloning the repo, setting the API endpoint and key in the config file, and starting the dev server locally.
Prompt 2
Using chat-ui with Ollama running locally, what environment variables do I set so the chat app uses my local llama3 model instead of a remote API?
Prompt 3
Show me the Docker command to spin up the full chat-ui stack (app + embedded database) using the published Docker image, with the required environment variables for a custom OpenAI-compatible endpoint.
Prompt 4
I cloned chat-ui and want to add a new system prompt option to the UI. Which SvelteKit file should I edit and what does the config format look like?
Prompt 5
What is the minimum MongoDB setup needed to run chat-ui in development, can I skip MongoDB entirely, and if so, how?
Open on GitHub → Explain another repo

← huggingface on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.