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

  1. Create a new directory for your project and navigate into it:

    Bash
    mkdir my-dashboards && cd my-dashboards
  2. Initialize a Go module:

    Bash
    go mod init my-dashboards
  3. Install the Grafana Foundation SDK:

    Bash
    go get github.com/grafana/grafana-foundation-sdk/go@latest
  4. Create a main.go file:

    Bash
    touch main.go

Option B: TypeScript

  1. Create a new directory for your project and navigate into it:

    Bash
    mkdir my-dashboards && cd my-dashboards
  2. Initialize a Node.js project:

    Bash
    npm init -y
  3. Install the Grafana Foundation SDK and TypeScript:

    Bash
    npm install @grafana/grafana-foundation-sdk typescript ts-node @types/node
  4. Create an index.ts file:

    Bash
    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.


page 3 of 8