Derive Dashboards
Open-source embedded dashboards for your product. Built by Derive.
You describe your data once, as a model in code. Your users then build, filter and share
dashboards inside your app, and every query runs under your access rules: your tenants and
row rules when you have them, nothing extra when you do not.
Status: early (0.x). On Postgres, dashboards
defined in code, filters, drill-in (a click on a bar, a point, a row or a number opens what is
behind it: broken down, over time, or as its items, each a link into your app), the widget builder and editing a
dashboard (a draft per person, drag and resize, undo and redo, review before publish, merging
over someone else's version), new dashboards, version history with in-place preview and
Restore, shareable links, and agents that edit and publish as themselves work end to
end in the Acme sample, with a client typed from the server. The UI is optional: every flow
is an endpoint first. Archiving and SQLite come next.
Install
npm install derive-dashboards
One package. The React UI needs react, and the Recharts line and bar tiles need recharts:
install them only if you use those parts. A Vue 3 app shows the same dashboards through
derive-dashboards/vue (Vue), which needs react and react-dom installed and
loads them only when a dashboard is shown. The package's own charts need nothing more. The derive-dashboards command (npx derive-dashboards init)
comes with it.
Then follow the quick start. To have a coding agent add dashboards to your app end to end, investigating your access rules and proving no customer sees another's data: npx skills add derive-to/dashboards --skill add-dashboards. For the library's API alone: npx skills add derive-to/dashboards --skill derive-dashboards. llms.txt indexes every page, and ships in the package as derive-dashboards/llms.txt.
What is here today
Embedded dashboards on Postgres, end to end, run by the Acme Tasks sample (examples/acme).
| Import |
Holds |
derive-dashboards/core |
No I/O and no framework. The model (defineModel, validateModel), typed member ids, filters and queries, the access kernel (effectiveFilter), composition, the oracle every engine must match, the Postgres engine (/engine), the document and its schema (/schema), and the store's tables as data. |
derive-dashboards/core/schema |
The Zod schemas of what crosses the wire: the document (parseDocument), a query (parseWireQuery), edit commands, drill state, the server's options, and the JSON Schemas of the agent tools (toolSchemas). |
derive-dashboards/core/oracle |
evaluate: the reference answer to a query over rows held in memory, which every engine must match; OracleError when it refuses. |
derive-dashboards/core/engine |
The Postgres engine: runQuery and readQuery, readRecords, sqlReader and customReader for your own data layer, and assertPlan, which refuses a plan missing a tenant, policy or lock filter. |
derive-dashboards/core/conformance |
The conformance kit for a custom data layer: checkConformance, which compares every case with the oracle, its dataset (DATASET, tablesOf), memorySource, and the readers of stored values. See A custom data layer. |
derive-dashboards |
deriveDashboards(options): a fetch handler for every endpoint, a Postgres source and store for any driver, the result cache, the query log and createTables. |
derive-dashboards/node |
nodeHandler(dashboards): the handler for Express and node:http, whose requests are not fetch's. It reuses a body a parser already read, streams tiles as they finish, and ignores forwarded headers unless told to trust them (trustProxy). nodeRequest(request) is the Node request behind a fetch Request, for a viewer that reads req.user. |
derive-dashboards/testing |
adapterSuite: the contract suite a store adapter must pass, run under vitest. |
derive-dashboards/react |
Dashboard with edit mode (Edit, + Add widget, drag and resize, a change count with undo and redo, review before publish, History with in-place preview, Share), DashboardList with + New dashboard, useDraft and useReview for your own edit and review UI, the filter bar (FilterBar, with chips, a Filter menu, a phone sheet and filterRules for your own), Tile, the built-in tiles (NumberTile, TableTile with a viewer's sort, bars and shading), a tile's answer as CSV (downloadCsv, csvOf, exportRows), drill-in (DrillPanel, DashboardTile, useDrill, and toSeries and rowAt for any chart kit), the widget builder (WidgetBuilder, useBuilder) and theme.css. |
derive-dashboards/vue |
The dashboards in a Vue 3 app: DashboardsProvider, Dashboard and DashboardList as Vue components with the React ones' props (callbacks as listeners, @view-change), navigate for your router, and the client. They draw the React dashboards in an element of your page and load React when the first is shown. See Vue. |
derive-dashboards/recharts |
Line and bar tiles, drawn with Recharts, each mark a drill (install recharts to use them; any other chart library plugs into renderers). |
derive-dashboards/charts-react |
The package's own charts as tiles (CHARTS_RENDERERS): line, bar, area, small multiples, heatmap and funnel, each with a tooltip, keyboard steps, a table for screen readers and drill, and Chart to draw one yourself (answerRows, answerStack, answerFlow, answerSwarm and measureOf read a tile's answer for a parts chart, a treemap, a stack, a flow or a swarm of your own). Include chart.css. |
derive-dashboards/charts |
The charts as plain functions, with no React: data in, a picture out as SVG (lineChart, barChart, areaChart, gridChart, funnelChart, partsChart, stackChart, treemapChart, flowChart, swarmChart and more, and renderSvg). |
derive-dashboards/mcp |
Two tools for the MCP server you already run (addDashboardTools): dashboards_query to ask and read, dashboards_api for everything else. See MCP. |
derive-dashboards/cli |
defineConfig for derive-dashboards.config.ts; the derive-dashboards command runs init, doctor, check, generate, create-tables. |
Tenancy and row policy are opt-in. An app of one tenant leaves them out; once the model has
tenant keys, every source must say how it is tied to them. A viewer who can read no row of a
tile's source gets "no access", never zeros.
Start with the quick start, then concepts,
filters (the built-in filter bar, how to theme it, and npx derive-dashboards add filter-bar to own its code),
endpoints, the store and the CLI. To run
your own data layer (ClickHouse, an API, your own SQL), see
a custom data layer. The
behaviour inventory lists every behaviour the first release
must cover.
How correctness is checked
Strongest first. AGENTS.md has the rules.