Skip to content

Installing Langfuse Locally

Prerequisites

  • Docker Compose v2 (or later)
  • Git
  • OpenSSL – for generating a 32-byte encryption key

1. Clone the repository

git clone https://github.com/langfuse/langfuse.git
cd langfuse

2. Configure environment variables

  1. Copy or create an .env file (base it on .env.example if supplied).
  2. Generate a 32-byte hex key and insert it:
openssl rand -hex 32
ENCRYPTION_KEY="paste-your-key-here"

3. Pick a free host port for PostgreSQL

If port 5432 is already in use, edit docker-compose.yml and change the first number in the mapping—e.g.:

services:
  postgres:
    ports:
      - "127.0.0.1:5434:5432"   # host:container

4. Launch the stack

docker compose up -d

When the containers are healthy you can open http://localhost:3000.

5. First-time setup in the UI

  1. Sign up with an email and password.
  2. Create an organisation and then a project inside it.

organisations vs projects

Organisations group accounts and billing; projects isolate traces and API keys.

6. Issue API keys

  1. Go to Settings → API Keys.
  2. Click Create API Key.
  3. Copy the full credential string and add it to your SerenityGPT (or other client) .env, for example:
LANGFUSE_CREDENTIALS="sk-lf-XXXX...;pk-lf-YYYY...;http://localhost:3000"

Format: <secret-key>;<public-key>;<Langfuse-URL>.

7. View traces

Open Tracing → Traces in the Langfuse UI to stream request/response logs, generations, and metadata in real time.