mcpField
A
app-sdk-concepts

app-sdk-concepts

github.com/grafanaDevelopment2954.3k installsUpdated 1d ago
Repository

About app-sdk-concepts

A CLI and Go library for building schema-centric apps on the Grafana App Platform. It uses CUE schemas to define resources and generate Go and TypeScript code for apps that implement logic through admission control and reconcilers.

Key features

  1. 01Scaffold app projects and components
  2. 02Define resource kinds with CUE
  3. 03Generate Go and TypeScript code
  4. 04Implement admission control and reconcilers
  5. 05Support multiple deployment modes

Use cases

  1. 01Start a standalone operator app
  2. 02Build an app inside the Grafana repository
  3. 03Create a frontend-only app
  4. 04Generate code after changing CUE schemas

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/grafana/skills --skill app-sdk-concepts

After installing, type/app-sdk-conceptsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
cli-reference.md
deployment-modes.md
local-config.md
local-development.md
project-structure.md
specific-config.md

Details

From the project README

Grafana App SDK Concepts

The grafana-app-sdk is a CLI + Go library for building schema-centric apps on the Grafana App Platform. Apps define resources via CUE schemas ("kinds"), generate Go + TypeScript code, and implement business logic via admission control and reconcilers.

Prerequisites

go install github.com/grafana/grafana-app-sdk/cmd/grafana-app-sdk@latest
grafana-app-sdk version   # verify

Common Workflows

Scaffold a standalone operator app
# 1. Init the project (use the Go module path)
grafana-app-sdk project init github.com/example/my-app

# 2. Add operator scaffolding — ASK THE USER FIRST.
#    They may prefer to write app.App by hand.
grafana-app-sdk project component add operator

# 3. Verify scaffolded layout
ls pkg/app pkg/watchers cmd/operator
# Expected: app.go, watchers/<kind>.go, main.go

Common failure: forgetting go install updates the binary — verify with grafana-app-sdk version before init.

Scaffold a grafana/apps-style app (inside grafana/grafana)

Only available inside the Grafana repo (or fork) — the init command detects apps/ and pkg/registry/apps/ at the repo root.

mkdir -p apps/my-app && cd apps/my-app
grafana-app-sdk project init github.com/grafana/grafana/apps/my-app

# Keep ONLY: kinds/ pkg/ go.mod go.sum — delete everything else.
cp apps/example/Makefile       apps/my-app/Makefile
cp apps/example/kinds/config.cue apps/my-app/kinds/config.cue   # overwrite
go work use ./apps/my-app

Then register the app inside Grafana (pkg/registry/apps/apps.go + register.go). Full walkthrough in references/deployment-modes.md.

End-to-end development loop
1. project init               → module, Makefile, kinds/
2. project kind add MyKind    → CUE kind scaffold
3. Edit kinds/*.cue           → schemas, validation, versions
4. grafana-app-sdk generate   → Go types, clients, TS types, AppManifest, CRDs
5. Implement logic            → fill in reconciler / admission stubs
6. (optional) project component add frontend

Always rerun generate after every CUE change — generated code is the API your reconciler sees.

Deployment modes (one-line table)

ModeWhen to pickWhere it runs
Standalone operatorOutside Grafana repo, want your own binaryKubernetes operator with its own webhook server
grafana/appsInside github.com/grafana/grafana (or fork)In-process inside Grafana's API server
Frontend-onlyUI-only app, no Go logic neededNo backend — TS types only

Full per-mode init, runtime, and wiring detail in references/deployment-modes.md.

References

Resources

Comments

Markdown supported