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

langfuse-web

langfuse/langfuse

Just deployed

/var/lib/postgresql/data

Just deployed

Just deployed

/data

Just deployed

/var/lib/clickhouse

langfuse

Bucket

Just deployed

Deploy and Host Langfuse on Railway

Langfuse logo

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

ServicePurpose
langfuse-weblangfuse/langfuse on port 3000 with a public domain. UI, public API and ingestion endpoints.
langfuse-workerlangfuse/langfuse-worker. Processes ingestion queues, evaluations and batch exports in the background.
PostgresPostgreSQL 18. Users, projects, API keys, prompts and settings.
clickhouseClickHouse with a volume. Traces, observations and scores for fast analytics.
RedisRedis 8.2 with a password and a volume. Queues and cache between web and worker.
langfuse bucketRailway 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

VariableRequiredDescription
NEXTAUTH_SECRET🔐 Auto-generatedSigns session cookies. Keep it stable.
SALT🔐 Auto-generatedHashes API keys. The worker references it.
ENCRYPTION_KEY🔐 Auto-generated64-hex key that encrypts stored LLM credentials. Shared with the worker.
NEXTAUTH_URL✅ Auto-sethttps:// plus the web domain.
DATABASE_URL✅ Auto-injectedPostgres connection string.
CLICKHOUSE_URL, CLICKHOUSE_MIGRATION_URL✅ Auto-setPrivate ClickHouse HTTP and native endpoints.
CLICKHOUSE_USER, CLICKHOUSE_PASSWORD✅ Auto-injectedClickHouse credentials.
REDIS_CONNECTION_STRING✅ Auto-injectedRedis for queues and cache.
LANGFUSE_S3_*✅ Auto-injectedBucket settings for events, media and exports.
AUTH_DISABLE_SIGNUP✅ Setfalse. Set true after creating your account.
TELEMETRY_ENABLED✅ Settrue. Set false to opt out.
NODE_OPTIONS✅ Set3 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 RailwayLangfuse CloudLangSmithHelicone
Monthly cost~$25–50 usageFree tier, then $29+Per seat and tracesFree 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

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.


Template Content

More templates in this category

View Template
Rootprint
Open-source logs and traces with full-text search on object-storage.

Rootprint
1
View Template
Pyroscope profiling
Protected continuous profiling with durable Pyroscope storage.

Anton Orel
1
View Template
SigOnly
Deploy SigNoz with a working demo app & config in one click

zoeyjones
21