
Deploy LobeChat [Jul'26]
Self-hosted AI chat with memory and plugins
lobe-chat-railway-template
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host LobeChat on Railway
LobeChat is an open-source, self-hosted AI chat application that you can deploy on Railway in minutes. It supports multiple LLM providers — OpenAI, Anthropic Claude, Google Gemini, Groq, and Ollama — behind a single interface, with persistent conversation history, file uploads, voice input, plugins, and a multi-assistant UI. Self-hosting LobeChat gives you a private ChatGPT alternative with full data ownership and no per-seat subscription.
About Hosting LobeChat
Hosting LobeChat requires running its Next.js application server alongside a PostgreSQL database. Postgres stores conversation history, user sessions, assistants, and plugin state, which is what enables persistent memory across sessions. Without a database, LobeChat runs in stateless mode and loses all chat history on restart.
The app reads its database connection string, auth secrets, and AI provider API keys from environment variables at startup. Railway provisions the Postgres instance, injects the connection variables, and networks both services automatically, so there is no manual configuration, Docker Compose file, or reverse proxy to maintain.
Common Use Cases
- Private ChatGPT alternative — run a self-hosted AI chat app with OpenAI, Claude, Gemini, and Ollama models available in one interface
- Shared team AI assistant hub — give an organisation per-user conversation history, custom assistants, and shared prompts without paying per-seat SaaS pricing
- Personal AI workspace — combine file analysis, web search plugins, and voice input in a workspace you fully control
Dependencies for LobeChat Hosting
- PostgreSQL — primary data store for conversation history, users, assistants, and plugin state
- AI provider API key — at least one of OpenAI, Anthropic, Google Gemini, or Groq, or a reachable self-hosted Ollama instance
Deployment Dependencies
- LobeChat documentation
- LobeChat GitHub repository
- LobeChat environment variables reference
- Railway PostgreSQL documentation
Frequently Asked Questions
Do I need a database to self-host LobeChat?
Only if you want conversations to persist. LobeChat runs without Postgres in stateless mode, but chat history, assistants, and plugin state are lost on every restart. The Railway template provisions Postgres for you.
Which AI providers does LobeChat support?
OpenAI, Anthropic Claude, Google Gemini, Groq, Ollama, and other OpenAI-compatible endpoints. You can enable several at once and switch models per conversation.
Can I connect LobeChat to a local Ollama instance?
Yes, but the Railway deployment must be able to reach it over the network. A local machine behind NAT needs a tunnel or public endpoint; otherwise host Ollama somewhere publicly reachable.
How do I add users or restrict access?
LobeChat supports access-code protection for single-user setups and OIDC/NextAuth providers for multi-user deployments. Both are configured through environment variables.
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.
Template Content
lobe-chat-railway-template
Amritasha/lobe-chat-railway-templateAUTH_SECRET
KEY_VAULTS_SECRET
