Railway

Deploy LibreChat

Multi-provider AI chat with agents, files, search, and RAG.

Deploy LibreChat

Just deployed

/app/uploads

Just deployed

/meili_data

Just deployed

/data/db

Just deployed

/var/lib/postgresql/data

Deploy and Host LibreChat on Railway

LibreChat is an open-source, multi-user AI chat interface that brings multiple model providers into one customizable application. It supports agents, files, conversation search, retrieval-augmented generation (RAG), model switching, presets, and secure authentication while letting operators retain control of application data and provider credentials.

About Hosting LibreChat

Hosting LibreChat requires five coordinated services: the LibreChat web application, MongoDB for users and conversations, Meilisearch for full-text conversation search, PostgreSQL with pgvector for embeddings, and the LibreChat RAG API for file indexing and retrieval. This template pins the Umbrel-tested LibreChat 0.8.7 service graph. Only LibreChat receives a public Railway domain; every dependency remains on Railway's private network. Persistent volumes protect uploaded files, MongoDB records, Meilisearch indexes, and vector data. Railway generates internal database, search, encryption, and signing credentials, while AI-provider keys remain optional external inputs with no defaults.

Common Use Cases

  • Give teams one self-hosted interface for OpenAI, Anthropic, Google, and other AI providers
  • Build agents that work with uploaded documents through retrieval-augmented generation
  • Keep authenticated conversation history, presets, files, and full-text search under operator control

Dependencies for LibreChat Hosting

  • MongoDB 8.0.10 for accounts, conversations, agents, and application metadata
  • Meilisearch 1.12.3 for private full-text conversation and message indexes
  • PostgreSQL 15 with pgvector 0.5.1 for RAG embeddings and metadata
  • LibreChat RAG API 0.7.3 for document extraction, embedding, indexing, and retrieval

Deployment Dependencies

Implementation Details

ServiceImageNetworkingPersistent volume
LibreChatghcr.io/danny-avila/librechat:v0.8.7Public port 3080; private dependencies/app/uploads
MongoDBmongo:8.0.10Private port 27017 only/data/db
Meilisearchgetmeili/meilisearch:v1.12.3Private port 7700 only/meili_data
VectorDBankane/pgvector:v0.5.1Private port 5432 only/var/lib/postgresql/data
RAG APIghcr.io/danny-avila/librechat-rag-api-dev-lite:v0.7.3Private port 8000 onlyNone; vectors persist in VectorDB

LibreChat 0.8.7 treats librechat.yaml as optional: when it is absent, the application logs that custom configuration was not loaded and continues with validated defaults. The official image already contains the built client and starts with npm run backend, so this template uses the pinned image directly rather than fabricating a repository build. The first registered account becomes the administrator. Add at least one supported AI-provider key after deployment to chat; an OpenAI-compatible embeddings key is needed only when using RAG with the default embedding provider.

The LibreChat volume is mounted at /app/uploads. Railway starts the container as root only long enough to assign that root-owned mount to UID/GID 1000, then su launches the documented npm run backend process as the image's node user. Application logs stay in Railway's log stream. MongoDB authentication, Meilisearch authentication, RAG JWT verification, PostgreSQL authentication, credential encryption, and session signing all use independently generated deployment secrets; shared values are generated once and consumed through Railway references.

Railway checks LibreChat's /readyz endpoint, Meilisearch's /health endpoint, and the RAG API's /health endpoint. LibreChat initializes MongoDB collections and indexes through Mongoose and starts Meilisearch synchronization in the background. RAG API 0.7.3 initializes pgvector's LangChain tables and idempotently creates its custom_id, file_id, and JSONB GIN indexes during startup.

Why Deploy LibreChat 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 LibreChat 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

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
56