Langfuse is an open source LLM engineering platform for developing, monitoring, evaluating, and debugging AI applications. Langfuse monorepo guidance for fast, safe code changes.
AGENTS.mdis a living document.- Update this file in the same PR when monorepo-level architecture, workflows, dependency boundaries, mandatory verification commands, or release/security processes materially change.
- For package-local material changes, update the package-local
AGENTS.mdin the same PR. - If no material guidance changed, do not edit AGENTS files.
langfuse/
├─ web/ # Next.js app (UI + tRPC + public REST)
├─ worker/ # Queue consumers and background processing
├─ packages/shared/ # Shared domain, DB, queue contracts, repositories
├─ ee/ # Enterprise package consumed by web
├─ generated/ # Generated API clients (do not hand-edit)
├─ fern/ # API definition sources
└─ scripts/ # Repo scripts
- Package guides:
web/AGENTS.mdworker/AGENTS.mdpackages/shared/AGENTS.mdee/AGENTS.md
- Dependency direction:
web->@langfuse/shared,@langfuse/eeworker->@langfuse/shared@langfuse/ee->@langfuse/shared@langfuse/shared-> no imports fromweb,worker, oree
- Queue payload schemas and queue-name contracts are owned by
packages/shared/src/server/queues.ts.
- Install deps:
pnpm install - Dev all packages:
pnpm run dev - Dev web only:
pnpm run dev:web - Dev worker only:
pnpm run dev:worker - Lint all:
pnpm run lint - Typecheck all:
pnpm run typecheck/pnpm tc - To try running build, always run
pnpm run build:checkand verify that it succeeds. This does not impact running web servers - If you have to rebuild all for testing, run:
pnpm run build - Full reset/bootstrap (destructive):
pnpm run dx
Minimum verification matrix:
| Change scope | Minimum verification |
|---|---|
web/** only |
pnpm --filter web run lint + targeted web tests |
worker/** only |
pnpm --filter worker run lint + targeted worker tests |
packages/shared/** (non-schema) |
pnpm --filter @langfuse/shared run lint + one targeted web check + one targeted worker check |
packages/shared/prisma/** or packages/shared/clickhouse/** |
pnpm --filter @langfuse/shared run lint + pnpm run db:generate + targeted web/worker regressions |
Public API contract (web/src/pages/api/public/**, web/src/features/public-api/types/**, fern/apis/**) |
web lint + targeted server API tests + Fern update/regeneration; never hand-edit generated/** |
Cross-package refactor (web + worker + shared) |
pnpm run lint + pnpm run typecheck + targeted tests per impacted package |
- Keep changes scoped; avoid unrelated refactors.
- Prefer package-local implementation details in package AGENTS files.
- Do not hand-edit generated/build artifacts:
generated/*web/.next/*web/.next-check/**/dist/*packages/shared/prisma/generated/*
- Keep each test independent and parallel-safe.
web/src/__tests__/server: avoidpruneDatabasecalls.- Client tests contain
....clienttest.ts - When you write a test for a bug or similar, write the test that fails first. Check that it fails. Only then fix the bug. Otherwise, the test is not good!
- Follow Conventional Commits.
- Include AGENTS.md updates in the same PR when guidance materially changes.
- In PR descriptions, list impacted packages and executed verification commands.
- Public API contract changes must update Fern sources in
fern/apis/**and regenerated outputs; do not hand-editgenerated/**. - Use repo-relative file paths in docs and runbooks.
- Our docs live in
../langfuse-docs/which is a different repo. You may always access this.
- Root
AGENTS.mdis monorepo-level only. - Package-local runbooks, commands, and entry points belong in package
AGENTS.mdfiles. - Keep guidance DRY: canonicalize to the most specific file.
- Release workflow is managed at root (
pnpm run release). - Langfuse Cloud deployments are triggered by pushes to
production(.github/workflows/deploy.yml). - Promote
maintoproductionvia.github/workflows/promote-main-to-production.yml(manualworkflow_dispatch). - Use
pnpm run release:cloudfor CLI-triggered Cloud promotions with preflight branch/migration checks. - Do not change release/versioning flow without updating this file and impacted package guides.
- use the github cli
gh search issuesto search github.
- Placeholder: add issue triage and PR hygiene conventions used by maintainers.
- Never commit secrets or credentials.
- Keep examples in
.env*.examplefiles in sync with required env vars. - Follow
SECURITY.mdfor vulnerability reporting/handling.
- Lint/typecheck failures: run
pnpm run lintandpnpm run tc. - Schema/client drift: run
pnpm run db:generate. - Local infra issues: run
pnpm run infra:dev:up; usepnpm run dxonly when destructive reset is intended.
- Do not use destructive git commands (for example
reset --hard) unless explicitly requested. - Do not revert unrelated working-tree changes.
- Keep commits focused and atomic.
- Additional folder-specific rules live in
.cursor/rules/.