---
title: "Deploy Langfuse"
description: "A platform for LLM observability, tracing, evaluation, & prompt management."
category: "Observability"
url: https://railway.com/deploy/langfuse-railway-template
---

# Deploy Langfuse

A platform for LLM observability, tracing, evaluation, & prompt management.

**[Deploy Langfuse on Railway](https://railway.com/template/langfuse-railway-template)**

- **Creator:** INF Labs
- **Category:** Observability

## Template content

### Langfuse-Worker https://langfuse.com/brand-assets/icon/color/langfuse-icon.svg

- **Image:** langfuse/langfuse-worker

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

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

### 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"`

### Langfuse-Web https://langfuse.com/brand-assets/icon/color/langfuse-icon.svg

- **Image:** langfuse/langfuse
- **Public domain:** Yes

### ClickHouse https://devicons.railway.app/clickhouse

- **Image:** clickhouse/clickhouse-server

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Langfuse on Railway

Langfuse is an open-source LLM engineering platform for observability, tracing, evaluation, prompt management, and debugging AI applications. It helps teams understand how LLM-powered systems behave in production by collecting traces, generations, scores, latency, cost, and other operational data.

## About Hosting Langfuse

Hosting Langfuse on Railway gives you a complete self-hosted LLM observability stack with persistent infrastructure for application metadata, high-volume traces, background processing, caching, and object storage.

This template combines Langfuse Web and Worker with PostgreSQL, ClickHouse, Redis, and Railway Bucket storage.

The Langfuse Web service is publicly accessible, while internal infrastructure services communicate through Railway's private network.

## Common Use Cases

* LLM application tracing
* AI agent observability
* Prompt management
* LLM evaluation and scoring
* Token and cost monitoring
* Latency and performance analysis
* Debugging AI workflows
* Monitoring production LLM applications
* Dataset and experiment tracking
* Comparing model and prompt performance

## Dependencies for Langfuse Hosting

* Langfuse Web
* Langfuse Worker
* PostgreSQL
* ClickHouse
* Redis
* Railway Bucket for S3-compatible object storage
* Railway private networking

## Getting Started After Deployment

> ⚠️ **IMPORTANT — REQUIRED AFTER DEPLOYMENT**
>
> Before using Langfuse, you **must update the `NEXTAUTH_URL` variable on the Langfuse Web service**.
>
> The template uses a placeholder URL during the initial deployment so Langfuse can start successfully. After Railway generates the public domain for **Langfuse Web**, copy the complete public URL and set it directly as the value of `NEXTAUTH_URL`.
>
> For example:
>
> ```text
> NEXTAUTH_URL=https://your-langfuse-web.up.railway.app
> ```
>
> **Do not use a Railway variable reference such as `${{RAILWAY_PUBLIC_DOMAIN}}` for this setting. Enter the final public URL directly as a hardcoded value.**
>
> Leaving `NEXTAUTH_URL` set to the placeholder URL can cause incorrect authentication callbacks, OAuth/SSO redirects, and generated links. This value should match the exact public URL users use to access Langfuse.

### 1. Set the Langfuse Public URL

After deployment:

1. Open the **Langfuse Web** service in Railway.
2. Go to **Networking**.
3. Copy the generated public Railway URL.
4. Open **Variables**.
5. Find `NEXTAUTH_URL`.
6. Replace the placeholder with the complete public URL.
7. Save the variable and allow Railway to redeploy the service.

Example:

```text
https://langfuse-web-production.up.railway.app
```

Use the URL exactly as provided by Railway, including `https://`.

Do not configure:

```text
${{RAILWAY_PUBLIC_DOMAIN}}
```

or:

```text
https://${{RAILWAY_PUBLIC_DOMAIN}}
```

for `NEXTAUTH_URL`.

Set the actual URL directly.

### 2. Open Langfuse

After `NEXTAUTH_URL` has been updated and Langfuse Web has redeployed, open the same public Railway URL in your browser.

The Web service listens internally on:

```text
3000
```

You should be presented with the Langfuse interface where you can create or sign in to your account.

Only the Langfuse Web service needs a public domain.

The remaining infrastructure should stay private.

### 3. Create a Langfuse Project

After signing in:

1. Create a new Langfuse project.
2. Open the project's API Keys settings.
3. Generate or copy the project's public and secret keys.
4. Use those credentials from your application or AI workflow.

A typical Langfuse project provides credentials such as:

```text
LANGFUSE_PUBLIC_KEY
LANGFUSE_SECRET_KEY
LANGFUSE_HOST
```

For a Railway-hosted deployment, `LANGFUSE_HOST` should point to the public domain of your Langfuse Web service.

### 4. Connect Your Application

Langfuse can be integrated into applications using its SDKs and supported AI frameworks.

Conceptually:

```text
Your Application
       │
       │ traces / generations / scores
       ▼
 Langfuse Web/API
       │
       ├── PostgreSQL
       ├── ClickHouse
       ├── Redis
       ├── Railway Bucket
       │
       ▼
 Langfuse Worker
```

Your application sends observability events to Langfuse while the Worker processes background workloads and ClickHouse stores high-volume analytics data.

### 5. Send Your First Trace

Once your project credentials are configured in your application, Langfuse can begin recording:

* Traces
* LLM generations
* Agent steps
* Tool calls
* Scores
* Latency
* Token usage
* Model usage
* Cost data
* User and session metadata

These events become visible in the Langfuse dashboard.

### 6. Use Langfuse with LLM Applications

Langfuse can be used with applications built using:

* OpenAI
* Anthropic
* Google Gemini
* LangChain
* LlamaIndex
* OpenAI-compatible APIs
* AI agents
* Custom Python or JavaScript applications
* Workflow automation platforms
* Custom middleware and API gateways

Langfuse does not host the LLM itself.

Instead, it observes and evaluates the requests, responses, traces, and execution paths produced by your AI application.

## Template Architecture

This Railway template uses the following architecture:

```text
                         Internet
                            │
                            ▼
                    Langfuse Web :3000
                            │
          ┌─────────────────┼─────────────────┐
          │                 │                 │
          ▼                 ▼                 ▼
      PostgreSQL        ClickHouse          Redis
          ▲                 ▲                 ▲
          │                 │                 │
          └────────── Langfuse Worker ───────┘
                            │
                            ▼
                     Railway Bucket
                      ├── events/
                      └── media/
```

### Langfuse Web

Provides:

* Langfuse dashboard
* Authentication
* Project management
* API endpoints
* Trace exploration
* Prompt management
* Evaluation interfaces

This is the only service that should normally be publicly exposed.

### Langfuse Worker

Handles background workloads such as:

* Event processing
* Asynchronous ingestion
* Data processing
* Background jobs
* Object storage workflows

The Worker should remain private.

### PostgreSQL

Stores transactional and application metadata including:

* Users
* Organizations
* Projects
* Configuration
* Prompts
* Application state

### ClickHouse

Stores high-volume observability and analytics data including:

* Traces
* Observations
* Generations
* Scores
* Metrics

ClickHouse should remain private and use persistent storage.

### Redis

Provides internal queueing and caching for Langfuse.

Redis should only be accessible through Railway's private network.

### Railway Bucket

Provides S3-compatible object storage for Langfuse.

The template uses separate prefixes for different workloads:

```text
events/
media/
```

This avoids requiring an additional MinIO service.

## Public and Private Networking

| Service         | Public Access |   Private Network |
| --------------- | ------------: | ----------------: |
| Langfuse Web    |             ✅ |                 ✅ |
| Langfuse Worker |             ❌ |                 ✅ |
| PostgreSQL      |             ❌ |                 ✅ |
| ClickHouse      |             ❌ |                 ✅ |
| Redis           |             ❌ |                 ✅ |
| Railway Bucket  |   S3 endpoint | ✅ via credentials |

Keeping databases and internal services private reduces unnecessary external exposure.

## Persistent Storage

Persistent data is distributed across the infrastructure:

| Component       | Persistence              |
| --------------- | ------------------------ |
| PostgreSQL      | Database volume          |
| ClickHouse      | `/var/lib/clickhouse`    |
| Redis           | Persistent Redis storage |
| Railway Bucket  | Managed object storage   |
| Langfuse Web    | No local volume required |
| Langfuse Worker | No local volume required |

This allows Langfuse application containers to remain stateless while persistent data is handled by the appropriate backing services.

## Langfuse vs Other LLM Observability Platforms

| Feature                | Langfuse | Generic APM | Basic Logging | Managed LLM Observability |
| ---------------------- | -------: | ----------: | ------------: | ------------------------: |
| LLM tracing            |        ✅ |          ⚠️ |             ❌ |                         ✅ |
| Prompt management      |        ✅ |           ❌ |             ❌ |                         ✅ |
| Evaluation and scoring |        ✅ |           ❌ |             ❌ |                         ✅ |
| Token usage tracking   |        ✅ |          ⚠️ |            ⚠️ |                         ✅ |
| Cost monitoring        |        ✅ |          ⚠️ |             ❌ |                         ✅ |
| Agent and tool tracing |        ✅ |          ⚠️ |            ⚠️ |                         ✅ |
| Self-hosted            |        ✅ |     Depends |             ✅ |                   Often ❌ |
| Infrastructure control |        ✅ |     Depends |             ✅ |                   Limited |
| Open-source            |        ✅ |     Depends |       Depends |                   Depends |

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

- [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
- [Unwrapped Spotify Music Stats](https://railway.com/deploy/wide-bold) — Unwrapped Spotify Music Stats, Estatísticas de músicas disponíveis

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