Deploy LobeChat | Open Source ChatGPT Alternative for Any Model Provider
Multi-provider AI chat with built-in accounts and a document knowledge base
Just deployed
Bucket Init
Just deployed
Postgres
Just deployed
/var/lib/postgresql/data
Just deployed
/data
Redis
Just deployed
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 — the application
- ParadeDB on PostgreSQL 17 — 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.
Template Content

