---
title: "Deploy LobeChat | Open Source ChatGPT Alternative for Any Model Provider"
description: "Multi-provider AI chat with built-in accounts and a document knowledge base"
category: "AI/ML"
url: https://railway.com/deploy/XJrbIL
---

# Deploy LobeChat | Open Source ChatGPT Alternative for Any Model Provider

Multi-provider AI chat with built-in accounts and a document knowledge base

**[Deploy LobeChat | Open Source ChatGPT Alternative for Any Model Provider on Railway](https://railway.com/template/XJrbIL)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/XJrbIL/manifest.json

- **Creator:** katsuba.dev
- **Category:** AI/ML
- **Total deploys:** 89

## Template content

### lobe https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/lobe-chat.svg

- **Image:** lobehub/lobehub:2.2.16
- **Start command:** `/bin/sh -c 'for i in $(seq 1 90); do nc -z "$DB_WAIT_HOST" "$DB_WAIT_PORT" && break; echo "waiting for postgres ($i/90)"; sleep 2; done; exec /bin/node /app/startServer.js'`
- **Public domain:** Yes

### Bucket Init https://res.cloudinary.com/h5kvzw/image/upload/v1706062979/MINIO_Bird_vbtpet.png

- **Image:** minio/mc:RELEASE.2025-08-13T08-35-41Z
- **Start command:** `/bin/sh -c "for i in $(seq 1 30); do /usr/bin/mc alias set minio ${MINIO_ENDPOINT} ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD} && break; echo waiting-for-minio $i; sleep 3; done; /usr/bin/mc mb --ignore-existing minio/${MINIO_BUCKET} && /usr/bin/mc anonymous set download minio/${MINIO_BUCKET}/public && echo BUCKET_INIT_OK; exec sleep infinity"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** paradedb/paradedb:0.25.6-pg17
- **Start command:** `/bin/sh -c "unset PGPORT; exec docker-entrypoint.sh postgres --port=5432 -c shared_preload_libraries=pg_search"`

### MinIO https://res.cloudinary.com/h5kvzw/image/upload/v1706062979/MINIO_Bird_vbtpet.png

- **Image:** minio/minio:RELEASE.2025-09-07T16-13-09Z
- **Start command:** `/bin/sh -c "exec minio server --address [::]:$MINIO_PRIVATE_PORT $RAILWAY_VOLUME_MOUNT_PATH"`
- **Health check:** /minio/health/ready
- **Public domain:** Yes

### Redis https://devicons.railway.app/i/redis.svg

- **Image:** redis:8.10.1-alpine
- **Start command:** `sh -c 'exec redis-server --requirepass "$REDIS_PASSWORD" --appendonly yes --dir /data --bind 0.0.0.0 ::'`

## Documentation

# Deploy and Host LobeChat on Railway

LobeChat is a polished chat interface for language models: OpenAI, Anthropic, Google, Groq, Ollama and dozens more behind one UI, with conversation branching, a plugin system, vision and file uploads, and a knowledge base backed by vector search.

## About Hosting LobeChat

This is LobeChat v2, the server edition rather than the single-container demo. Conversations, users and knowledge-base embeddings live in PostgreSQL — ParadeDB, which carries both `pg_search` for full-text ranking and `pgvector` for embeddings. Uploaded files and generated images go to S3-compatible object storage, with an initializer that creates the bucket and its policy. Redis backs caching and background messaging. Postgres, object storage and Redis each sit on a persistent volume.

Sign-in is built in: v2 uses Better-Auth with email and password, so the first person to register creates their account and starts using it. There is nothing to fill in before deploying — no OAuth app, no identity provider, no required fields on the deploy screen. Optional SSO providers (Google, GitHub, Authelia, Keycloak, Logto, Okta, Zitadel and others) can be added afterwards with `AUTH_SSO_PROVIDERS`.

## Common Use Cases

- **One interface for every model**: Compare answers across providers in the same conversation instead of keeping four browser tabs open.
- **A shared assistant for a team**: Accounts, separate conversation histories and shared plugin configuration, on infrastructure you own.
- **Chat with your documents**: Upload files into the knowledge base and query them — retrieval runs in your own database, so nothing is sent to a third-party RAG service.

## Dependencies for LobeChat Hosting

### Deployment Dependencies

- [LobeChat v2 server edition](https://lobehub.com/docs/self-hosting) — the application
- [ParadeDB on PostgreSQL 17](https://github.com/paradedb/paradedb) — conversations, search and embeddings
- S3-compatible object storage on a volume — uploads and generated images
- Redis — caching and background messaging
- API keys for whichever model providers you use

### Implementation Details

**Nothing is required from you at deploy time.** `AUTH_SECRET` and `KEY_VAULTS_SECRET` are generated, the database and object storage wire themselves together, and the first account is created by registering in the UI.

`KEY_VAULTS_SECRET` encrypts the per-user provider API keys stored in the database. Rotating it makes every stored key unreadable, so keep it with your backups. `AUTH_SECRET` signs sessions — changing it signs everyone out.

The database is ParadeDB rather than plain pgvector because v2's migrations create the `pg_search` extension, which plain pgvector cannot provide. It boots with `shared_preload_libraries=pg_search`, which that extension requires. Migrations run on every start and exit rather than retry if the database is not up yet, so the application waits for Postgres to accept connections before starting.

Object storage is exposed on its own public domain and referenced through `S3_PUBLIC_DOMAIN`, because the browser fetches uploaded images and files directly. `S3_ENABLE_PATH_STYLE=1` is required for MinIO-compatible endpoints, which do not use virtual-host bucket addressing, and `S3_SET_ACL=0` because MinIO rejects the canned-ACL header — the bucket policy grants public reads on the `public/` prefix instead, while the rest of the bucket stays private.

Postgres runs with an explicit `--port=5432` after unsetting `PGPORT`, which avoids the image reading Railway's injected variable and binding somewhere the application is not looking.

If you are upgrading from a LobeChat 1.x deployment, note that v2 removed NextAuth and Clerk: any variable beginning with `NEXT_AUTH`, `NEXTAUTH` or `CLERK_` will stop the container on purpose, with a message pointing at the migration guide.

## Why Deploy LobeChat 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 LobeChat 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.

**Resources**: the Next.js app plus Postgres, Redis and object storage land around 1–1.5 GB together, on the order of $15–25 a month. Storage grows with uploads; the database grows with conversation history and embeddings.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/XJrbIL
