---
title: "Deploy LightRAG"
description: "Graph-based RAG server with web UI, login and API key on by default"
category: "AI/ML"
url: https://railway.com/deploy/lightrag-2
---

# Deploy LightRAG

Graph-based RAG server with web UI, login and API key on by default

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

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

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### LightRAG https://raw.githubusercontent.com/SylphAI-Inc/LightRAG/main/docs/source/_static/images/LightRAG-logo-doc.jpeg

- **Image:** ghcr.io/hkuds/lightrag:v1.5.7@sha256:5bdbd524931b011df246fe20888d110cef691e6804c12cde636a2b746d7de27e
- **Start command:** `sh -c 'export HOST=0.0.0.0 WORKING_DIR=/data/rag_storage INPUT_DIR=/data/inputs PROMPT_DIR=/data/prompts WHITELIST_PATHS="${WHITELIST_PATHS:-/health}" LLM_BINDING="${LLM_BINDING:-openai}" LLM_BINDING_HOST="${LLM_BINDING_HOST:-https://api.openai.com/v1}" LLM_MODEL="${LLM_MODEL:-gpt-5.4-mini}" EMBEDDING_BINDING="${EMBEDDING_BINDING:-openai}" EMBEDDING_BINDING_HOST="${EMBEDDING_BINDING_HOST:-https://api.openai.com/v1}" EMBEDDING_MODEL="${EMBEDDING_MODEL:-text-embedding-3-large}" EMBEDDING_DIM="${EMBEDDING_DIM:-3072}" EMBEDDING_BINDING_API_KEY="${EMBEDDING_BINDING_API_KEY:-$LLM_BINDING_API_KEY}"; if [ -z "$AUTH_ACCOUNTS" ] && [ -n "$ADMIN_PASSWORD" ]; then export AUTH_ACCOUNTS="${ADMIN_USERNAME:-admin}:$ADMIN_PASSWORD"; fi; if [ -z "$AUTH_ACCOUNTS" ] && [ -z "$LIGHTRAG_API_KEY" ]; then echo "Refusing to start without authentication: set ADMIN_PASSWORD (with TOKEN_SECRET) or LIGHTRAG_API_KEY" >&2; exit 1; fi; exec docker-entrypoint.sh python -m lightrag.api.lightrag_server'`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host LightRAG on Railway

LightRAG is an open-source retrieval-augmented generation (RAG) server from HKU Data Intelligence Lab. It extracts entities and relationships from your documents into a knowledge graph, stores text chunks as vectors, and answers questions using both. It ships with a REST API, an Ollama-compatible chat API and a web UI.

## About Hosting LightRAG

Hosting LightRAG means running its Python API server, keeping its storage on disk, and pointing it at an LLM and an embedding model. This template runs the official LightRAG image pinned to v1.5.7 as one service, with a Railway volume at `/data` for the knowledge graph, vector index, document status and uploaded files. Authentication is on from the first start: the web UI asks for a login, the API needs an API key, and the Ollama-compatible routes are no longer left open. Railway generates the admin password, API key and JWT secret. You only add your LLM provider's API key. The default is OpenAI, and any OpenAI-compatible endpoint or Ollama works too.

## Common Use Cases

* Question answering over internal documents, notes or manuals, with answers grounded in a knowledge graph
* A private RAG backend for chat apps or agents through the REST API or the Ollama-compatible `/api/chat` endpoint
* Exploring how entities and relationships connect across a document collection in the graph viewer

## Dependencies for LightRAG Hosting

* LightRAG Server v1.5.7 (official `ghcr.io/hkuds/lightrag` image, pinned by digest)
* A Railway volume mounted at `/data`
* An API key for an LLM and embedding provider (OpenAI by default), or your own OpenAI-compatible or Ollama endpoint

### Deployment Dependencies

* [LightRAG source code](https://github.com/HKUDS/LightRAG) and [v1.5.7 release notes](https://github.com/HKUDS/LightRAG/releases/tag/v1.5.7)
* [LightRAG Server documentation](https://github.com/HKUDS/LightRAG/blob/v1.5.7/docs/LightRAG-API-Server.md) and [all configuration options (`env.example`)](https://github.com/HKUDS/LightRAG/blob/v1.5.7/env.example)

### Implementation Details

* **Sign in:** open your Railway domain and sign in as `admin` (or the `ADMIN_USERNAME` you set) with the password in the `ADMIN_PASSWORD` variable.
* **API access:** send the `LIGHTRAG_API_KEY` value in an `X-API-Key` header, for example `curl -H "X-API-Key: YOUR_API_KEY" https://YOUR-APP.up.railway.app/documents/pipeline_status`. The interactive API docs are at `/docs`.
* **LLM provider:** set `LLM_BINDING_API_KEY` before you upload documents. The defaults are OpenAI `gpt-5.4-mini` and `text-embedding-3-large` (3072 dimensions). To use another provider, change `LLM_BINDING`, `LLM_MODEL`, `LLM_BINDING_HOST` and the matching `EMBEDDING_*` variables. The embedding model and dimension are fixed once documents are indexed, so choose them before your first upload.
* **Ollama-compatible routes:** `/api/*` requires the API key in this template (`WHITELIST_PATHS=/health`). Set `WHITELIST_PATHS=/health,/api/*` only if you want them public.
* **Storage:** the graph (NetworkX), vectors (NanoVectorDB), key-value data and uploads are files under `/data`, which suits small and medium collections. For large collections, LightRAG also supports PostgreSQL with pgvector, Neo4j, Milvus, Qdrant and others through the `LIGHTRAG_*_STORAGE` variables.

## Why Deploy LightRAG 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 LightRAG 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.




## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

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