Slide 1 of 3

The Foundation SDK builder pattern

How builders work in the Foundation SDK

With the Foundation SDK you define dashboards 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

Follow the builder sequence

Most dashboard code follows this flow:

  • Start with DashboardBuilder for dashboard-level settings.
  • Add each panel with PanelBuilder.
  • Add panel queries with DataqueryBuilder.
  • Export the final dashboard JSON from the completed builder chain.

Why this matters

The builder pattern has practical advantages when defining dashboards in code.

BenefitWhat it means for you
ComposableBuild complex dashboards from simple, reusable pieces
ReadableChained calls read like a description of what you want
IDE-friendlyAutocomplete shows valid options at every step

Script

The Foundation SDK uses the builder pattern.

You typically start with a DashboardBuilder, add panels with PanelBuilder, then attach queries with DataqueryBuilder.