Deployment guide

How to Host Lobe Chat on a VPS

Deploy on a VPS Cloud →

Artificial Intelligence7 min read

How to Host Lobe Chat on a VPS

Lobe Chat is an open source AI conversation interface with a polished design, capable of connecting OpenAI, Claude, Ollama and many other providers behind a single window. Self-hosting it on a VPS gives you full control over API keys, histories and costs. Here is how to put it into production cleanly.

Why self-host Lobe Chat on a VPS

Lobe Chat aggregates several LLM providers (OpenAI, Anthropic, Google, Mistral, local Ollama) in a single UI with a plugin marketplace, custom agents and voice recognition/synthesis. In SaaS, your histories and your keys pass through a third party; by hosting it on your own VPS, conversations stay in your PostgreSQL database and your API keys never leave your server. A VPS also offers a fixed IP useful for whitelisting your outbound calls to paid APIs, and the freedom to enable database mode (multi-user with authentication) rather than simple browser storage.

Concrete benefits of self-hosting

  • Centralization of all your LLM API keys on the server side, never exposed to the browser
  • Conversation histories persisted in your own PostgreSQL, backable up and encryptable
  • Multi-user mode via authentication (Logto, Auth0, Clerk) for a whole team
  • Connection to a local Ollama on the same VPS for 100% private responses with no API cost
  • Marketplace of plugins and custom agents with no quota or limit imposed by a SaaS
  • Full cost control: you only pay for the actual consumption of the APIs you connect

Hardware and software requirements

Lobe Chat is a relatively lightweight Node.js application. In browser storage mode, 1 vCPU and 1 GB of RAM are enough. For database mode (recommended in production) with embedded PostgreSQL, plan for 2 vCPU and 2 to 4 GB of RAM, plus 10 GB of disk for images, attachments and the database. On the software side: Docker and the Docker Compose plugin, a domain name pointing to the VPS IP (A record), and at least one API key from an LLM provider. If you enable S3 mode for files, plan for a compatible bucket (MinIO can run on the same VPS).

Deployment of Lobe Chat with Docker

01

Prepare the VPS and Docker

Connect over SSH, update the system then install Docker via curl -fsSL https://get.docker.com | sh. Verify the installation with docker compose version. Create a working folder: mkdir -p /opt/lobe-chat && cd /opt/lobe-chat.

02

Write the compose file in database mode

Create a docker-compose.yml with the lobe-chat-database service, a postgres service (image pgvector/pgvector:pg16) and minio for S3 storage. Fill in the variables DATABASE_URL, KEY_VAULTS_SECRET (generated with openssl rand -base64 32) and NEXT_AUTH_SECRET.

03

Inject the keys and the auth provider

Add your keys in a .env file: OPENAI_API_KEY, ANTHROPIC_API_KEY, etc. Configure NEXT_AUTH_SSO_PROVIDERS and the Logto or Clerk credentials to enable multi-user authentication before public exposure.

04

Launch the stack

Start everything with docker compose up -d. Follow the logs with docker compose logs -f lobe-chat-database until you see the server listening on port 3210.

05

Set up the reverse proxy and SSL

Place Caddy or Nginx in front of the container. With Caddy, a three-line Caddyfile (chat.yourdomain.com { reverse_proxy localhost:3210 }) automatically generates the Let's Encrypt certificate and forces HTTPS.

06

Verify and secure

Open https://chat.yourdomain.com, create the first administrator account, then close port 3210 at the firewall (ufw deny 3210) to let only traffic through the reverse proxy pass.

For totally private conversations with no API cost, install Ollama on the same VPS and set OLLAMA_PROXY_URL=http://host.docker.internal:11434/v1 in Lobe Chat. You get a local assistant (Llama 3, Qwen, Mistral) that depends on no external provider. Remember to increase the VPS RAM according to the size of the loaded model.

Launch Lobe Chat in a few minutes

The ServOrbit Cloud VPS provides preinstalled Docker, a fixed IP and the SSD storage needed to run Lobe Chat in database mode without tedious system configuration.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.