Plugins overview
What a plugin is, what it can add to data apps, and when to use one
A plugin adds a feature to data apps: an API for app authors, a way for the app to call your server, UI over the app, or a command or panel in the app's surroundings. Everything a data app reaches beyond itself comes from a plugin, including running a query.
Using plugins, or writing one?
To check for a plugin from inside a data app, see Plugins in the SDK. This section is for writing your own. For full details, read the plugin guide.
How it works
A data app runs sandboxed in a frame inside a host: anfra serve, anfra BI Cloud, or your own app built on @holistics/anfra-sdk/host. The host installs plugins. A data app can't bring its own, only check for the ones the host installed.
A plugin has a host half, a frame half, or both:
| Half | Runs in | Can |
|---|---|---|
| Host half | The host page, with full access | Answer calls (your API, storage, a model), accept events from the app, add commands and side-panel tabs to the host |
| Frame half | The data app's sandboxed frame | Add an API for authors (Anfra.notes, query.notes), draw UI over the app, add menu items, modals and popovers |
The halves talk through calls and events. The host half decides which calls the app may make and which events it accepts, so the frame half can never reach data the host didn't allow. Installing a plugin trusts its host half with the whole host page.
What a plugin can add
| You want | Use |
|---|---|
| The app to call something on your side (an API, a file save, a model) | Host half |
An API for app authors, such as Anfra.notes or query.notes | Frame half |
| UI tied to the app's layout (a panel by a block, a highlight) | Frame half |
| A right-click menu item, a modal or a popover in the app | Frame half |
| A command in the host's action bar, or a tab in its side panel | Host half |
| An author API backed by your server | Both halves |
| To log, rate-limit or cache every call | Not a plugin: middleware on createHost |
| UI unrelated to the app, such as a chat window or settings | Not a plugin: the host's own UI |
Built-in plugins
anfra ships core (runs queries), export, lineage, render, view-underlying-data and inspect. See Built-in plugins for what each adds.
Next steps
- Build a plugin: the steps, with an example.
- Package a plugin: share a plugin so other hosts and teams can install it.