grafana/grafana
Packages
The packages/ directory holds all the @grafana/* npm workspaces. They are published independently to npm and consumed both by Grafana itself (public/app) and by external plugin authors. Each package is its own Yarn workspace with its own package.json, tsconfig, build scripts, and tests.
Catalog
| Package | Purpose |
|---|---|
@grafana/data (grafana-data/) |
Core data structures: DataFrame, Field, time, themes, value formats |
@grafana/ui (grafana-ui/) |
Design system: components, hooks, primitives |
@grafana/runtime (grafana-runtime/) |
Runtime services: backendSrv, locationService, getDataSourceSrv, plugin extensions |
@grafana/schema (grafana-schema/) |
CUE-generated TypeScript types (panel options, dashboard schema) |
@grafana/sql (grafana-sql/) |
Shared SQL datasource frontend (used by mysql/mssql/pg datasources) |
@grafana/alerting (grafana-alerting/) |
Shared alerting types & helpers |
@grafana/api-clients (grafana-api-clients/) |
OpenAPI-generated API clients |
@grafana/openapi (grafana-openapi/) |
OpenAPI generation tooling |
@grafana/o11y-ds-frontend (grafana-o11y-ds-frontend/) |
Shared observability datasource frontend (logs/traces) |
@grafana/i18n (grafana-i18n/) |
i18n wrapper around i18next |
@grafana/e2e-selectors (grafana-e2e-selectors/) |
Stable test ids/aria attributes |
@grafana/test-utils (grafana-test-utils/) |
Shared Jest helpers |
@grafana/eslint-plugin (grafana-eslint-rules/) |
Custom ESLint rules |
@grafana/flamegraph (grafana-flamegraph/) |
Flame graph component used by profiling datasources |
@grafana/plugin-configs (grafana-plugin-configs/) |
Shared webpack/jest configs for plugin workspaces |
The complete list with current versions lives in packages/README.md.
Dependency shape
graph TD
Data[@grafana/data] --> UI[@grafana/ui]
Data --> Runtime[@grafana/runtime]
Data --> Schema[@grafana/schema]
UI --> Runtime
Runtime --> i18n[@grafana/i18n]
Schema --> UI
SQL[@grafana/sql] --> UI
SQL --> Data
O11y[@grafana/o11y-ds-frontend] --> UI
O11y --> Data
Alerting[@grafana/alerting] --> Data
Flamegraph[@grafana/flamegraph] --> UI
PublicApp[public/app] --> Data & UI & Runtime & Schema & SQL & O11y & Alerting@grafana/data is the foundation; nothing depends on public/app. External plugins target @grafana/* only.
Versioning and publishing
- Lerna manages coordinated version bumps (see
lerna.json). - All packages share the Grafana release version (e.g.
v13.1.0). yarn packages:prepareupdates versions;yarn packages:packproduces tarballs innpm-artifacts/.
Plugin authors typically pin to the exact Grafana version their target instance is running.
Building and testing
yarn packages:build # Build every package (Nx affected)
yarn packages:typecheck
yarn packages:test:ci
yarn packages:i18n-extract
yarn packages:cleanEach package follows the same rollup build path; the shared rollup config is in packages/rollup.config.parts.ts.
Where to add code
| You're writing… | Add it to… |
|---|---|
| A type used by both backend and frontend | A CUE schema in kinds/ → run make gen-cue |
| A type used only by frontend (panel option, etc.) | @grafana/schema |
| A runtime helper external plugins need | @grafana/runtime |
| A new design-system primitive | @grafana/ui |
| Pure data utilities | @grafana/data |
| Grafana-app-internal helper | public/app/core/ (not a package) |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.
Previous
Plugins runtime
Next
@grafana/data