How grafana/scenes works
Project type and purpose
• This is a monorepo for the “Grafana Scenes” SDK: a framework for building interactive Grafana apps.
• It consists of three published packages:
• @grafana/scenes (core rendering engine, behaviors, querying, variables)
• @grafana/scenes-react (React bindings and components)
• scenes-app (a demo Grafana plugin/app built with the SDK)
• It also includes a Docusaurus-based documentation website and CI/CD workflows for testing, bundling, and deploying to the Grafana plugin registry.
File structure
• Root-level:
• Yarn v4 workspaces (.yarnrc.yml, .yarn/, package.json, lerna.json, turbo.json)
• CI/CD definitions (GitHub Actions under .github/workflows, custom action for Yarn builds)
• Lint, Prettier, Husky hooks, build scripts.
• packages/scenes
• TS source implementing core “scene graph,” behaviors, panel builders, query runners, variable handling.
• Rollup build config, Jest tests.
• packages/scenes-react
• React component wrappers, hooks, contexts, utilities.
• Rollup config, Jest, integration tests.
• packages/scenes-app
• Demo app (React + Grafana plugin manifest/plugin.json) showcasing SDK features.
• Webpack config, Docker compose provisioning for data sources, Cypress end-to-end tests.
• docusaurus/website
• Static site generator for user docs—Markdown + React pages + custom themes.
Key insights from README
• Primary goal: provide an SDK to build “Scenes” (interactive panels) in Grafana.
• Demo app lives in packages/scenes-app/README.md; core docs in packages/scenes/README.md.
• CI flows automate build/test of each package and deployment of the demo/documentation.
a. Main components
• Monorepo root (Yarn/Lerna/Turbo)
• Core library (@grafana/scenes)
• React binding library (@grafana/scenes-react)
• Demo app (scenes-app)
• Documentation site (Docusaurus)
• CI/CD pipeline (GitHub Actions)
• External services (Grafana plugin registry, npm registry)
b. Relationships & interactions
• scenes-app → imports → scenes-react → imports → scenes
• Docusaurus site → renders docs for all packages (pulls code examples from packages)
• CI → installs monorepo → runs tests/build on each package → publishes to npm/Grafana portal
c. Architectural patterns & principles
• Monorepo with Yarn Workspaces + Lerna for versioning and cross-package linking
• Modular package separation: core engine vs UI adapters vs example app
• CI/CD as code via GitHub Actions, ensuring atomic builds of all packages
d. Key technologies & frameworks
• TypeScript, React, Rollup, Webpack, Jest, Cypress, Docusaurus, GitHub Actions, Docker
Detail
• Three package boundaries, shared config, CI workflows, and external deployment targets
• Don’t omit the Docusaurus site—treat it as a first-class component