LibreChat Private AI Chat (MongoDB + Meilisearch)
LibreChat v0.8.8 is an open-source AI chat platform with one interface for OpenAI, Anthropic, Google, OpenRouter and other providers, plus agents, file chat and multi-user accounts. This template deploys it with MongoDB, Meilisearch and a RAG API on Postgres with pgvector.
What you get
- LibreChat v0.8.8 with a volume at /data for uploads and avatars
- MongoDB 8.0 for users, conversations, agents and settings
- Meilisearch for conversation search
- RAG API (lite) with Postgres 18 and pgvector for file chat
- Generated secrets and an admin account created on first start; public sign-up is off
Good for
- A private ChatGPT-style workspace for a team
- One interface for several model providers with per-user keys
- Agents with tools and MCP servers shared inside a team
- Chat with PDFs and other documents through the RAG API
Cost
Measured on Railway: idle RAM was about 350 MiB for LibreChat, 270 to 515 MiB for MongoDB depending on its limit, and under 200 MiB each for Meilisearch, the RAG API and Postgres, roughly 1.3 GB in total.
Services in this template
- MongoDB · image
mongo:8.0.38-noble@sha256:76a93cc399d05709baeea4e55385749657aa0085ad5b497c851380778eccea2c - LibreChat · from
baranberkay96/librechat-railway - rag-api · image
ghcr.io/danny-avila/librechat-rag-api-dev-lite:v0.9.0@sha256:18a8dffa9316276b924bf3fd23bfb4544b0f68f8f6b14c048affb35c01721a35 - Postgres · image
ghcr.io/railwayapp-templates/postgres-ssl:18.6@sha256:4fc833b43d2aaf6ecc9b18615f5533602b723a32d0e2efe2dae8ca0f7217c863 - Meilisearch · image
getmeili/meilisearch:v1.56.2@sha256:9600db22be3fcbf3d506176d3a73dd70a65c5719d9aa1d2837355b75afb8f4fb
Questions people ask
How do I log in?
Sign in with LIBRECHAT_ADMIN_EMAIL (default admin@example.com) and the generated LIBRECHAT_ADMIN_PASSWORD, both on the LibreChat service's Variables tab. The account has the ADMIN role.
Do I need model API keys?
Not to deploy. By default each user enters their own key in the chat interface. You can replace the defaults with real keys to share them, in which case usage is billed to you.
Why does file upload fail?
File search needs an OpenAI key on the server for embeddings: set RAG_OPENAI_API_KEY on rag-api, or a real OPENAI_API_KEY on LibreChat. Until then chat works but file search returns an error. Other embedding providers are set with EMBEDDINGS_PROVIDER.
How do I add team members?
Set ALLOW_REGISTRATION to true, let people register, then set it back to false. While sign-up is open anyone with the URL can create an account.
How do I upgrade?
The LibreChat version is the FROM line in services/librechat/Dockerfile; other images are pinned in service settings. Read the changelog first, and never change CREDS_KEY or CREDS_IV after first start or stored user keys cannot be decrypted.
Full template README
Deploy and Host LibreChat with Railway
LibreChat is an open-source AI chat platform with one interface for OpenAI, Anthropic, Google, OpenRouter and many other model providers, plus agents, file chat (RAG), conversation search and multi-user accounts. This community template runs LibreChat v0.8.8 with MongoDB, Meilisearch and a RAG API on Postgres with pgvector.
About Hosting LibreChat
LibreChat is a Node.js application. It keeps users, conversations, agents and settings in MongoDB, indexes messages in Meilisearch for full-text search, and sends uploaded documents to its RAG API, which stores embeddings in Postgres with pgvector. This template pins every image to a version and digest, generates all secrets, and creates the administrator account on first start, so the instance is never open for a stranger to claim. Uploads and avatars live on a Railway volume. No model keys are needed to deploy: by default every user adds their own API key in the chat interface, and you can switch to shared keys at any time.
Common Use Cases
- A private ChatGPT-style workspace for a team, with conversations kept in your own database.
- One interface for several providers (OpenAI, Claude, Gemini, OpenRouter models) with per-user keys.
- Agents with tools and MCP servers, shared inside the team.
- Chat with PDFs and other documents through the built-in RAG API.
- A controlled AI entry point for a company, with accounts managed by an administrator.
Dependencies for LibreChat Hosting
- LibreChat (
ghcr.io/librechat-ai/librechat:v0.8.8) - MongoDB 8.0
- Meilisearch 1.56
- LibreChat RAG API (lite) v0.9.0 with Postgres 18 + pgvector
- Model provider API keys (OpenAI, Anthropic, Google, OpenRouter, ...), added by users or by you
Deployment Dependencies
- LibreChat documentation: https://www.librechat.ai/docs
- Environment variables: https://www.librechat.ai/docs/configuration/dotenv
- librechat.yaml reference: https://www.librechat.ai/docs/configuration/librechat_yaml
- RAG API: https://www.librechat.ai/docs/configuration/rag_api
- LibreChat source: https://github.com/LibreChat-AI/LibreChat
- Meilisearch: https://www.meilisearch.com/docs
Implementation Details
| Service | Image | Role | Idle RAM (measured) |
|---|---|---|---|
LibreChat |
librechat:v0.8.8 + Railway launcher |
Web app and API, volume /data |
~0.35 GB |
MongoDB |
mongo:8.0.38 |
Users, chats, agents, settings | ~0.5 GB (0.27 GB under a 0.5 GB limit) |
Meilisearch |
meilisearch:v1.56.2 |
Conversation search | ~0.1–0.19 GB |
rag-api |
librechat-rag-api-dev-lite:v0.9.0 |
Document parsing and embeddings | ~0.2 GB |
Postgres |
postgres-ssl:18.6 (pgvector) |
Vector store for the RAG API | ~0.1 GB |
First login. Open the LibreChat domain and sign in with LIBRECHAT_ADMIN_EMAIL (default admin@example.com) and the generated LIBRECHAT_ADMIN_PASSWORD, both on the LibreChat service's Variables tab. The account has the ADMIN role. To use another email, change LIBRECHAT_ADMIN_EMAIL before deploying or later (a redeploy creates the new admin). Changing LIBRECHAT_ADMIN_PASSWORD and redeploying resets the admin password.
Accounts. Public sign-up is off (ALLOW_REGISTRATION=false). To onboard a team, set it to true, let people register, then set it back to false. While sign-up is open, anyone who finds the URL can create an account, so do not leave it open together with shared API keys.
Model keys. OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_KEY and OPENROUTER_KEY default to user_provided: each user enters their own key from the model menu, and LibreChat stores it encrypted with CREDS_KEY. Replace a value with a real key to share it with all users (their usage is then billed to you).
File chat (RAG). Embeddings need an OpenAI key on the server: set RAG_OPENAI_API_KEY on rag-api, or put a real OPENAI_API_KEY on LibreChat (the RAG API uses it). Until then, chat works but uploading a file for file search returns an error. Other embedding providers (Azure, Ollama, Hugging Face TEI, Bedrock) are set with EMBEDDINGS_PROVIDER and their variables.
Configuration. A small librechat.yaml is built in (OpenRouter endpoint, welcome text). To use your own, set CONFIG_PATH on LibreChat to a raw file URL and redeploy.
Plans. Five services, about 1.3 GB RAM in total when idle (MongoDB uses less when its limit is lower). LibreChat and MongoDB were tested with a 0.5 GB limit, as on Railway's Free plan, and stay under it at idle; the other three services idle below 0.2 GB. Trial allows 1 GB per service. For busy teams or large uploads, Hobby or Pro is recommended.
Scaling. LibreChat keeps uploads on its volume, so run one replica and give it more memory and CPU as usage grows. MongoDB, Meilisearch and the RAG API scale vertically.
Pinning and upgrades. The LibreChat version is the FROM line in services/librechat/Dockerfile of the template repository; the other images are pinned in the service settings. Read the LibreChat changelog before upgrading. Never change CREDS_KEY or CREDS_IV after first start, or stored user keys can no longer be decrypted.
Why Deploy LibreChat on Railway?
Railway runs LibreChat, its databases, search and RAG services together on a private network with HTTPS, volumes and usage-based pricing. You get a private, multi-provider AI chat for your team in one deploy, keep conversations in your own infrastructure, and can grow each service independently.
Guides for this template
View LibreChat Private AI Chat (MongoDB + Meilisearch) on railway.com
Similar templates
| Template | Category | DeploymentsDeploys |
|---|---|---|
| 9Router Self-hosted AI router for Claude, Gemini, Cursor & OpenAI tools. | AI/ML | 9,734 |
| flowise-railway Flowise - low-code LLM apps builder | AI/ML | 8,512 |
| LibreChat Open-source ChatGPT clone: multi-model, agents, search, multi-user auth | AI/ML | 6,762 |
| Hermes Agent by Nous Research Template for Hermes Agent by Nous Research | AI/ML | 6,413 |
| OpenClaw [Homebrew support] The AI that actually does things | AI/ML | 5,167 |
| Hermes Agent Self Host Hermes Agent. Autonomous AI agent w/ self-improving, tools & more | AI/ML | 4,092 |