Skip to main content
Embedding requires the embedding add-on for Cloud Pro or Enterprise. Get in touch to add embedding to your plan. For self-hosted deployments, follow embedding setup.
Try it and see the code. embed.lightdash.com is an interactive demo and helper that lets you preview embedded content and generate a JWT for your own project. For a working end-to-end example, see the example embed app on GitHub — a Node.js app that mints tokens server-side and renders a Lightdash dashboard.

Overview

Standalone data app embedding lets you render a data app on its own — no dashboard, no surrounding chrome — inside an iframe in your application. The app runs in the same sandboxed environment as it does in Lightdash, with every metric query proxied through Lightdash and authorized against the embed JWT. Use standalone embedding when you want to surface an entire data app as a feature in your product (for example, a customer-facing report or interactive narrative) rather than embedding it as one tile on a Lightdash dashboard.

How it compares to other embed types

For tile-based embedding inside a dashboard, see View data apps in dashboards. An app built from the Dashboard template is still a data app: embed it with the steps on this page, the same as an app from any other template. Dashboard embedding is for native Lightdash dashboards.

Setup

These steps assume you’ve already created a project embed secret — see the embedding quickstart if you haven’t.

1. Enable the data app in embed settings

Open Settings → Embedding for your project and use the Allowed content section to authorize the data apps you want to embed:
  • Toggle Allow all data apps to permit any app in the project, or
  • Add specific data apps to the allowlist.
Standalone embedding is denied for any app that isn’t on the allowlist (or covered by the “allow all” switch). This is enforced server-side regardless of what your JWT contains.

2. Mint a data app JWT

Sign a JWT with content.type: 'dataApp' and the appUuid of the data app you want to embed. The JWT must be signed with your project’s embed secret.
A dataApp token can only render the app named in its appUuid claim. It cannot be reused to render any other data app, chart, or dashboard.

3. Construct the embed URL

Data app embeds use the path /embed/{projectUuid}/app/{appUuid} with the JWT in the URL hash fragment:
The hash fragment is never sent to the server or stored in browser history.

4. Render the iframe

You can copy ready-to-use Node, Python, and Go snippets from Settings → Embedding → Preview → Data apps in Lightdash.

Shareable view state

Like the in-app view, a standalone embed keeps the app’s view state — selected filters, the active tab — in the state query parameter of the embed URL; the JWT stays in the hash fragment and isn’t affected. Open the iframe with ?state=<URL-encoded JSON> appended to the embed URL to seed a specific view, and the app writes its own changes back to that parameter as the embed user interacts with it. See Sharing a link to the current view for the size limit, the JSON shape, and how app code reads and validates a key with useAppState(key, default, { scope: 'url' }). Data app tiles on an embedded dashboard don’t read or write state.

Send events to your page

An embedded data app can tell the page that embeds it that something happened, such as a viewer confirming an import, so your page can react right away instead of polling. Ask the agent for it while you build the app, for example “when I click Confirm import, tell the host page with an import-confirmed event that includes the plan ID”. Apps built before app events were available don’t have emitEvent. Upgrade the app first, then ask the agent to add the event. In app code, call emitEvent(name, payload) from @lightdash/query-sdk:
Lightdash relays the call to your page as a lightdash:appEvent embed event, so the same setup applies: embed events turned on for your page’s origin, and a targetOrigin parameter on the embed URL. The event’s payload holds the app’s name and its payload:
Events are relayed from a standalone data app embed and from data app tiles on an embedded dashboard. With the React SDK, they arrive in the dashboard’s onEvent handler with the type appEvent.
  • Names are up to 100 characters and can’t be empty.
  • Payloads are up to 64 KB of JSON, or null when the app sends none. Send larger data through an external connection and emit a reference to it.
  • Your page receives the JSON form of the payload. Dates arrive as strings, undefined values and functions are dropped, and binary data doesn’t survive.
  • emitEvent throws on an invalid name, a payload that isn’t JSON-serializable, or a payload over the limit, so the app can show the error. A call that doesn’t throw can still be dropped by the rate limit.
  • App events are rate limited. All app events from an embed share one limit, 10 events per second by default. Events over the limit are dropped without an error, so emit on viewer actions, not in loops. Self-hosted instances can change the limit with EMBED_EVENT_RATE_LIMIT_MAX_EVENTS and EMBED_EVENT_RATE_LIMIT_WINDOW_MS (see embedding variables).
  • Outside an embed, such as when the app is open in Lightdash, nothing is relayed.
The app picks only the event’s name and payload. The outer type is always lightdash:appEvent, so an app can’t send one of Lightdash’s own events. Both values come from the app’s author, so validate them before your page acts on them.

How access works

A dataApp JWT is intentionally narrow: it authorizes the named app for the named project and nothing else. In practice, this means:
  • The token grants the embed user permission to view the specified data app only.
  • The data app can run arbitrary metric queries across the project’s tables. Embedding an app means you are accepting project-wide column access for that token.
  • Row-level filtering still applies. User attributes on the JWT are enforced inside every query, just like they are for dashboard and chart embeds. SQL filters defined on your tables continue to apply.
  • A dataApp token cannot be used to load dashboards, charts, or the explore page. Each embed token is scoped to a single content type.
Because the token grants project-wide column access for the app’s queries, only mint dataApp tokens for audiences you trust with that data. Use user attributes to enforce row-level access.

Limitations

  • Embedded users can view data apps but can’t create or edit them. Build the app in Lightdash, then embed it with the steps on this page or as a dashboard tile.
  • Standalone data app embedding is iframe-only. There is no React SDK component for it yet.
  • The standalone embed has no controls bar or tile chrome — the app is rendered in isolation.
  • Interactivity options like canExportCsv, canExplore, and dashboardFiltersInteractivity do not apply to dataApp tokens.

See also