Deploy Langfuse
A platform for LLM observability, tracing, evaluation, & prompt management.
Langfuse-Worker
Just deployed
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/data
Langfuse-Web
Just deployed
ClickHouse
Just deployed
/var/lib/clickhouse
Bucket
Bucket
Just deployed
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_URLvariable 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:
NEXTAUTH_URL=https://your-langfuse-web.up.railway.appDo 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_URLset 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:
- Open the Langfuse Web service in Railway.
- Go to Networking.
- Copy the generated public Railway URL.
- Open Variables.
- Find
NEXTAUTH_URL. - Replace the placeholder with the complete public URL.
- Save the variable and allow Railway to redeploy the service.
Example:
https://langfuse-web-production.up.railway.app
Use the URL exactly as provided by Railway, including https://.
Do not configure:
${{RAILWAY_PUBLIC_DOMAIN}}
or:
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:
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:
- Create a new Langfuse project.
- Open the project's API Keys settings.
- Generate or copy the project's public and secret keys.
- Use those credentials from your application or AI workflow.
A typical Langfuse project provides credentials such as:
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:
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:
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:
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.
Template Content
Langfuse-Worker
langfuse/langfuse-workerRedis
redis:8.2Langfuse-Web
langfuse/langfuseClickHouse
clickhouse/clickhouse-serverBucket
Bucket
