Deploy LobeChat | Open Source ChatGPT Alternative for Any Model Provider
Multi-provider AI chat with a pgvector knowledge base
Just deployed
minio/mc:latest
Just deployed
pgvector
Just deployed
/var/lib/postgresql/data
MinIO
Just deployed
/data
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 the database edition, not the single-container demo. Conversations, users and knowledge-base embeddings live in PostgreSQL with the pgvector extension; uploaded files and generated images go to S3-compatible object storage, with a one-shot initializer that creates the bucket on first boot. Both data stores are on persistent volumes.
Because it is the database edition, it requires authentication — the template is wired for GitHub OAuth, and that is the one thing you have to fill in yourself.
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 — pgvector does the retrieval, so nothing is sent to a third-party RAG service.
Dependencies for LobeChat Hosting
Deployment Dependencies
- LobeChat database edition — the application
- pgvector on PostgreSQL 16 — conversations and embeddings
- S3-compatible object storage on a volume — uploads and generated images
- A GitHub OAuth app for sign-in, plus API keys for whichever model providers you use
Implementation Details
AUTH_GITHUB_ID and AUTH_GITHUB_SECRET are the two variables you must fill. Create an OAuth app on GitHub with the callback URL https:///api/auth/callback/github and paste the pair in. The database edition will not sign anyone in without them.
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.
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.
A short-lived initializer container runs once to create the bucket and set its policy, then exits. Seeing it stopped after the first deploy is expected, not a failure.
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.
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 and object storage land around 700 MB–1 GB together, on the order of $12–20 a month. Storage grows with uploads; the database grows with conversation history and embeddings.
Template Content
AUTH_GITHUB_ID
Auth Github ID. See https://lobehub.com/docs/self-hosting/advanced/auth/next-auth/github
AUTH_GITHUB_SECRET
Auth Github Secret. See https://lobehub.com/docs/self-hosting/advanced/auth/next-auth/github
minio/mc:latest
minio/mc:latestpgvector
pgvector/pgvector:pg16MinIO
minio/minio:latest
