Your own dashboards, without the usual problems: what a semantic layer fixes
Many teams build their own dashboards: a web app, a portal page, a React chart, more and more often written by an AI agent. It starts fast: a backend, a few SQL queries, a chart library. A year later the same problems sh
Many teams build their own dashboards: a web app, a portal page, a React chart, more and more often written by an AI agent. It starts fast: a backend, a few SQL queries, a chart library. A year later the same problems show up in almost every team. eMondrian, an open-source semantic layer, removes them without taking the dashboards away from you: they keep their code and their look, and get their numbers from a REST API instead of the database.
The usual architecture
Browser βββΊ your dashboard app ββSQLβββΊ database
(KPI formulas, access filters, database password)
Every dashboard carries three things of its own: the formulas, the access rules and the database credentials. That is where the problems come from.
Six problems, and what changes with eMondrian
| Problem in your dashboards | With eMondrian |
|---|---|
| Numbers differ. "Revenue" in the dashboard, in Excel and in Power BI are three different SQL queries, and finance and sales argue about whose number is right. | Measures are defined once in the model. The dashboard, an Excel PivotTable and a Power BI report on the same cube show the same number. |
Access rules are copied into every query. Each new chart needs the right WHERE region = β¦; one forgotten filter shows a user someone else's data. |
Roles and row-level security live in the model and are granted to groups. Every query runs with the roles of the person who is looking. |
| Database credentials in every app. Each dashboard backend holds a database user, often one with access to everything. | Only eMondrian connects to the database. The dashboards hold either nothing or the user's own token. |
| A schema change breaks dashboards. A renamed column or a new table means fixing SQL in every dashboard. | The dashboards query cubes, measures and hierarchies. The mapping to tables is in the model, and a change there is made once. |
| No record of who saw what. | Every call through the gateway is in its access log with the user's name, groups and sign-in method. |
| AI agents write SQL on production data. An agent guesses what a metric means from raw tables, and everything it reads goes to the model provider. | The agent reads the model over MCP and writes queries against defined measures. With agentAccess=synthetic-only it builds and tests on a synthetic twin and never sees a real row. |
What the dashboard calls
Browser βββΊ your dashboard app ββREST, JSONβββΊ eMondrian βββΊ database
(model, roles, credentials)
A dashboard sends an MDX or DAX query and gets rows back as JSON:
curl https://bi.example.com/api/v1/query \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"catalog": "Sales", "query": "SELECT {[Measures].[Revenue]} ON 0, [Region].Members ON 1 FROM [Sales]"}'
{
"columns": [ { "name": "Region", "kind": "member" }, { "name": "Revenue", "kind": "measure" } ],
"rows": [ { "Region": "North", "Revenue": 1840200 }, { "Region": "South", "Revenue": 1210950 } ],
"rowCount": 2, "truncated": false
}
GET /api/v1/catalogs and GET /api/v1/catalogs/{catalog}/cubes/{cube} list what a dashboard may query. Your chart code stays as it is; only the data source changes. See REST API.
Connecting your sign-in: two ways
The query is the same either way. What differs is how eMondrian learns who is asking, and that decides which rows come back.
Way 1: your dashboards keep their own sign-in
Your dashboards already sign users in, with your own identity provider or your company's single sign-on. That stays. The dashboard backend tells eMondrian who the signed-in user is. This is how eMondrian's own Dashboard works.
Browser ββsign-inβββΊ your identity provider (as today)
βΌ
your dashboard backend
β X-Forwarded-User: the user
β X-Forwarded-Groups: the user's groups
β X-Forwarded-Secret: the installation's secret
βΌ
eMondrian server /api/v1/query ββ the user's roles βββΊ database
The backend calls the eMondrian server inside the installation, on the same Docker network, and names the user and the user's groups (full paths separated by commas):
curl http://eMondrian:8080/emondrian/api/v1/query \
-H "X-Forwarded-User: anna" -H "X-Forwarded-Groups: /sales,/sales/north" \
-H "X-Forwarded-Secret: $EMONDRIAN_SECRET" -H 'Content-Type: application/json' \
-d '{"catalog": "Sales", "query": "SELECT {[Measures].[Revenue]} ON 0, [Region].Members ON 1 FROM [Sales]"}'
eMondrian accepts a request that names a user only with the right secret, and applies schema roles, row-level security and server rights exactly as for a user who comes through the gateway. Grant the roles in the model to the group paths your backend sends.
Use it when your dashboards already have users and groups: one sign-in, no accounts to create in eMondrian, no tokens in the dashboards.
Set it up safely:
- The secret is the installation's own, shared by the gateway, the Dashboard and the server, and lets its holder act as any user. Trust the dashboard service as much as the gateway, keep the secret in its environment only, and when you change it, change it in every service at once.
- Run the dashboard service on the installation's Docker network and publish only the gateway.
- Give the catalog's default role no access: a request without these headers runs with it.
- Log in your dashboards who opened what.
Way 2: eMondrian signs the users in
Users sign in with eMondrian: Keycloak, linked to Active Directory, LDAP or a provider over OIDC or SAML such as Microsoft Entra ID, Google or Okta. The same accounts then work in the dashboards, Excel, Power BI and AI agents.
The dashboard sends a personal token, Authorization: Bearer emk_β¦, and the gateway checks it and logs the call.
your dashboards ββHTTPS, Authorization: Bearer emk_β¦βββΊ eMondrian gateway βββΊ eMondrian server βββΊ database
One consumer, one user. Every eMondrian user has at most one personal token, and issuing a new one revokes the old one. Give each consumer its own user, for example the portal's backend one user and a client's links another, in the group whose role it should have. Revoking one then stops nothing else, and the access log shows by name which of them called. An administrator issues the token at /account/tokens?user=<name>. It lasts 90 days unless the issuer sets otherwise, and it stops within 30 seconds of its owner being disabled.
Calling from the browser. Call eMondrian from the dashboard server where you can: a token in a page's code can be read by anyone who opens the page. A page that must call /api from the browser is listed under cors.allowed_origins in auth/identity.yml and sends its token in the Authorization header, never in the address.
Use it when you want one set of accounts everywhere and every call in the gateway's access log.
Which one to choose
| Way 1: your own sign-in | Way 2: eMondrian sign-in | |
|---|---|---|
| Who signs users in | Your identity provider | eMondrian (Keycloak, AD, Entra ID, β¦) |
| What the dashboard sends | User and groups, with the installation's secret | A personal token |
| Where the dashboards run | On the eMondrian installation's network | Anywhere that reaches the gateway over HTTPS |
| Access log | Your dashboards log the users | The eMondrian gateway logs every call |
Moving from one way to the other changes how the dashboards sign in, not the dashboards themselves.
Dashboards written by an AI agent
An AI agent connected to eMondrian over MCP reads the model, the cubes, measures and hierarchies, and writes the REST calls for your dashboards from it, instead of guessing SQL from raw tables. Give the agent its own user and set agentAccess=synthetic-only: it then works with the structure and a synthetic twin of the data, the same model with generated values, and builds and tests the dashboards there. People open the finished dashboards on the real data. See AI agent data security.
The REST API, sign-in, roles and the access log are part of the free, open-source eMondrian Community. Synthetic twins come with a licence key that includes SYNTHETIC; a free 30-day evaluation key is at emondrian.com/license.
FAQ
We already have our own dashboards. Do we have to rewrite them?
No. The charts and pages stay. Only the data calls change: from SQL to the database to REST calls to eMondrian.
Why do our dashboards show different numbers from Excel and Power BI?
Because each tool computes the measure with its own query. When all of them query the same eMondrian model, they show the same number.
How do we show each user only their own data?
Define roles in the model, with row-level security, and grant them to groups. Every query runs with the user's roles, so no dashboard has to filter by itself.
Do the dashboards need database credentials?
No. Only eMondrian connects to the database.
We already have our own sign-in. Do users need a second account?
No. Your dashboard backend passes the signed-in user and groups to eMondrian with the installation's secret.
Can an AI agent build the dashboards without seeing our data?
Yes. With synthetic-only, the agent builds and tests them on a synthetic twin of the data, and people open them on the real data.
Read more: REST API Β· Security Β· eMondrian now speaks JSON Β· Ad-hoc dashboards
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.