Skip to main content
Launching user-facing analytics? Learn about building with Claude / AI vs Embeddable

Back to blog list

How to Build Customer Dashboards with Claude Code Without Owning the Stack

Claude Code can generate a dashboard in minutes, but customer-facing dashboards also need tenant isolation, rendering, exports and caching. Have Claude Code write data models and dashboards as code on a customer-facing analytics platform, and mint a tenant-scoped embed token on your server.

What Claude Code Builds When You Ask It Directly: A Working Dashboard, Fast, for One User

Claude Code makes a dashboard cheap. Owning it after your customers log in is what costs you.

Building a customer-facing dashboard with Claude Code means using it to generate a dashboard that ships inside a software as a service (SaaS) product, where each customer sees only its own data. Claude Code can write the charts, queries and a tenant filter straight into your app, which leaves your team owning tenant isolation, chart rendering, exports and caching from then on.

The alternative is to have it write data models and dashboards as code on a customer-facing analytics platform: Cube data models declare row-level security rules and pre-aggregations, a dashboard file defines the layout, and your server mints an embed token carrying each tenant's securityContext and an expiry you choose. The platform then applies the tenant rules to every query, answers from a pre-aggregation whenever a query matches one, and runs the exports, while you keep the models, dashboard code and token integration.

If the dashboard is only for you and your Claude plan includes Claude Data, Claude's own dashboards feature, that is enough. This article covers the ones your customers use.

Ask Claude Code directly and it's fast. A prompt like Add a /usage page charting weekly active users per feature from our Postgres events table typically produces a React component, a query helper and an API route. Start the dev server and the charts render on localhost. We'd call that a real result, not a toy.

Getting a dashboard out of Claude is solved. Getting one in front of hundreds of customers, each allowed only its own rows, is a different problem.

What Becomes Yours Once Customers See the Dashboard

Building a dashboard for yourself and building one for your customers look like the same job on day one. They aren't.

A common failure mode looks like this: a customer asks why usage spiked and the dashboard answers from another tenant's rows. Nothing crashed. The query ran and the chart rendered. The filter that should have scoped it to one account sat in a code path that nobody rechecked after a refactor.

That's the first of four jobs a single-user build rarely faces at scale. Tenant filtering has to hold on every query, including the ones someone writes next quarter. Chart rendering has to survive real data: long labels, empty states, and a tenant with ten rows sitting next to one with ten million. Exports have to produce comma-separated values (CSV) files that open cleanly in a spreadsheet, which means quoting and escaping fields as RFC 4180 describes rather than joining strings with commas. And caching has to be scoped per customer, or one tenant's warm cache becomes another tenant's answer.

None of these is finished on the day the dashboard first works. Each one picks up new edge cases as your customers, data and schema grow.

We've written separately about shipping AI-generated dashboards safely, but the point here is narrower. Claude Code can write all four layers. Someone still has to own them in every release after that, and that owner is either your team or your platform.

Two Ways to Use Claude Code for Customer Dashboards, and What Each Leaves You Maintaining

Same agent, same kind of prompt, two destinations. Here's what Claude Code produced when we asked it to write customer dashboards straight into an app, set against what it produces when it writes dashboards as code on our own platform.

Claude Code writing it straight into your app (our own test builds)Claude Code building on Embeddable
Tenant isolationA tenant filter in application codeRow-level rules declared in the Cube data models, applied to the securityContext your server puts in each embed token
Chart renderingCharts drawn as plain divsRemarkable Pro chart components, themed in code
CSV/exportA hand-built CSV routePer-chart CSV, XLSX and PNG export from each chart's menu
CachingNoneCube caching and pre-aggregations, scoped per tenant
Customer-built reportsNot built; a separate project when customers askCustom Canvas, within the limits your models set
Who maintains itYour team, every layerYou: models, dashboard code and the server-side token call. The platform: the runtime underneath

Nothing in the left column is a failure. Claude Code wrote working code for every row; it wrote the version your team then owns.

What the platform handles that your code doesn't is the part that runs underneath: applying the tenant's rules to each query, serving from a per-tenant cache when one matches the query, and producing the export file when a user asks for one. In those test builds, each of those lived in application code, so every new chart or query meant someone checking the tenant filter again.

On the platform path, you keep models, dashboard code and the server-side token call; the platform runs the part that runs on every request.

