File size: 1,575 Bytes
700a224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Running Locally

## Quick Start

1. Create a `.env.local` file with your API credentials:

```ini
OPENAI_BASE_URL=https://router.huggingface.co/v1
OPENAI_API_KEY=hf_************************
```

2. Install and run:

```bash
npm install
npm run dev -- --open
```

That's it! Chat UI will discover available models automatically from your endpoint.

## Configuration

Chat UI connects to any OpenAI-compatible API. Set `OPENAI_BASE_URL` to your provider:

| Provider | `OPENAI_BASE_URL` |
|----------|-------------------|
| Hugging Face | `https://router.huggingface.co/v1` |
| Ollama | `http://127.0.0.1:11434/v1` |
| llama.cpp | `http://127.0.0.1:8080/v1` |
| OpenRouter | `https://openrouter.ai/api/v1` |

See the [configuration overview](../configuration/overview) for all available options.

## Database

For **development**, MongoDB is optional. When `MONGODB_URL` is not set, Chat UI uses an embedded MongoDB server that persists data to the `./db` folder.

For **production**, you should use a dedicated MongoDB instance:

### Option 1: Local MongoDB (Docker)

```bash
docker run -d -p 27017:27017 -v mongo-chat-ui:/data --name mongo-chat-ui mongo:latest
```

Then set `MONGODB_URL=mongodb://localhost:27017` in `.env.local`.

### Option 2: MongoDB Atlas (Managed)

Use [MongoDB Atlas free tier](https://www.mongodb.com/pricing) for a managed database. Copy the connection string to `MONGODB_URL`.

## Running in Production

For production deployments:

```bash
npm install
npm run build
npm run preview
```

The server listens on `http://localhost:4173` by default.