Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: update contributing.md with recent state (#7510)

Nimar37d1ac7ff869
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index abeefc7611..5d46f4a9e4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -42,7 +42,7 @@ A good first step is to search for open [issues](https://github.com/langfuse/lan
- NextAuth.js / Auth.js
- tRPC: Frontend APIs
- Prisma ORM
- - Zod
+ - Zod v4
- Tailwind CSS
- shadcn/ui tailwind components (using Radix and tanstack)
- Fern: generate OpenAPI spec and Pydantic models
@@ -55,34 +55,34 @@ A good first step is to search for open [issues](https://github.com/langfuse/lan
See this [diagram](https://langfuse.com/self-hosting#architecture) for an overview of the architecture.
-### Network Overview
-
-```mermaid
-flowchart TB
- User["UI, API, SDKs"]
- subgraph vpc["VPC"]
- Web["Web Server<br/>(langfuse/langfuse)"]
- Worker["Async Worker<br/>(langfuse/worker)"]
- Postgres["Postgres - OLTP<br/>(Transactional Data)"]
- Cache["Redis/Valkey<br/>(Cache, Queue)"]
- Clickhouse["Clickhouse - OLAP<br/>(Observability Data)"]
- S3["S3 / Blob Storage<br/>(Raw events, multi-modal attachments)"]
- end
- LLM["LLM API/Gateway<br/>(optional)"]
-
- User --> Web
- Web --> S3
- Web --> Postgres
- Web --> Cache
- Web --> Clickhouse
- Web -.->|"optional for playground"| LLM
-
- Cache --> Worker
- Worker --> Clickhouse
- Worker --> Postgres
- Worker --> S3
- Worker -.->|"optional for evals"| LLM
-```
+### Network Overview
+
+```mermaid
+flowchart TB
+ User["UI, API, SDKs"]
+ subgraph vpc["VPC"]
+ Web["Web Server<br/>(langfuse/langfuse)"]
+ Worker["Async Worker<br/>(langfuse/worker)"]
+ Postgres["Postgres - OLTP<br/>(Transactional Data)"]
+ Cache["Redis/Valkey<br/>(Cache, Queue)"]
+ Clickhouse["Clickhouse - OLAP<br/>(Observability Data)"]
+ S3["S3 / Blob Storage<br/>(Raw events, multi-modal attachments)"]
+ end
+ LLM["LLM API/Gateway<br/>(optional)"]
+
+ User --> Web
+ Web --> S3
+ Web --> Postgres
+ Web --> Cache
+ Web --> Clickhouse
+ Web -.->|"optional for playground"| LLM
+
+ Cache --> Worker
+ Worker --> Clickhouse
+ Worker --> Postgres
+ Worker --> S3
+ Worker -.->|"optional for evals"| LLM
+```
### Database Overview
@@ -130,10 +130,11 @@ Requirements
cp .env.dev.example .env
```
-4. Run the entire infrastructure in dev mode
+4. Run the entire infrastructure in dev mode. **Note**: if you have an existing database, this command wipes it.
```bash
- pnpm run dx
+ pnpm run dx # first run only (resets db, node_modules, ...)
+ pnpm run dev # any subsequent runs
```
You will be asked whether you want to reset Postgres and ClickHouse. Confirm both with 'Y' and press enter.
@@ -148,6 +149,12 @@ Requirements
- Username: `[email protected]`
- Password: `password`
+
+To get comprehensive example data, you can use the `seed` command:
+```sh
+pnpm run db:seed:examples
+```
+
## Monorepo quickstart
- Available packages and their dependencies
@@ -197,23 +204,41 @@ Requirements
On the main branch, we adhere to the best practices of [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). All pull requests and branches are squash-merged to maintain a clean and readable history. This approach ensures the addition of a conventional commit message when merging contributions.
-## Test the public API
+## Running Unit Tests
-The API is tested using Jest. With the development server running, you can run the tests with:
+All tests run in the CI and must pass before merging.
+All tests run against a running langfuse instance and **write/delete real data from the database**.
-Run all
+### Tests in the `web` package (public API)
+We're using Jest with in the `web` package. Therefore, if you want to provide an argument to the test runner, do it directly without an intermittent ` -- `.
-```bash
-npm run test
+There are three types of unit tests:
+- `test-sync`
+- `test-async`
+- `test-client`
+
+To run a specific test, for example the test: `"should handle special characters in prompt names"` in `prompts.v2.servertest.ts`, run:
+```sh
+cd web # or with --filter=web
+pnpm test-sync --testPathPattern="prompts\.v2\.servertest" --testNamePattern="should handle special characters in prompt names"
```
-Run interactively in watch mode
+To run all tests:
+```sh
+pnpm run test
+```
-```bash
-npm run test:watch
+Run interactively in watch mode (not recommended!)
+```sh
+pnpm run test:watch
```
-These tests are also run in CI.
+### Tests in the `worker` package
+For the `worker` package, we're using `vitest` to run unit tests.
+
+```sh
+pnpm run test --filter=worker -- FILE_YOU_WANT_TO_TEST.ts -t "test name"
+```
## CI/CD
@@ -341,6 +366,20 @@ Please note that
Until the V3 release, both the JSON record must be updated **and** a migration must be created to continue supporting self-hosted users. Note that the migration must updated both the `models` as well as the `prices` table accordingly.
+## Updating the OpenAPI Specs & fern SDKs
+
+We maintain the API specifications manually to guarantee a high degree of understandability. If you made changes to the API, please update the respective `.yml` files in `fern/apis/...`.
+
+To generate the respective `openapi.yml` files which power the online API reference & SDKs, run:
+
+```sh
+npx fern-api generate --api server # for the server API
+npx fern-api generate --api client # for the client API
+npx fern-api generate --api organizations # for the organizations API
+```
+
+**Note:** You need a signed in fern account to run those commands.
+
## License
Langfuse is MIT licensed, except for `ee/` folder. See [LICENSE](LICENSE) and [docs](https://langfuse.com/docs/open-source) for more details.