Kizaki
ReferenceTypeScript

TypeScript Packages

Where each generated and runtime package fits in your application.

Kizaki exposes five TypeScript packages. Each has one job.

Package Map

PackageKindRuns onPurpose
@kizaki/schemaGeneratedServer + BrowserTyped entity objects and field references from your .inspire schema
@kizaki/sdkRuntimeServerQuery builders, context, transactions, file storage, email, payments
@kizaki/clientGeneratedBrowserAsync RPC stubs for @expose server functions
@kizaki/sdk/browserRuntimeBrowserBrowser query builders, live subscriptions, presence, broadcast
@kizaki/reactRuntimeBrowser (React)React hooks for live queries, mutations, presence, broadcast

Two sub-paths provide authentication:

PathRuns onPurpose
@kizaki/sdk/authBrowserLogin, signup, logout, OAuth, account linking
@kizaki/sdk/auth/reactBrowser (React)useAuth hook and AuthGate component

Quick Lookup

TaskImport 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

  1. A component calls useQuery() from @kizaki/react with a query built from @kizaki/sdk/browser and an entity from @kizaki/schema.
  2. A user action triggers useMutation(), which invokes a function from @kizaki/client.
  3. On the server, the @expose function uses @kizaki/sdk to run queries and return a result.
  4. 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 @expose functions 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

On this page