Railway

Deploy LibreChat | ChatGPT Alternative, Files + Search That Persist

Self-hosted ChatGPT alternative: file RAG with no API key, uploads persist

Deploy LibreChat | ChatGPT Alternative, Files + Search That Persist

Just deployed

/var/lib/postgresql

Just deployed

/data/db

Just deployed

/app/uploads

Just deployed

/meili_data

Deploy and Host LibreChat on Railway

LibreChat is the open-source, self-hosted ChatGPT alternative: one interface across OpenAI, Anthropic, Google, DeepSeek, xAI, Groq, Mistral, OpenRouter and any OpenAI-compatible endpoint, with multi-user accounts, conversation search, agents, and chat-with-your-files. This template deploys the pinned v0.8.7 release with MongoDB, Meilisearch, pgvector and a RAG API — five services wired over the private network, with file search working on first boot and no API key of any kind required to deploy.

About Hosting LibreChat

LibreChat is not a single container. Conversations, users, presets and agent definitions live in MongoDB. Message search is served by Meilisearch, which maintains its own index. Chatting with an uploaded document needs a RAG API and a pgvector database to hold the embeddings. Uploaded files and images produced by tools and agents are written to the application's own filesystem, in two different directories.

Three details decide whether a LibreChat deployment on Railway actually works, and none of them are visible on a deploy form:

Every service has to be bound and wired for the private network. Meilisearch binds loopback unless MEILI_HTTP_ADDR says otherwise, which is a common cause of a deployment that starts fine and never returns a search result. Here Mongo and Meilisearch listen on both address families, the RAG API runs on a dual-stack socket, and the app's connection strings are generated from the private domains — so nothing depends on which address family gets resolved.

The application service needs a volume too, not just the datastores. LibreChat writes user uploads to /app/uploads and tool- or agent-generated images to /app/client/public/images. Without a volume both are lost on every redeploy, while MongoDB keeps the message rows that point at them. This template mounts a volume at /app/uploads and links the images directory into it, so both survive.

Embeddings normally cost an extra API key. The RAG API image published for lightweight deployments has no local embedding support, so file search stays dark until you supply an OpenAI key. This template runs sentence-transformers/all-MiniLM-L6-v2 on CPU, baked into the image at build time, so document chat works out of the box, offline, with no third-party key and no per-boot model download. Moving to a hosted embeddings provider later is a two-variable change.

Every image is pinned to an exact release rather than a rolling latest or -dev tag, so two people deploying this a month apart get the same application. MongoDB and Meilisearch run authenticated, and neither datastore, nor pgvector, nor the RAG API is given a public domain — only the chat UI is reachable from the internet.

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.

  • Chat with your files on first boot — RAG API and pgvector included, embeddings run locally on CPU, no OpenAI key needed to make it work.
  • Nothing to fill in — the deploy form is empty. Every secret is generated per deploy at the exact length LibreChat requires, and every service-to-service URL is wired for you.
  • Uploads and generated images persist — a volume on the app service, not only on the databases.
  • Correct private networking — Mongo, Meilisearch and the RAG API all listen on both address families, and none of them is exposed to the internet.
  • Pinned, reproducible versions — LibreChat v0.8.7, MongoDB 8.3, Meilisearch v1.51, pgvector 0.8.6/pg17. No rolling dev tags.
  • Bring your own model keys — each user pastes their own provider key into the UI, encrypted before it reaches the database, and pays API rates instead of a per-seat subscription.

Common Use Cases

  • Team ChatGPT replacement — one self-hosted interface with accounts, shared presets and history, at API prices instead of per-seat pricing.
  • Private document chat — upload contracts, papers or manuals and query them, with the embeddings computed inside your own deployment.
  • Multi-provider comparison — run the same prompt against OpenAI, Anthropic, Google, DeepSeek and OpenRouter models side by side in one conversation view.

Dependencies for LibreChat Hosting

Everything LibreChat needs is included in this template — there is nothing to provision separately:

  • MongoDB 8.3, authenticated, on a volume at /data/db.
  • Meilisearch v1.51 for conversation search, behind a generated master key, on a volume at /meili_data.
  • pgvector 0.8.6 (pg17) for document embeddings, on a volume at /var/lib/postgresql.
  • A RAG API service with local CPU embeddings.

A model provider API key (OpenAI, Anthropic, Google, or any OpenAI-compatible endpoint) is added per user from the UI after deploy. It is not required to deploy, and it is not required for file search.

Deployment Dependencies

Implementation Details

ServiceImageVolumePublic
librechatghcr.io/bon5co/librechat-railway:latest (LibreChat v0.8.7)/app/uploadsyes
ragghcr.io/bon5co/librechat-rag-railway:latestno
mongomongo:8.3.7-noble/data/dbno
meilisearchgetmeili/meilisearch:v1.51.0/meili_datano
pgvectorpgvector/pgvector:0.8.6-pg17/var/lib/postgresqlno

After deploy, open the public domain and register the first account. Registration is open so that first account can be created — set ALLOW_REGISTRATION=false on the librechat service afterwards if the instance should not accept public signups.

Then add a model provider key from the UI. Keys are encrypted with the per-deploy CREDS_KEY/CREDS_IV before they are stored, so do not rotate those two after users have saved keys.

Confirm the stack is healthy:

curl https:///health     # OK

Conversation search indexes in the background, so new conversations become searchable shortly after they are created. Document chat works immediately: upload a file in a conversation, or attach one to an agent, and the embeddings are computed by the rag service.


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