Langfuse logoLLM Observability

Langfuse

An LLM observability tool for tracing, cost tracking, and quality monitoring of AI applications.

Review notes

Run with a dedicated PostgreSQL instance. Integrate via SDK into AI applications to send traces.

Deployment guide

Run with Docker Compose using PostgreSQL. Integrate the SDK into applications to collect traces.

  1. Create docker-compose file with Langfuse and PostgreSQL.
  2. Configure environment variables: database, secret key, and domain.
  3. Run Docker Compose and access the web UI.
  4. Create a project and obtain API keys.
  5. Integrate Langfuse SDK into AI applications to send traces.
Backup:Back up the PostgreSQL database containing all traces and project settings.

Copy and run on your server

Use each block separately: save the compose file, or copy the bash script to create it and start the container.

docker-compose.ymlyaml
services:
  langfuse:
    image: langfuse/langfuse:latest
    container_name: langfuse
    environment:
      DATABASE_URL: "postgresql://langfuse:CHANGEME_db_password@postgres:5432/langfuse" # CHANGE THIS
      NEXTAUTH_URL: "http://SERVER_IP:3000"
      NEXTAUTH_SECRET: "change-me-generate-with-openssl-rand-base64-32" # CHANGE THIS
      SALT: "change-me-generate-with-openssl-rand-base64-32" # CHANGE THIS
    ports:
      - "3000:3000"
    depends_on:
      - postgres
    restart: unless-stopped

  postgres:
    image: postgres:16-alpine
    container_name: langfuse_postgres
    environment:
      POSTGRES_USER: langfuse
      POSTGRES_PASSWORD: CHANGEME_db_password # CHANGE THIS
      POSTGRES_DB: langfuse
    volumes:
      - ./postgres:/var/lib/postgresql/data
    restart: unless-stopped
setup.shbash
#!/usr/bin/env bash
set -euo pipefail

sudo mkdir -p /opt/langfuse
sudo chown "$USER":"$USER" /opt/langfuse
cd /opt/langfuse

cat > docker-compose.yml <<'COMPOSE'
services:
  langfuse:
    image: langfuse/langfuse:latest
    container_name: langfuse
    environment:
      DATABASE_URL: "postgresql://langfuse:CHANGEME_db_password@postgres:5432/langfuse" # CHANGE THIS
      NEXTAUTH_URL: "http://SERVER_IP:3000"
      NEXTAUTH_SECRET: "change-me-generate-with-openssl-rand-base64-32" # CHANGE THIS
      SALT: "change-me-generate-with-openssl-rand-base64-32" # CHANGE THIS
    ports:
      - "3000:3000"
    depends_on:
      - postgres
    restart: unless-stopped

  postgres:
    image: postgres:16-alpine
    container_name: langfuse_postgres
    environment:
      POSTGRES_USER: langfuse
      POSTGRES_PASSWORD: CHANGEME_db_password # CHANGE THIS
      POSTGRES_DB: langfuse
    volumes:
      - ./postgres:/var/lib/postgresql/data
    restart: unless-stopped
COMPOSE

docker compose up -d
echo "Langfuse is running on http://SERVER_IP:3000"

Stack

TypeScriptPostgreSQLDocker