Conventions
Project layout
Where code goes in the monorepo.
Packages and apps
| Path | Holds |
|---|---|
apps/ | Services and web apps, such as api, web and mcp. |
tools/ | Developer tools that never deploy, such as the e2e tests. |
packages/shared | Code the browser, the SDK and the server all run. |
packages/server | The backend: features in src/<feature>, infrastructure in src/platform. |
packages/deft | The design system: components, theme and tokens. |
packages/sdk | @openperf/sdk, published to npm. |
packages/stacktrace | Parsing of stack trace text for every language OpenPerf reads. Depends on no other package. |
packages/seeder | The demo telemetry seeder: generators, test builders and the bun run seed CLI. Runs on Bun only. |
apps/web-corpsite | This site: the landing page and the docs. |
Where code goes
Ask in order; the first yes decides.
- Does
apps/weborpackages/sdkimport it? It goes topackages/shared: attribute keys, vitals scoring, upload limits, enums the interface shows.shared-usage.test.tsfails when a file there is used by neither. - Is it HTTP transport or settings management? It stays in
apps/api/src/features: controllers, DTOs, creating and changing organizations, projects, alert rules. Reads of telemetry don't belong here, even when only the API calls them. - Does it work without product words? It goes to
packages/server/src/platform: connections, cache, logging, queues. - Everything else is a feature in
packages/server/src/<feature>: intake, processing, ClickHouse queries, alerting, background jobs.
What a feature owns
- A feature owns everything about its subject: the row it writes and reads back, its queries and writes, its queues with their payloads and schedules, its response schemas and its test builders.
- Record models and fingerprints belong to
otlp, which produces them. - Postgres tables, migrations of both stores and rollup descriptors stay in
platform. - Bun apps keep their logic in
packages/, see Bun apps.
Server modules
- Apps import a server module through its subpath, such as
@openperf/server/ingest. Modules import each other only through the other module's barrel, never its internals. - Platform modules (
cache,clickhouse,email,health,http,logging,payload,postgres,secrets,storage) import no feature, not even in tests. - A feature imports platform modules and only the features listed for it in
local/server-module-imports(config/oxlint/plugin/server-module-imports.ts). Only tests importtesting.
| Feature | Imports |
|---|---|
access | platform only |
audit | platform only |
integrations | platform only |
otlp | platform only |
logs | otlp |
errors | audit, otlp |
releases | errors |
webhooks | errors |
traces | errors, logs, otlp |
performance | otlp, traces |
alerting | errors, integrations, webhooks |
ingest | errors, otlp |
Other rules
@openperf/deftpublishes only itsindex.ts. A primitive the apps need goes to Deft with a Deft UI page and an example; a composite bound to app data stays in the app.- A change to a service, port, environment variable or deploy step updates its page in
apps/web-corpsite/content/docs/self-hostingin the same change. @openperf/stacktracehas no dependencies and imports no workspace package, so it can move to its own repository. Each format lives insrc/formats/<name>and is listed instack-formats.ts; a new case is a file insrc/fixturescaptured from the runtime. The SDK imports/javascript, which holds only the JavaScript format.@openperf/sdkis the only package built withtsdown. Its entry points are/node, for Node.js and Bun, and/browser, plus theopenperfbin;src/core,src/serverandsrc/bunstay internal. OpenTelemetry versions are pinned in the rootcatalog.- Every third-party package bundled into the SDK
distis listed indeps.onlyBundleinpackages/sdk/tsdown.config.ts, and its license is inpackages/sdk/THIRD_PARTY_LICENSES.md, which ships to npm. The build fails on an unlisted package. After adding, removing or bumping an SDK dependency, run the/update-sdk-licensesClaude Code skill (.claude/skills/update-sdk-licenses); without Claude, build the SDK and run itsgenerate.shfrom the repository root.