Skip to Content
OpenPerf

Conventions

Project layout

Where code goes in the monorepo.

Packages and apps

PathHolds
apps/Services and web apps, such as api, web and mcp.
tools/Developer tools that never deploy, such as the e2e tests.
packages/sharedCode the browser, the SDK and the server all run.
packages/serverThe backend: features in src/<feature>, infrastructure in src/platform.
packages/deftThe design system: components, theme and tokens.
packages/sdk@openperf/sdk, published to npm.
packages/stacktraceParsing of stack trace text for every language OpenPerf reads. Depends on no other package.
packages/seederThe demo telemetry seeder: generators, test builders and the bun run seed CLI. Runs on Bun only.
apps/web-corpsiteThis site: the landing page and the docs.

Where code goes

Ask in order; the first yes decides.

  1. Does apps/web or packages/sdk import it? It goes to packages/shared: attribute keys, vitals scoring, upload limits, enums the interface shows. shared-usage.test.ts fails when a file there is used by neither.
  2. 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.
  3. Does it work without product words? It goes to packages/server/src/platform: connections, cache, logging, queues.
  4. 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 import testing.
FeatureImports
accessplatform only
auditplatform only
integrationsplatform only
otlpplatform only
logsotlp
errorsaudit, otlp
releaseserrors
webhookserrors
traceserrors, logs, otlp
performanceotlp, traces
alertingerrors, integrations, webhooks
ingesterrors, otlp

Other rules

  • @openperf/deft publishes only its index.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-hosting in the same change.
  • @openperf/stacktrace has no dependencies and imports no workspace package, so it can move to its own repository. Each format lives in src/formats/<name> and is listed in stack-formats.ts; a new case is a file in src/fixtures captured from the runtime. The SDK imports /javascript, which holds only the JavaScript format.
  • @openperf/sdk is the only package built with tsdown. Its entry points are /node, for Node.js and Bun, and /browser, plus the openperf bin; src/core, src/server and src/bun stay internal. OpenTelemetry versions are pinned in the root catalog.
  • Every third-party package bundled into the SDK dist is listed in deps.onlyBundle in packages/sdk/tsdown.config.ts, and its license is in packages/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-licenses Claude Code skill (.claude/skills/update-sdk-licenses); without Claude, build the SDK and run its generate.sh from the repository root.

On this page