Draft — review before publishing. Claude’s Artifacts environment and the exact capabilities of the React sandbox (which libraries are available, how secrets are handled) evolve regularly. The prompt pattern below is stable; specific library imports and auth shapes may need a light update when you actually build this. Confirm against the latest Artifacts documentation before sharing.
The pattern
You’ll feed Claude three things in the prompt:- What the dashboard should show. “Last 90 days of grocery spending, grouped by week, as a line chart.”
- How to get the data. The Breadbox API endpoint (
/api/v1/transactions) with the right filter parameters, plus an API key. - How you want it rendered. React component, specific library preferences (Recharts, Tremor, plain HTML), any styling hints.
An example prompt
Iterating on it
The prompt above is a starting point. Typical follow-up prompts once you have v1:- “Add a date-range picker at the top so I can change the window.”
- “Split the weekly line chart by user — one line per household member.”
- “Add a tag filter — let me type a tag and recompute the totals.”
- “I don’t like Recharts. Rebuild this with Tremor.”
Using MCP instead of the REST API
If you’d rather not expose your API key to the Artifacts sandbox, you can have Claude reason over the data via MCP (inside the chat, not in the artifact) and then generate a static React component containing the data inline. You lose live refresh — the data is baked in — but you avoid putting a live key in a browser sandbox.What Claude is good (and not good) at
Good at:- Fetching, paginating, and aggregating JSON from a documented endpoint.
- Picking a chart library, writing the JSX, handling loading states.
- Iterating on layout and styling in response to feedback.
- Catching obvious gotchas (currency mixing, pending transactions) when you mention them.
- Guessing what you actually want without an explicit prompt. “Build me a dashboard” alone will give you something generic.
- Complex data transformations (joins across many endpoints, statistical analysis) — if you need that, do it in a separate step in the chat and then feed the aggregated result to the artifact.
- Authentication flows beyond a single API key header.
Self-hosting the result
Once you have a React component you like, you don’t have to keep using Artifacts. Drop the component into a Vite + React project (or a Next.js app, or even a single HTML file using the CDN builds of React + Recharts) and serve it wherever you want. Your Breadbox instance and the dashboard can run side by side on the same machine.Related reading
- API overview — the REST endpoints Claude is fetching from.
- Transactions API — the specific endpoint, all its filters and the response shape.
- On-demand analysis — for one-off questions where a full dashboard is overkill.