Shipping the first customer dashboard is the easy part. What matters is where three things live: the metric definitions, the rule that keeps each customer to their own rows, and the numbers an AI chat gives. Put all three in one data model, and every chart, API and chat agrees.
What are the ways to add customer dashboards to an app?
There are three routes. They differ in how fast the first dashboard ships and in where the definitions and the customer filter live.
| Route | First dashboard | Metric definitions live in | Customer filter lives in |
|---|---|---|---|
| Embed a BI tool | Fastest | The BI tool | The BI tool |
| Chart library on your own API | Slowest | Your API code, one query per chart | Your API code, on every query |
| Dashboards on a data model | In between | The data model | The data model, applied on the server |
- Embed a BI tool, such as Metabase, Luzmo or Embeddable. It is the fastest way to put standard charts in front of customers. The definitions and access rules live inside that product, so your own API or an AI chat has to go through it or copy them.
- Build on a chart library, such as Recharts or Tremor. The dashboards look and behave like the rest of your product. The library only draws charts, so you write a query for each metric and add the customer filter to every one.
- Build on a data model. The first chart takes longer, because someone writes the model first. After that, every dashboard, API call and chat reads the same definitions and the same customer filter.
What goes wrong after the first customer dashboard ships?
Three problems can show up after launch.
A customer sees another customer's rows. On the chart-library route, the filter is a WHERE customer_id = ? your code adds to every query. One endpoint without it leaks data, and nothing errors.
Two charts disagree on a metric. The "revenue" tile and the "revenue by month" chart can be written by different people, in different endpoints. One subtracts returns and cancellations and one doesn't. On the dataset in our post How an agent turns a question into a trustworthy answer, that difference is $205,421 on $4.5 million of gross revenue.
An AI chat added later disagrees with the dashboards. Here is one way, with a chat built outside the BI tool:
- A customer asks the new chat for last quarter's revenue.
- The chat writes its own query. The dashboard's definition lives in BI settings or endpoint SQL the chat can't read, so the chat assumes gross revenue.
- The chat answers with a higher number than the dashboard beside it.
- The chat also needs the customer filter. If that filter lives in your endpoints, the chat's queries don't have it.
Why don't AI answers match our dashboards? walks through the causes on real data.
Why build customer dashboards on a data model?
A data model is a file that states what each metric means, how tables join, and which rows each caller may see. Building on one changes three things:
- Definitions live in one place. A chart asks for
revenueand gets the one agreed definition. Two charts can't drift apart, because neither holds its own SQL. - Dashboards and definitions ship together. In Malloy, a package holds the data model and everything built on it: data apps, dashboards and notebooks. The package is published and versioned as one unit, so a chart and the definition it reads always change together (packages and versions).
- AI chat agrees with the charts. An AI agent queries the same model the dashboards do, so a customer asking the chat gets the number on the chart beside it.
Building the dashboard itself has become the quick part. A coding agent can write a data app from a description, as our post Dashboards aren't dead shows.
Where should the customer filter live?
On the data, enforced on the server, and tied to who the customer signed in as. Not in the browser, not in each endpoint, and not in a prompt. Then every surface gets the same rule without copying it, including ones you add later. In Malloy, an access rule on a source limits every query to the caller's own rows (row and column access).
What does a shared data model look like in production?
VideoAmp wrote more than 2,000 definitions, business rules and warnings into one data model. Before launching AI reporting in its customer-facing product, it tested the AI against answers certified in its existing reporting, and metrics matched to the decimal. The same model is extending to more AI products and to internal reporting.
Where should you start?
If you need plain charts in front of customers soon, embed a BI tool and accept that its definitions live there. If you expect an AI chat, your own API, or more than one surface on the same numbers, start from a data model.
The data model route is open source. Malloy is MIT-licensed, and Malloy Publisher serves models and data apps, with skills for coding agents in the same repository. You don't need to buy anything to use it.
Credible hosts these packages for you. It serves each package's model, data apps, dashboards and notebooks, and publishes every change as a version you can roll back to. Your app's charts and your customers' AI agents query the same hosted model. Credible signs viewers in and applies each viewer's access rules the same way on every embedded page and to every agent. See pricing.
Frequently asked questions
Should I embed a BI tool or build customer dashboards myself?
Embed a BI tool if your customers need standard charts soon and you can live with its look and its pricing. Build with a chart library on your own API if the dashboards are a core part of your product and must look and behave like the rest of it. Either way, decide early where the rule that separates customers lives.
How do embedded dashboards show each customer only their own data?
Your server tells the dashboard which customer is asking, and the filter is applied on the server, not in the browser. Metabase and Luzmo, for example, lock a filter value, such as the customer ID, that your server sets. The customer must not be able to change that value, and the filter should sit on the data, not on one dashboard.
Can I use React chart libraries like Recharts for customer dashboards?
Yes. Recharts is an open-source React chart library, and Tremor builds dashboard components on it. Both give you full control over how the charts look. They only draw charts. You still build the API behind each chart, write each metric's query, and add the customer filter to every one of those queries yourself.
How do I add an AI chat that agrees with my customer dashboards?
Make the chat and the dashboards read the same metric definitions and the same customer filter. If the definitions live in dashboard settings or API code the chat can't read, the chat writes its own queries and assumes its own definitions, so its totals can differ from the dashboard's. Put the definitions in a data model that both query.