---
title: "Deploy Langfuse: Self-Hosted LLM Tracing, Evals & Prompts"
description: "Trace, evaluate and debug LLM apps and agents on your own Langfuse."
category: "Observability"
url: https://railway.com/deploy/langfuse-llm-tracing
---

# Deploy Langfuse: Self-Hosted LLM Tracing, Evals & Prompts

Trace, evaluate and debug LLM apps and agents on your own Langfuse.

**[Deploy Langfuse: Self-Hosted LLM Tracing, Evals & Prompts on Railway](https://railway.com/template/langfuse-llm-tracing)**

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

- **Creator:** blueorange
- **Category:** Observability

## Template content

### langfuse-web https://cdn.jsdelivr.net/gh/selfhst/icons/svg/langfuse.svg

- **Image:** langfuse/langfuse
- **Health check:** /api/public/health
- **Public domain:** Yes

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

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

### langfuse-worker https://cdn.jsdelivr.net/gh/selfhst/icons/svg/langfuse.svg

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

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

- **Image:** redis:8.2.1
- **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"`

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

- **Image:** clickhouse/clickhouse-server
- **Start command:** `/entrypoint.sh -- --logger.console=1 --logger.level=information`
- **Health check:** /ping

## Buckets

- **langfuse**

## Documentation

# Deploy and Host Langfuse on Railway

![Langfuse logo](https://cdn.jsdelivr.net/gh/selfhst/icons/svg/langfuse.svg)

Langfuse is an open source **LLM engineering platform** for tracing, evaluating and improving AI applications and agents. Every model call, tool call and retrieval step your app makes becomes a trace you can inspect, with inputs, outputs, latency, token counts and cost. On top of that, Langfuse adds prompt management with versioning, datasets and experiments, LLM-as-a-judge and human evaluations, a playground, and dashboards for quality and spend. It has about 37,400 GitHub stars, its core is MIT-licensed, and it ingests data from its Python and JavaScript SDKs, OpenTelemetry and integrations for LangChain, LlamaIndex, the OpenAI SDK, the Vercel AI SDK and LiteLLM. This template deploys the full production architecture on Railway: the web app, the async worker, PostgreSQL, ClickHouse, Redis and an object storage bucket, all wired together. Langfuse Cloud's paid plans start at $29/month with usage limits; self-hosting has no event caps and keeps every prompt and response on your own infrastructure.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **langfuse-web** | `langfuse/langfuse` on port `3000` with a public domain. UI, public API and ingestion endpoints. |
| **langfuse-worker** | `langfuse/langfuse-worker`. Processes ingestion queues, evaluations and batch exports in the background. |
| **Postgres** | PostgreSQL 18. Users, projects, API keys, prompts and settings. |
| **clickhouse** | ClickHouse with a volume. Traces, observations and scores for fast analytics. |
| **Redis** | Redis 8.2 with a password and a volume. Queues and cache between web and worker. |
| **langfuse bucket** | Railway object storage. Raw ingestion events, multi-modal media and batch exports. |

`SALT`, `ENCRYPTION_KEY` and `NEXTAUTH_SECRET` are generated at deploy time; the worker references the web service's values so both stay in sync.

---

## About Hosting Langfuse

LLM apps fail in quiet ways: a prompt change drops answer quality, an agent loops through tools, a retrieval step returns nothing, or costs creep up. Langfuse makes those visible. Once your app sends traces, you can open any request, see each step, compare prompt versions and score outputs.

**Why so many services.** Langfuse v3 and later split work across stores built for each job. Postgres holds transactional data, ClickHouse handles high-volume analytics over traces, Redis queues ingestion, and the bucket keeps raw events so nothing is lost under load. The worker drains the queues so the web app stays responsive.

**Data stays with you.** Prompts, completions and user inputs often contain sensitive data. Self-hosting keeps every trace in your Postgres, ClickHouse and bucket, which helps with privacy reviews and data residency.

**First sign-up becomes the owner.** Sign-up is open on a fresh deploy. Create your account and organisation first, then set `AUTH_DISABLE_SIGNUP=true` and redeploy so only invited people can join.

**Size ClickHouse for your volume.** ClickHouse is the hungriest service. Small projects run comfortably on modest resources; for millions of observations a day, give ClickHouse more RAM and watch disk usage on its volume.

**Telemetry.** Anonymous usage stats are on by default. Set `TELEMETRY_ENABLED=false` on both Langfuse services to turn them off.

Typical cost: **~$25–50/month** on Railway for the six pieces at small scale, rising with trace volume. Langfuse Cloud is free up to 50,000 units a month, then $29/month for Core and $199/month for Pro.

---

## Deploy Langfuse in Under 10 Minutes

1. Click **Deploy on Railway**. All services start; the web app runs Postgres and ClickHouse migrations on first boot.
2. Open the **langfuse-web** domain and sign up. Create an organisation and a project.
3. Set `AUTH_DISABLE_SIGNUP=true` on langfuse-web and redeploy.
4. In the project settings, create an API key pair.
5. Set `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY` and `LANGFUSE_HOST` (your domain) in your app, add the Langfuse SDK or OpenTelemetry exporter, and send a test request.

The trace appears in the Tracing view within seconds, with each step, its latency and its cost.

---

## Common Use Cases

- **Debug agents.** See every tool call, retrieval and model step of a multi-step agent run.
- **Track cost and latency.** Break down spend and response time by model, user, feature or release.
- **Prompt management.** Version prompts, deploy them by label and roll back without a code change.
- **Evaluations.** Score outputs with LLM-as-a-judge, user feedback or human annotation queues.
- **Regression testing.** Run datasets against new prompts or models and compare results side by side.
- **RAG quality.** Inspect retrieved chunks and find questions where retrieval failed.
- **Support bots.** Review conversations users flagged and turn them into test cases.
- **Compliance.** Keep a full, private record of model inputs and outputs.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `NEXTAUTH_SECRET` | 🔐 Auto-generated | Signs session cookies. Keep it stable. |
| `SALT` | 🔐 Auto-generated | Hashes API keys. The worker references it. |
| `ENCRYPTION_KEY` | 🔐 Auto-generated | 64-hex key that encrypts stored LLM credentials. Shared with the worker. |
| `NEXTAUTH_URL` | ✅ Auto-set | `https://` plus the web domain. |
| `DATABASE_URL` | ✅ Auto-injected | Postgres connection string. |
| `CLICKHOUSE_URL`, `CLICKHOUSE_MIGRATION_URL` | ✅ Auto-set | Private ClickHouse HTTP and native endpoints. |
| `CLICKHOUSE_USER`, `CLICKHOUSE_PASSWORD` | ✅ Auto-injected | ClickHouse credentials. |
| `REDIS_CONNECTION_STRING` | ✅ Auto-injected | Redis for queues and cache. |
| `LANGFUSE_S3_*` | ✅ Auto-injected | Bucket settings for events, media and exports. |
| `AUTH_DISABLE_SIGNUP` | ✅ Set | `false`. Set `true` after creating your account. |
| `TELEMETRY_ENABLED` | ✅ Set | `true`. Set `false` to opt out. |
| `NODE_OPTIONS` | ✅ Set | 3 GB Node heap for web and worker. |

**LLM features.** For the playground and LLM-as-a-judge evaluations, add model provider keys in the project's LLM connection settings; they're encrypted with `ENCRYPTION_KEY`.

---

## Langfuse vs. Alternatives

| | Langfuse on Railway | Langfuse Cloud | LangSmith | Helicone |
|---|---|---|---|---|
| **Monthly cost** | ~$25–50 usage | Free tier, then $29+ | Per seat and traces | Free tier, then paid |
| **Self-hosted** | ✅ Yes | ❌ No | ⚠️ Enterprise only | ✅ Yes |
| **Usage caps** | ✅ None | ⚠️ Units per plan | ⚠️ Traces per plan | ⚠️ Per plan |
| **Prompt management** | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| **Evals and datasets** | ✅ Yes | ✅ Yes | ✅ Yes | ⚠️ Limited |
| **OpenTelemetry ingestion** | ✅ Yes | ✅ Yes | ✅ Yes | ⚠️ Partial |
| **License** | ✅ MIT core | ⚠️ Hosted service | ❌ Proprietary | ✅ Apache-2.0 |

---

## Dependencies for Langfuse Hosting

- Railway account. Pro is recommended for six services and ClickHouse memory.
- An app instrumented with a Langfuse SDK, OpenTelemetry or a supported integration.
- Optional: model provider keys for the playground and LLM-as-a-judge evals.

### Deployment Dependencies

- [Langfuse on GitHub](https://github.com/langfuse/langfuse): source code and releases
- [Langfuse docs](https://langfuse.com/docs): SDKs, integrations and self-hosting
- [Langfuse self-hosting guide](https://langfuse.com/self-hosting): architecture and scaling
- [Railway Private Networking](https://docs.railway.com/guides/private-networking): how services connect

### Implementation Details

The Langfuse and ClickHouse images use their default `latest` tags, so a redeploy can pull a new release; the current Langfuse release is v4.79.0. Langfuse runs migrations on start, but back up Postgres and ClickHouse before upgrading in production, or pin version tags for controlled updates. Only langfuse-web has a public domain; everything else talks over Railway's private network. Health checks hit `/api/public/health` on the web app and `/api/health` on the worker before traffic switches over.

---

## Frequently Asked Questions

**What is Langfuse?**
An open source LLM engineering platform for tracing, evaluations, prompt management, datasets and cost tracking of AI apps and agents.

**How much does self-hosting cost?**
About $25–50/month on Railway at small scale, with no per-event fees. Langfuse Cloud is free to 50,000 units, then $29/month for Core.

**How do I connect my app?**
Create an API key pair in your project, then set `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY` and `LANGFUSE_HOST` in your app and use the SDK or OpenTelemetry.

**Why does it need ClickHouse and Redis?**
ClickHouse stores and queries large volumes of traces quickly, and Redis queues ingestion so the web app never blocks on writes.

**How do I stop strangers from signing up?**
After you create your account, set `AUTH_DISABLE_SIGNUP=true` on langfuse-web and redeploy.

**Is Langfuse open source?**
Yes. The core is MIT-licensed. A few enterprise features, such as SSO enforcement and audit logs, need a commercial licence.

---

## Why Deploy and Host Langfuse 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 Langfuse on Railway, you get private, uncapped LLM tracing, evals and prompt management for your team, on infrastructure you control.


## Similar templates

- [Rootprint](https://railway.com/deploy/rootprint-1) — Open-source logs and traces with full-text search on object-storage.
- [Pyroscope profiling](https://railway.com/deploy/pyroscope-profiling) — Protected continuous profiling with durable Pyroscope storage.
- [SigOnly](https://railway.com/deploy/sigonly) — Deploy SigNoz with a working demo app & config in one click

Open this page in a browser: https://railway.com/deploy/langfuse-llm-tracing
