Every screen reads sample data from typed TypeScript files. Connect your API one screen at a time and keep the sample data for screens you haven't connected yet.
1. Find what the screen reads
Open the screen's file and follow its imports from lib/data.ts and lib/data-ops.ts. Some table and list components import sample data themselves; note those too.
For example, the /runs screen shows Run records. A Run has these fields: id, suite, branch, commit, author, trigger, status, passed, failed, flaky, total, durationMs, started, env, browser.
2. Keep the kit's types
If your API returns a different shape, write one small mapping function from your shape to the kit's type instead of changing every component:
import type { Run } from "@/lib/data";
// Map one record from your API to the kit's Run type.
export function toRun(api: ApiRecord): Run {
return {
id: String(api.id),
// …one line per field the screen uses
} as Run;
}3. Load the data
Next.js edition
Pages are server components, so they can await data directly. Keep secrets in server environment variables.
// app/(app)/runs/page.tsx
async function getRuns(): Promise<Run[]> {
const res = await fetch(`${process.env.API_URL}/runs`, { cache: "no-store" });
if (!res.ok) throw new Error("Could not load runs");
return res.json();
}
export default async function Page() {
const runs = await getRuns();
// pass runs to the table or list component as a prop
}Client components (files that start with "use client") can't await. Give them their data from the page instead.
React + Vite edition
Use a React Router loader, so data loads before the screen renders:
// src/routes.tsx
{ path: "runs", lazy: () => import("./pages/runs/index").then((m) => ({ Component: m.default, loader: m.loader })) },
// src/pages/runs/index.tsx
export async function loader() {
const res = await fetch(`${import.meta.env.VITE_API_URL}/runs`);
if (!res.ok) throw new Response("Could not load runs", { status: res.status });
return (await res.json()) as Run[];
}
// in the component: const runs = useLoaderData() as Run[];TanStack Query or SWR work too. Everything in a Vite app runs in the browser, so never put secret keys in VITE_ variables. Call your own backend, which holds the secrets.
4. Pass the data in as a prop
Give the table or list component the data as a prop instead of letting it import the sample file. Other screens keep using sample data until you connect them.
5. Handle loading, empty and error states
Use EmptyState from components/patterns/empty-state for empty and error states, and Skeleton from components/ui/misc while loading.
6. Wire up actions
Interactive pieces (approvals, toggles, bulk actions) keep their state locally and call toast(...) where a real app would call your API. Replace each of those with your API call, and keep a toast for the result, such as "Saved" or "Couldn't save: …".
See the integration guides for field mappings from common tools to the kit's types.