Ship an internal app in one deploy. Sign-in and data included.
Build the BI app your team needs, from dashboards to workflows and approvals, as a Next.js app in your workspace repo. The SDK handles sign-in, sessions, warehouse queries and metrics, and segmentstream deploy puts it online. Your agent writes it and you open the link.
Get started
$ npm install @segmentstream-cloud/appAt a glance
- Next.js App Router, version 16 or later
- Sign-in with PKCE; 5-minute ES256 session tokens, rotating refresh
- Apps never hold warehouse or identity-provider credentials
- Apache-2.0
What it does
Sign-in in three files
Three files and every page is behind SegmentStream sign-in. Only members of the workspace's organization get in; the app never handles their credentials.
// src/segmentstream.ts
export const segmentstream = createSegmentStreamApp({
workspaceId: "your-workspace-id",
organizationId: "your-organization-id",
});
// src/proxy.ts
export const proxy = segmentstream.proxy({ publicPaths: ["/health"] });
// src/app/api/segmentstream/[...path]/route.ts
export const { GET, POST } = segmentstream.handlers();Know who is visiting
Read who is visiting in any Server Component, Route Handler or Server Function.
export default async function Page() {
const user = await segmentstream.requireUser();
return <p>Signed in as {user.email ?? user.id}</p>;
}Query the warehouse
Read-only SQL over the workspace warehouse, with typed named parameters. Queries run with the workspace's identity; the browser never sees a key.
const { rows } = await segmentstream.warehouse.query<Revenue>(
`SELECT order_date, total_revenue
FROM gold.revenue_summary
WHERE order_date >= @from
ORDER BY order_date`,
{ params: { from: sql.date("2026-09-01") } },
);Metrics without SQL
Ask for measures and dimensions instead of writing SQL. Every app, report and agent gets the same definition of spend.
const { rows } = await segmentstream.semantic.query("advertising", {
dimensions: ["platform"],
measures: ["spend", "clicks"],
dateRange: { from: "2026-09-01", to: "2026-09-30" },
filters: [{ dimension: "currency", operator: "equals", value: "USD" }],
});Big queries without timeouts
Estimate a query before running it, and resume long queries from a later request instead of holding one open.
const estimate = await segmentstream.warehouse.dryRun(query);
try {
return await segmentstream.warehouse.query(query, { timeoutMs: 20_000 });
} catch (error) {
if (error instanceof SegmentStreamApiError && error.queryId) {
return segmentstream.warehouse.result(error.queryId); // poll later
}
throw error;
}Act as the member
The session token works on the whole SegmentStream API with the visitor's own role, so an app can do anything that person may do and nothing more.
const response = await segmentstream.fetch(
`/api/v1/workspaces/${user.workspaceId}/warehouse/datasets`,
);Durable workflows
Long-running work such as exports, syncs and approvals runs as durable workflows with retries, inside the same app.
export async function exportReport(input: { month: string }) {
"use workflow";
const rows = await loadRows(input.month);
return deliver(rows);
}
async function loadRows(month: string) {
"use step";
// queried once, retried on failure
}Deploy with one command
segmentstream deploy builds the app remotely and prints its URL. You don't need a hosting account, a server or copied secrets. Every pull request gets a preview.
$ segmentstream deploy
▸ building app · pipeline · connections
▸ app ready at https://acme-analytics.segmentstream.appThe rest of the surface
Your company’s context, ready for every agent.
$ segmentstream workspace create acme --region eu
▸ workspace ready · data, objects, metrics and access rules in one place
▸ connect Claude, ChatGPT or Cursor with one connector
▸ tell your agent: “add our billing API as a source”
Our engineers build the first version on your data in two weeks, at a fixed price.
Or join the waitlist for self-serve:
Pilots are open now. Self-serve opens to the waitlist this fall.