# BI as code

> BI as code is the practice of defining business intelligence assets, such as dashboards, charts, and data connections, as versioned text instead of GUI state.

Canonical: https://dvt.dev/glossary/bi-as-code/

BI as code is the practice of defining business intelligence assets, such as dashboards, charts, metric definitions, and data connections, as versioned text documents instead of configuration saved inside a GUI.

It borrows the habits software teams already rely on: changes are diffs, every change has an author, a reviewer can approve or reject it, and a bad change can be reverted. Data teams already work this way for transformation code and pipelines; BI as code extends the same discipline to the layer people actually look at.

## How it works in dvt

In dvt, each BI asset has a text form. A dashboard is a JSON [dashboard spec](https://dvt.dev/glossary/dashboard-spec). A data source is a [named connection](https://dvt.dev/glossary/connection-as-code) that panels reference by `sourceId`, with its credentials stored encrypted and never written into a spec. A visual identity is a set of [design tokens](https://dvt.dev/glossary/design-tokens) in the spec's theme. Every one of these is something a person can read in a review and an agent can write over MCP.

What dvt adds beyond "store it as text" is the review loop around the text. Every write is [validated](https://dvt.dev/glossary/spec-validation) against the schema before it saves and can be [previewed](https://dvt.dev/glossary/dashboard-preview) before it applies. Every save becomes an attributed revision with a visual diff. A reviewer can pin a comment to a single panel, and an agent can read the thread, make the edit, and resolve it. BI as code then means more than files in a repository: it means every change to what people see is checkable.

## Related terms

- [Dashboards as code](https://dvt.dev/glossary/dashboards-as-code)
- [Connection as code](https://dvt.dev/glossary/connection-as-code)
- [Spec validation](https://dvt.dev/glossary/spec-validation)
- [Dashboards as code, the dvt implementation](https://dvt.dev/solutions/dashboards-as-code)