The trade-off cuts both ways, and we won't pretend otherwise. Writing it into your app gives you full ownership, no third-party dependency and no vendor bill. You also keep the tenant filter, the CSV route and whatever caching you add when load arrives, for as long as the product exists. Building on a platform means adopting a vendor, learning its Cube data-modelling conventions and accepting its pricing. In return, enforcement sits below your presentation layer rather than in code your reviewers have to re-read for every new query.

Claude writes both columns competently. The useful question is which column's maintenance you'd sign up for after the dashboard ships.

What the Boilerplate's CLAUDE.md and Skills Give Claude Code

Setting up the boilerplate Claude Code reads takes one command:

git clone https://github.com/embeddable-hq/remarkable-pro-boilerplate.git

The repo is public and MIT-licensed. It pulls in Remarkable Pro (@embeddable.com/remarkable-pro), the component library your charts render with, and it carries two things Claude Code reads when it works in the project. CLAUDE.md holds the project rules: how models are named, where files live and which conventions a dashboard should follow. The .claude/skills folder holds four task skills (build-component, create-models, dashboard-as-code and theming), and each one gives Claude Code focused instructions for a single kind of job.

If you've used Claude Code on a personal project, you'll recognise the discipline. Teams that get dependable output write their style rules into project memory, make tests mandatory and stop re-explaining the project in every prompt. We built the boilerplate on the same idea. The difference is what the rules point at: Cube data models, dashboard definitions and the platform's conventions, not your formatting preferences. So a prompt for a new chart usually lands as a model plus a dashboard file, not as a new route inside your app.

These are instructions Claude Code usually follows, not constraints it's forced to obey. Hooks or validation in your pipeline turn them into hard checks.

That doesn't weaken the case for them. Instructions that live in the repo are what make Claude Code dependable when it works there, and this repo already has them written for customer-facing dashboards. You can build dashboards with AI using the dashboard-as-code skill and see the workflow end to end.

From Prompt to Data Models to Dashboard as Code, Then Published

Here's the path we'd run on a fresh clone. If you want the case for dashboards as code itself, that post covers it; this one shows what Claude Code does with it.

  1. Open the repo and prompt for models first. Start Claude Code in the boilerplate's root so it reads CLAUDE.md and the skills. Then ask for the data layer before any charts:

    Using the create-models skill, model our `events` table.
    I need a count of events, a monthly time dimension, and a
    filter so each tenant only ever sees rows matching its tenant_id.
    Cache monthly counts.
  2. Review the .cube.yml it writes. This file is where your definitions live, so read it the way you'd read a migration. Expect something close to this:

    cubes:
      - name: events
        sql: >
          SELECT * FROM public.events
          WHERE tenant_id = '{COMPILE_CONTEXT.securityContext.tenantId}'
        measures:
          - name: count
            type: count
        dimensions:
          - name: created_at
            sql: created_at
            type: time
        pre_aggregations:
          - name: monthly_counts
            measures: [CUBE.count]
            time_dimension: CUBE.created_at
            granularity: month
            refresh_key:
              every: 1 hour

    The tenant rule is a single WHERE clause bound to the security context. You don't write a filter in a route handler and hope every new endpoint remembers it; Cube compiles the model once per security context, so every query a tenant runs carries that clause. The pre_aggregations block is your caching, declared rather than coded. With the Cube Embeddable runs for you, the platform builds it per tenant: on demand by default, or on your refresh_key schedule once you set up the Caching API. If the measure is wrong here, every chart built on it is wrong too, which is exactly why we review this file before anything else.

  3. Ask for the dashboard on top of those models. Prompt with something like "Using the dashboard-as-code skill, build a usage dashboard on events.count by month." Claude Code writes an .embeddable.yml file. Treat the excerpt below as illustrative of its shape, and check the current schema in the dashboard-as-code docs:

    name: Customer usage
    widgets:
      - component: BarChart
        title: Events per month
        measures: [events.count]
        dimensions: [events.created_at]

    It references the model by name and nothing else. No SQL, no tenant logic.

  4. Push, then publish. From the repo:

    npm run embeddable:build
    npm run embeddable:push

    This sends your models and dashboard definition to Embeddable, where you publish the dashboard to the environment your app embeds from.

The path on a fresh clone: models first, reviewed like a migration, then the dashboard as code, then push and publish.

Notice what landed in your pull request. Two files, both readable, both diffable.

