ReferenceTypeScript
TypeScript Packages
Where each generated and runtime package fits in your application.
Kizaki exposes five TypeScript packages. Each has one job.
Package Map
| Package | Kind | Runs on | Purpose |
|---|---|---|---|
@kizaki/schema | Generated | Server + Browser | Typed entity objects and field references from your .inspire schema |
@kizaki/sdk | Runtime | Server | Query builders, context, transactions, file storage, email, payments |
@kizaki/client | Generated | Browser | Async RPC stubs for @expose server functions |
@kizaki/sdk/browser | Runtime | Browser | Browser query builders, live subscriptions, presence, broadcast |
@kizaki/react | Runtime | Browser (React) | React hooks for live queries, mutations, presence, broadcast |
Two sub-paths provide authentication:
| Path | Runs on | Purpose |
|---|---|---|
@kizaki/sdk/auth | Browser | Login, signup, logout, OAuth, account linking |
@kizaki/sdk/auth/react | Browser (React) | useAuth hook and AuthGate component |
Quick Lookup
| Task | Import from |
|---|---|
| Server queries, mutations, business logic | @kizaki/sdk |
| Call a server function from the browser | @kizaki/client |
| Browser read queries | @kizaki/sdk/browser |
| Live data with React hooks | @kizaki/react |
| Reference a typed entity or field | @kizaki/schema |
| Auth (vanilla JS) | @kizaki/sdk/auth |
| Auth (React) | @kizaki/sdk/auth/react |
Request Flow
- A component calls
useQuery()from@kizaki/reactwith a query built from@kizaki/sdk/browserand an entity from@kizaki/schema. - A user action triggers
useMutation(), which invokes a function from@kizaki/client. - On the server, the
@exposefunction uses@kizaki/sdkto run queries and return a result. - The mutation completes, the live query refreshes, and the UI updates.
@kizaki/schema is the shared vocabulary across all layers.
Minimal Example
All five packages in a single feature:
// Browser component — uses @kizaki/react, @kizaki/sdk/browser, @kizaki/schema, @kizaki/client
import { useQuery, useMutation } from "@kizaki/react";
import { select } from "@kizaki/sdk/browser";
import { Project } from "@kizaki/schema";
import { createProject } from "@kizaki/client";
const projectsQuery = select(Project).orderBy(Project.createdAt, "desc");
function Projects() {
const { data, status } = useQuery(projectsQuery);
const create = useMutation(createProject, { invalidate: [projectsQuery] });
if (status === "loading") return <p>Loading...</p>;
return (
<>
<button onClick={() => create.mutate("New Project")}>New Project</button>
<ul>{data.map(p => <li key={p.id}>{p.name}</li>)}</ul>
</>
);
}// Server function — uses @kizaki/sdk, @kizaki/schema
import { query, insert, getPrincipal } from "@kizaki/sdk";
import { Project } from "@kizaki/schema";
/** @expose */
export async function createProject(name: string) {
const me = getPrincipal();
return query(insert(Project).values({ name, ownerId: me.id }).returning(Project.id));
}Generated vs. Runtime
Two packages are generated from your .inspire schema during compilation:
@kizaki/schema— regenerated on schema changes. Lives at.kizaki/build/schema/.@kizaki/client— regenerated when@exposefunctions change. Lives at.kizaki/build/client/.
The remaining packages (@kizaki/sdk, @kizaki/sdk/browser, @kizaki/react) are runtime libraries shipped with the platform. They do not change when your schema changes.
Never edit generated files by hand. The dev server regenerates them automatically.
Further Reading
- Schema reference — entity objects, field refs, row type inference
- SDK reference — query builders, context, transactions, files, email, payments
- Client reference — generated RPC functions
- Browser SDK reference — browser queries, subscriptions, presence
- React reference — hooks for live data and mutations
- Auth reference — login, signup, OAuth, account linking