---
title: "Deploy LibreChat"
description: "LibreChat on a pinned release: admin set at deploy, file search, Mongo"
category: "AI/ML"
url: https://railway.com/deploy/librechat-2
---

# Deploy LibreChat

LibreChat on a pinned release: admin set at deploy, file search, Mongo

**[Deploy LibreChat on Railway](https://railway.com/template/librechat-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/librechat-2/manifest.json

- **Creator:** Dektion Studio
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### VectorDB https://devicons.railway.com/i/postgresql.svg

- **Image:** pgvector/pgvector:pg17

### rag-api https://raw.githubusercontent.com/LibreChat-AI/LibreChat/9e74cc0e57b395926122bd4062c1fcedc48ed465/client/public/assets/icon-192x192.png

- **Image:** ghcr.io/danny-avila/librechat-rag-api-dev-lite:latest
- **Start command:** `/bin/sh -c 'export RAG_OPENAI_API_KEY="${RAG_OPENAI_API_KEY:-not-set}"; exec python main.py'`

### MongoDB https://devicons.railway.com/i/mongodb.svg

- **Image:** mongo:8.0
- **Start command:** `docker-entrypoint.sh mongod --ipv6 --bind_ip_all`

### LibreChat https://raw.githubusercontent.com/LibreChat-AI/LibreChat/9e74cc0e57b395926122bd4062c1fcedc48ed465/client/public/assets/icon-192x192.png

- **Source:** dektionstudio/railway-template-images
- **Health check:** /health
- **Public domain:** Yes

### Meilisearch https://raw.githubusercontent.com/meilisearch/meilisearch/909ef7fef5ba264dc914c4778d6328c5edca5ca7/assets/logo.svg

- **Image:** getmeili/meilisearch:v1.35.1

## Documentation

# Deploy and Host LibreChat on Railway

[LibreChat](https://github.com/LibreChat-AI/LibreChat) (MIT) is a self-hosted chat interface for OpenAI, Anthropic, Google, OpenRouter and other providers, with agents, file search, conversation search and accounts for several people.

This template runs a pinned LibreChat release (v0.8.7) with MongoDB, Meilisearch for searching conversations, and LibreChat's RAG API on pgvector for chatting with uploaded files.

## About Hosting LibreChat

LibreChat gives the admin role to the first account that registers, so on a public URL whoever gets there first owns the instance. This template keeps registration closed from the start and creates the admin account itself: the deploy form asks for your email, a password is generated into `ADMIN_PASSWORD`, and a start step runs LibreChat's own `create-user` script with both. When the deploy finishes, open `LIBRECHAT_URL` and sign in with that email and `ADMIN_PASSWORD`.

`OPENROUTER_KEY` is optional. If you set it on the LibreChat service, everyone on the instance can chat with OpenRouter models, and the RAG API uses the same key for the embeddings behind file search. If you leave it empty, each user adds their own OpenRouter, OpenAI, Anthropic or Google key in the interface. When you add the key after deploying, redeploy the rag-api service too: in my test Railway redeployed LibreChat but left rag-api on the old value until I redeployed it.

Before publishing I tested it end to end. Registering a new account returned "Registration is not allowed", and the admin signed in with the admin role. With an OpenRouter key set, a message to `openai/gpt-4o-mini` came back with the expected answer and LibreChat titled the conversation. A text file I uploaded was embedded by the RAG API. After a restart the admin signed in again and the conversations were still there.

## Common Use Cases

- One chat interface for a small team, with each person's provider keys stored encrypted
- Upload documents to a conversation and ask questions about them

## Dependencies for LibreChat Hosting

An API key for at least one model provider: set `OPENROUTER_KEY` for everyone, or let each user add their own in the interface. File search needs an embeddings key, which `OPENROUTER_KEY` covers.

### Deployment Dependencies

- LibreChat: https://github.com/LibreChat-AI/LibreChat
- Docs: https://www.librechat.ai/docs
- Image: `ghcr.io/danny-avila/librechat:v0.8.7`
- The wrapper this template builds: https://github.com/dektionstudio/railway-template-images/tree/main/librechat

### Implementation Details

```
ADMIN_EMAIL / ADMIN_PASSWORD      # admin account, created on first start
ALLOW_REGISTRATION=false          # open it while your team signs up, then close it again
OPENROUTER_KEY                    # optional: chat for everyone + file search embeddings
CREDS_KEY / CREDS_IV              # encrypt the provider keys users save (generated, keep them)
MONGO_URI                         # MongoDB with a password, private network only
RAG_API_URL                       # rag-api service, private network only
```

Five services: LibreChat, MongoDB, Meilisearch, VectorDB (pgvector) and rag-api. Uploads, generated images and logs go on a volume on the LibreChat service. Meilisearch has no volume on purpose: some Railway plans allow three volumes per project (my first version used four and wasn't allowed to deploy), and LibreChat rebuilds the search index from MongoDB when it starts.

To move to a newer release, set `LIBRECHAT_VERSION` (an image tag such as `v0.8.8`) on the LibreChat service. The official Railway template runs the nightly `librechat-dev:latest` image instead; a pinned tag only changes when you change it. The RAG API image is only published as `librechat-rag-api-dev-lite:latest`.

Idle, LibreChat used 0.60 GB of RAM, MongoDB 0.33 GB, rag-api 0.19 GB, Meilisearch 0.16 GB and VectorDB 0.09 GB.

## Why Deploy LibreChat on Railway?

The instance is yours from the first minute, with no open sign-up for someone else to claim, and every database stays on Railway's private network. Idle RAM for the five services comes to about $14 a month; model usage is billed by your providers.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/librechat-2