Your app didn't gain a tenant filter, a cache layer or a refresh job. Those are declarations in the model that the platform applies, and they get reviewed like any other code change.

Embedding the Dashboard with a Tenant-Scoped Token Minted Server-Side

A user from Acme Logistics signs in to your product. Before their browser draws a single chart, your server has already told the analytics layer which customer is asking.

That handshake is one call to the Tokens API, made from your backend with your API key and never from the browser:

const res = await fetch('https://api.us.embeddable.com/api/v1/security-token', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EMBEDDABLE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    embeddableId: DASHBOARD_ID,
    securityContext: { tenantId: session.tenantId },
    expiryInSeconds: 3600, // one hour, set on purpose
    user: session.userEmail,
    // dataProvider: 'acme-cube', // only if you run your own Cube
  }),
});
const { token } = await res.json();

The front end receives the token and nothing else:

<em-beddable token="{{ token }}"></em-beddable>

The default token lifetime is 7 days (Embeddable Tokens API). We'd rarely leave it there; match the expiry to your own session length so access ends when the login does.

The securityContext is what the row-level security (RLS) rules in your Cube models read. A rule matching tenant_id to securityContext.tenantId is added to every query that token makes, so Acme's charts return only Acme's rows wherever the rule covers the relevant tables.

Caching follows the same key: both the query results cache and the pre-aggregations are scoped by security context, so one tenant's cached answer isn't served to another. If you bring your own Cube deployment instead of the one Embeddable runs for you, the dataProvider field points the token at it. Because the tag is a web component, it works in React, Vue, Svelte or plain HTML.

We've written more on keeping each tenant's data apart at scale. For this walkthrough, the essential point is how little lives in your app: the rules sit in your models, and one server call decides which customer they apply to and for how long.

Which Path to Choose: Let Claude Write It Into Your App, or Build on a Platform

Both paths start with the same prompt. They split on what you're signing up to run afterwards.

Let Claude Code write it straight into your app when:

  • the scope is narrow: one internal-feeling view, a few tenants, no exports
  • your team accepts owning the tenant filter, rendering, exports and caching indefinitely
  • avoiding a third-party dependency matters more than offloading that work

If you take that path and already have the data layer, Claude Code can install EmKit (npm install em-kit, for React 19.1.1 or later), Embeddable's open-source React chart components, instead of drawing charts as plain divs; the tenant filter and caching stay yours.

Have Claude Code build on a customer-facing analytics platform when:

  • every customer must see only its own data, enforced on every query
  • customers expect exports and fast loads as usage grows
  • customers will want reports you didn't build
Both paths start with the same prompt; they split on what you're signing up to run afterwards.

A customer-facing analytics platform is a third-party platform built for embedding analytics in your product. Embeddable is one, and it's ours. You'd adopt its Cube data-modelling conventions and its pricing, and you'd still own the models, the dashboard code and the server-side token integration. You stop owning the layer underneath. After launch, Custom Canvas lets customers build their own reports within the limits your models set.

For the wider question, see how we think about whether to build or buy customer dashboards; it's a different choice from picking among prompt-to-dashboard tools.

We'd put it plainly: if you wouldn't choose to maintain tenant filtering, rendering, exports and caching for every customer indefinitely, have Claude Code build on a platform that does.

Frequently asked questions

Can Claude Code build a dashboard my customers can use?

Yes. Claude Code can write the queries, the charts and a tenant filter straight into your app. The harder part comes after it ships: tenant filtering, chart rendering, exports and caching, which your team owns from then on, for every customer, unless a platform enforces them underneath.

How do I keep each customer's data separate in a dashboard built with Claude Code?

Declare row-level security rules in your data models, then mint an embed token on your server that carries each tenant's securityContext, so every query is scoped to that tenant. Mint it server-side, never in the browser, because the token decides which customer the rules apply to and for how long.

How long does an Embeddable embed token last?

Seven days by default, according to Embeddable's Tokens API. Set a shorter expiry on the token request when your server mints it: match it to your own session length, for example one hour, so a customer's access to the dashboard ends when their login does rather than days later.

What is the difference between Claude's own dashboards and a customer-facing dashboard?

Claude's dashboards serve you and your own organisation: if the dashboard is only for you and your plan includes Claude Data, that is enough. A customer-facing dashboard ships inside your product, where each customer sees only its own data, so it also needs tenant isolation, exports and caching that hold up for every customer.