---
title: "The Foundation SDK builder pattern | Grafana Labs"
description: "How the Foundation SDK uses composable builders to construct dashboards"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

## How builders work in the Foundation SDK

You already know the Foundation SDK produces dashboard JSON. The usual way to get there is the **builder pattern**: define the dashboard one step at a time with chained method calls, instead of one giant config object.

[Diagram showing builder pattern composition: DashboardBuilder chains to PanelBuilder via WithPanel, which chains to DataqueryBuilder via WithTarget](builder-pattern.svg "Diagram showing builder pattern composition: DashboardBuilder chains to PanelBuilder via WithPanel, which chains to DataqueryBuilder via WithTarget")

## Follow the builder sequence

Most dashboard code follows this flow:

- Start with **DashboardBuilder** for dashboard-level settings such as title, UID, refresh interval, and time range.
- Add each panel with **PanelBuilder** (for example a time series or stat panel).
- Add panel queries with **DataqueryBuilder** so each panel knows how to fetch data.
- Call **build()** (or the equivalent in your language) and export the final dashboard JSON.

That JSON is what you will store in Git for Git Sync.

## Why this matters

| Benefit          | What it means for you                                  |
|------------------|--------------------------------------------------------|
| **Composable**   | Build complex dashboards from simple, reusable pieces  |
| **Readable**     | Chained calls read like a description of what you want |
| **IDE-friendly** | Autocomplete shows valid options at every step         |
