Getting Started

Installation

Install and run OpenChat locally, with Docker, or on Vercel.

Prerequisites

  • Node.js 18+ and npm
  • Optional: Docker 24+ and Docker Compose

Local (development)

1) Clone and install

Terminal
git clone https://github.com/openchatui/openchat.git
cd openchat
npm install

2) Configure environment

Create your environment file and set provider keys:

Terminal
cp .env.example .env

Minimal variables to start:

# App
AUTH_URL="http://localhost:3000"
AUTH_SECRET="$(openssl rand -base64 32)"
AUTH=true

# Database (SQLite by default)
DB=sqlite

# Providers (set what you need)
OPENAI_API_KEY=
OPENROUTER_API_KEY=
# Ollama: leave empty unless running locally
# OLLAMA_HOST=http://localhost:11434

# Optional: browser automation via Browserless
# BROWSERLESS_URL=https://www.browserless.io/
# or BROWSERLESS_TOKEN=xxx

3) Initialize database and run

Terminal
# Apply schema
npm run db:push

# Start dev
npm run dev

Local app: http://localhost:3000

Docker (single container)

Terminal
docker pull ghcr.io/openchatui/openchatui:latest

docker run --name openchat \
  -p 3000:3000 \
  -e PORT=3000 \
  -e AUTH_URL="http://localhost:3000" \
  -e AUTH_SECRET="$(openssl rand -base64 32)" \
  -v "$(pwd)/data:/app/data" \
  --restart unless-stopped \
  ghcr.io/openchatui/openchatui:latest

!TIP

  • Change the host port by editing the -p flag (e.g., -p 3001:3001 together with -e PORT=3001).
  • If you prefer PostgreSQL, add -e DB=postgres -e DATABASE_URL=postgresql://user:pass@host:5432/dbname.
  • Optional (persist SQLite outside the image): mount a host folder at /app/data and set SQLITE_URL=file:/app/data/openchat.db (DB defaults to sqlite in the image). Avoid mounting /prisma to prevent overriding bundled migrations.
  • The container will generate an AUTH_SECRET if not provided; set it for persistence across restarts.
Optional: Public landing (disable auth)

Set AUTH=false to allow unauthenticated users to access the public landing page while keeping the /admin area protected and requiring admin login.

Docker Compose

A ready-to-use docker-compose.yml is included. It maps port 3000 and persists SQLite data to ./data mounted at /app/data.

Minimal compose file:

services:
  openchat:
    image: ghcr.io/openchatui/openchatui:latest
    ports:
      - "3000:3000"
    environment:
      PORT: "3000"
      AUTH_URL: "http://localhost:3000"
      AUTH_SECRET: "<generate-a-secret>"
    volumes:
      - ./data:/app/data
    restart: unless-stopped

Deploy to Vercel

  1. Fork the repository on GitHub: https://github.com/openchatui/openchat
  2. Import the repo in Vercel and set environment variables:
    • AUTH_URL (Vercel URL), AUTH_SECRET
    • Provider keys (e.g., OPENAI_API_KEY, OPENROUTER_API_KEY)
    • Choose DB:
      • SQLite (default) for quick start
      • PostgreSQL with DB=postgres and DATABASE_URL (e.g., Neon or Vercel Postgres)
  3. Deploy. After build completes, visit your Vercel URL.

Environment variables

  • AUTH_URL / AUTH_SECRET: Auth base URL and secret.
  • AUTH (true|false): Disable to show a public landing page; admin stays protected.
  • DB (sqlite|postgres) and DATABASE_URL: Database selection and connection string.
  • OPENAI_API_KEY: Key for OpenAI.
  • OPENROUTER_API_KEY: Key for OpenRouter.
  • OLLAMA_HOST: Base URL for Ollama if running locally.
  • BROWSERLESS_URL or BROWSERLESS_TOKEN: Configure Browserless for headless browsing tools.

Notes

  • For production, use PostgreSQL and set a persistent AUTH_SECRET.
  • Mount /prisma volume in Docker to persist SQLite and migrations.
  • See the repository for more details: https://github.com/openchatui/openchat.