---
title: "Deploy Langfuse LLM Observability Stack"
description: "Trace, evaluate and cost-track every LLM call. Langfuse v4 with ClickHouse."
category: "AI/ML"
url: https://railway.com/deploy/langfuse-v4-llm-observability-stack
---

# Deploy Langfuse LLM Observability Stack

Trace, evaluate and cost-track every LLM call. Langfuse v4 with ClickHouse.

**[Deploy Langfuse LLM Observability Stack on Railway](https://railway.com/template/langfuse-v4-llm-observability-stack)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/langfuse-v4-llm-observability-stack/manifest.json

- **Creator:** Tracklayer
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### langfuse-worker https://langfuse.com/icon.svg

- **Image:** langfuse/langfuse-worker:4.56.0
- **Health check:** /api/health

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### ClickHouse https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/clickhouse.svg

- **Source:** baranberkay96/langfuse-railway
- **Health check:** /ping

### langfuse-web https://langfuse.com/icon.svg

- **Source:** baranberkay96/langfuse-railway
- **Health check:** /api/public/ready
- **Public domain:** Yes

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Langfuse with Railway

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/langfuse-v4-llm-observability-stack?referralCode=20H68q)

Langfuse is an open-source LLM engineering platform for tracing, evaluating and cost-tracking LLM applications and agents. This community template deploys the complete Langfuse v4 stack on Railway: web app, background worker, ClickHouse, Postgres, Redis and a Railway Bucket, with the first organization, project, API keys and admin account created automatically.

## About Hosting Langfuse

Self-hosted Langfuse v4 is not a single container. The web service receives traces from the Langfuse SDKs, OpenTelemetry or integrations such as LiteLLM and stores each raw event in S3-compatible storage. A separate worker turns those events into rows in ClickHouse, the analytical database that powers the trace explorer, dashboards and full-text search. Postgres stores users, projects, prompts and API keys, and Redis carries the job queues and caches. This template wires all of it together over Railway's private network, generates every secret, keeps ClickHouse tuned for a small footprint and uses a Railway Bucket for event, media and export storage, so you get a production-shaped deployment without editing configuration files.

## Common Use Cases

- Trace every LLM call, tool call and agent step in production, with latency, token usage and cost per request.
- Version and deploy prompts from a central prompt registry, then compare prompt versions with datasets and experiments.
- Run LLM-as-a-judge and human annotation workflows to score answer quality over time.
- Keep LLM telemetry inside your own infrastructure for data-residency or compliance reasons.
- Act as the observability backend for an LLM gateway such as LiteLLM.

## Dependencies for Langfuse Hosting

- Langfuse web (`langfuse/langfuse`) and worker (`langfuse/langfuse-worker`) images, version 4.56.0
- ClickHouse 26.8 LTS (Langfuse v4 needs 25.12 or newer)
- PostgreSQL (Railway Postgres 18)
- Redis (Railway Redis 8.2)
- S3-compatible object storage (Railway Bucket)

### Deployment Dependencies

- Langfuse self-hosting guide: https://langfuse.com/self-hosting
- Configuration reference: https://langfuse.com/self-hosting/configuration
- Headless initialization: https://langfuse.com/self-hosting/administration/headless-initialization
- ClickHouse requirements: https://langfuse.com/self-hosting/deployment/infrastructure/clickhouse
- Blob storage (S3) settings: https://langfuse.com/self-hosting/deployment/infrastructure/blobstorage
- Upstream docker-compose: https://github.com/langfuse/langfuse/blob/main/docker-compose.yml
- Railway Buckets: https://docs.railway.com/storage-buckets

### Implementation Details

| Service | Role | Public | Storage |
|---|---|---|---|
| langfuse-web | UI, public API, OTLP endpoint, migrations (upstream image plus a start script that sizes the Node heap) | Yes (port 3000) | – |
| langfuse-worker | Queue processing, evaluations, exports | No | – |
| ClickHouse | Traces, observations, scores | No | Volume `/var/lib/clickhouse` |
| Postgres | Users, projects, prompts, keys | No | Volume |
| Redis | Queues and cache | No | Volume |
| Bucket | Raw events, media, batch exports | – | Railway Bucket |

**First login**

1. Enter your email in `LANGFUSE_INIT_USER_EMAIL` when deploying (the only required input).
2. Wait for `langfuse-web` to become healthy (first start runs database migrations and can take several minutes).
3. Open the web domain and sign in with that email and the generated `LANGFUSE_INIT_USER_PASSWORD` from the `langfuse-web` variables. Change the password in your profile.
4. Use `LANGFUSE_INIT_PROJECT_PUBLIC_KEY` and `LANGFUSE_INIT_PROJECT_SECRET_KEY` with `LANGFUSE_HOST=https://{your-web-domain}` in the Langfuse SDKs. Langfuse v4 accepts traces from v4 SDKs and OpenTelemetry (`/api/public/otel`); the legacy `/api/public/ingestion` endpoint only takes scores.

Public sign-up is disabled (`AUTH_DISABLE_SIGNUP=true`). To let invited teammates create accounts, set it to `false`, invite them, and switch it back once they have joined.

**Plans and memory:** use the Hobby or Pro plan. `langfuse-web` needs at least 1.5 GB of memory (its live heap is about 720 MB right after start), so Railway's Trial (1 GB per service) and Free (0.5 GB) plans cannot run it: web stops with "JavaScript heap out of memory" and the log says why. When a service is limited to 2 GB or less, a start script sets the Node heap to 75% of the limit, because Node's default is too small there; `LANGFUSE_NODE_HEAP_MB` overrides it.

**Scaling:** add replicas to `langfuse-worker` for higher ingestion throughput and to `langfuse-web` for more API/UI traffic; both are stateless. ClickHouse scales vertically (more RAM/CPU) on Railway.

**Pinning and upgrades:** web and worker are pinned to `4.56.0`; always upgrade both to the same version. Change the image tag in `services/langfuse-web/Dockerfile` (tag and digest) and on `langfuse-worker`, check the Langfuse changelog for breaking changes, and redeploy; migrations run automatically on web start. ClickHouse is pinned in `services/clickhouse/Dockerfile`.

### Why Deploy Langfuse on Railway?

Railway runs the five services and the bucket as one project with private networking, generated secrets, volumes and per-second usage billing, so you can operate a full Langfuse v4 stack without managing servers or Kubernetes. Scaling the worker or web service is a replica setting, and upgrades are an image tag change.


## 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/langfuse-v4-llm-observability-stack
