anfra docsAlpha
Plugins

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:

HalfRuns inCan
Host halfThe host page, with full accessAnswer calls (your API, storage, a model), accept events from the app, add commands and side-panel tabs to the host
Frame halfThe data app's sandboxed frameAdd 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 wantUse
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.notesFrame 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 appFrame half
A command in the host's action bar, or a tab in its side panelHost half
An author API backed by your serverBoth halves
To log, rate-limit or cache every callNot a plugin: middleware on createHost
UI unrelated to the app, such as a chat window or settingsNot 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

On this page