---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://segmentstream.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Ship the app your team opens. Sign-in, roles and data included.

@segmentstream/app · app/

Sign-in, members, permissions, the ontology client and warehouse access for the Next.js app in app/. Your agent writes the screens; the SDK signs people in, keeps the pages you choose public and calls the ontology as the signed-in person.

[Start a pilot](https://segmentstream.com/enterprise#pilot) · [Request access](https://segmentstream.com/developers/app-sdk#waitlist)

Get started

app/

```
 $ npm install @segmentstream/app
```

At a glance

- Next.js App Router 16 or later, React 19
- Email-code sign-in for invited members, sign-up you open, and public pages
- At your-name.segmentstream.app or your own domain
- Records as the signed-in member, typed from your ontology
- The app holds no database or warehouse credentials

## What it does

01

### Set up in three files

Configure the app once with the type of your ontology. Every page asks for sign-in except the publicPaths anyone may open, such as a landing page or a public form; a path covers the paths under it, and '/' opens the whole app. The ontology is imported as a type only.

app/src

```
 // src/segmentstream.ts import { createSegmentStreamApp } from "@segmentstream/app";  import type ontology from "../../ontology"; import link from "../segmentstream.json";  export const segmentstream = createSegmentStreamApp<typeof ontology>(link);  // src/proxy.ts export const proxy = segmentstream.proxy({ publicPaths: ["/welcome", "/apply"] });  // src/app/api/auth/[...path]/route.ts export const { GET, POST, PUT, DELETE, PATCH } = segmentstream.authHandlers();
```

02

### Email-code sign-in

People you invite sign in with a six-digit code, or a link the first time. Where the ontology's signUp opens email sign-up, anyone may sign up with the roles it names; otherwise they are asked to request an invitation, and nothing is sent. The form shows your words, in your app's language.

app/src/components/sign-in-form.tsx

```
 "use client";  import { SignIn, type SignInTexts } from "@segmentstream/app/ui";  const texts: SignInTexts = {   title: "Sign in",   continue: "Continue",   signedInAs: (email) => `Signed in as ${email ?? "you"}.`,   errors: { not_invited: "Ask your administrator for an invitation.", /* … */ },   // …every word the form shows };  export function SignInForm() {   return <SignIn texts={texts} />; }
```

03

### Who is signed in, and what they may do

Read the member and their roles in server code, and hide controls they may not use. The ontology checks every call again.

app/src/app/leads/\[id]/page.tsx

```
 const user = await segmentstream.requireUser(); // { id, email, name, roles, permissions, ... }  <Can permission="lead:changeStatus" fallback={lead.status}>   <ChangeStatusForm lead={lead.id} /> </Can>
```

04

### Records through the ontology

Find, get, history and actions on every entity, typed from your ontology, as the signed-in member.

app/src/app/leads/page.tsx

```
 const { items, nextCursor } = await segmentstream.ontology.lead.find({   where: { status: { in: ["new", "contacted"] } },   orderBy: [{ field: "createdAt", direction: "desc" }],   include: { owner: true },   limit: 20, });  const { result, validation } = await segmentstream.ontology.lead.actions.changeStatus(   { lead: id, status: "contacted" }, );
```

05

### Warehouse data and metrics

Read-only SQL over the workspace warehouse with named parameters, and totals from the metrics declared in your ontology.

app/src/app/revenue/page.tsx

```
 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") } }, );  const totals = await segmentstream.ontology.order.queryMetrics({   dimensions: ["customer.segment"],   metrics: ["orders"],   dateRange: { from: "2026-09-01", to: "2026-09-30" }, });
```

06

### Deploy with one command

segmentstream deploy builds the app with the rest of the workspace and puts it online at your-name.segmentstream.app, or at your own domain once app/domains.json names it. You don't need a hosting account, a server or copied secrets.

terminal

```
 $ segmentstream deploy
```

Inside SegmentStream

## An app built with the App SDK.

SegmentStream HQ, the app our company runs on: sign-in, records and queries through the App SDK, as the signed-in person.

hq.segmentstream.app

![SegmentStream HQ, the deals pipeline: Lead, Qualification and Opportunity columns with each deal's company, contact, owner, amount and close date](https://segmentstream.com/screens/dark/hq-deals.webp)

SegmentStream HQ, the app we run our own company on: a Next.js app in app/, on the ontology in ontology/.

## The rest of the surface

[Ontology SDK](https://segmentstream.com/developers/ontology-sdk)

[@segmentstream/ontology](https://segmentstream.com/developers/ontology-sdk)

[Entities, actions and roles; REST, OpenAPI and MCP from one model](https://segmentstream.com/developers/ontology-sdk)

·

[Pipeline SDK](https://segmentstream.com/developers/pipeline-sdk)

[segmentstream-pipeline (Python)](https://segmentstream.com/developers/pipeline-sdk)

[Connections, ingestion, models, checks and schedules in Python](https://segmentstream.com/developers/pipeline-sdk)

·

[Agent SDK](https://segmentstream.com/developers/agent-sdk)

[@segmentstream/agent](https://segmentstream.com/developers/agent-sdk)

[The company agent: ontology tools as the member, in your team’s channels](https://segmentstream.com/developers/agent-sdk)

·

[CLI](https://segmentstream.com/developers/cli)

[segmentstream](https://segmentstream.com/developers/cli)

[Workspaces, deploys, members, jobs and data from the terminal](https://segmentstream.com/developers/cli)

·

[MCP and API](https://segmentstream.com/developers/mcp)

[/mcp and /api/ontology on every app](https://segmentstream.com/developers/mcp)

[REST, OpenAPI and MCP on every app, per caller](https://segmentstream.com/developers/mcp)

[Developer overview →](https://segmentstream.com/developers)

## Build your company’s own software. Let agents run it.

$ segmentstream workspace create acme --region eu --subdomain acme

▸ Created workspace acme · database, warehouse and a private git repository

$ segmentstream workspace WORKSPACE-ID clone acme && cd acme

▸ your coding agent builds what your team asked for and runs the checks

$ git add -A && git commit -m "First version"

$ segmentstream deploy

▸ app, company agent, API and MCP tools live for your invited members

[Start a pilot](https://segmentstream.com/enterprise#pilot)

Our engineers build the first version on your data in two weeks, at a fixed price.

Or build it yourself with your coding agent:

`curl -fsSL https://segmentstream.com/install.sh | sh`

Work email

We’ll email you product updates, tips and onboarding help. Unsubscribe anytime.
