Set up your project
Before you can define a dashboard in code, you need a project with the Foundation SDK installed. Choose either Go or TypeScript. Both produce identical dashboard JSON output.
To set up your project, complete the following steps:
Option A: Go
Create a new directory for your project and navigate into it:
mkdir my-dashboards && cd my-dashboardsInitialize a Go module:
go mod init my-dashboardsInstall the Grafana Foundation SDK:
go get github.com/grafana/grafana-foundation-sdk/go@latestCreate a
main.gofile:touch main.go
Option B: TypeScript
Create a new directory for your project and navigate into it:
mkdir my-dashboards && cd my-dashboardsInitialize a Node.js project:
npm init -yInstall the Grafana Foundation SDK and TypeScript:
npm install @grafana/grafana-foundation-sdk typescript ts-node @types/nodeCreate an
index.tsfile:touch index.ts
Your project directory should now contain the SDK dependency and an empty source file ready for your dashboard code.
In the next milestone, you create your first dashboard definition using the builder pattern.