Client SDK

@gencow/client — runtime behind codegen and @gencow/react (not imported in typical app code)

@gencow/client is the framework-agnostic runtime Gencow installs as a dependency. Application code does not import it directly in the usual flowgencow codegen writes gencow/api.ts with imports from @gencow/client, and `@gencow/react` hooks call those generated defs. Install it alongside @gencow/react; import hooks and api in your app, not @gencow/client procedure helpers.

npm install @gencow/client

For React apps, also install @gencow/react:

npm install @gencow/client @gencow/react

Versions: @gencow/client and @gencow/react share the same semver and are published together.

Choose your stack

App type Install What you import in app code
React (default) @gencow/client + @gencow/react Generated api + hooks from @gencow/react
No UI framework @gencow/client only Generated api only (api.*._fetch(...))
TanStack Query (planned) @gencow/client + @gencow/tanstack-query Generated api + TanStack adapters (do not mix with built-in useQuery)

Generated api.ts

gencow dev / gencow codegen emits gencow/api.ts (or src/gencow/api.ts) with imports from @gencow/client:

import { defineProcedureQuery, defineProcedureMutation } from "@gencow/client";
import type * as Operations from "./operations.d.ts";

export const api = {
  tasks: {
    list: defineProcedureQuery<Operations.TasksListOutput>("tasks.list", { allowAnonymous: true }),
    create: defineProcedureMutation<Operations.TasksCreateOutput>("tasks.create"),
  },
} as const;

Do not edit this file manually. Codegen adds the @gencow/client imports; your app imports api and (for React) hooks from @gencow/react.

Auth (no React)

import { createAuthClient } from "@gencow/client";

export const auth = createAuthClient(import.meta.env.VITE_API_URL);

await auth.signIn("[email protected]", "password");
const state = auth.store.getState();

React apps typically use `createAuthClient` from `@gencow/react`, which adds useAuth().

Realtime helpers (internal)

buildQuerySubscriptionKey, createInvalidationRefetchScheduler, and authorizeRealtimeQuery live in @gencow/client for @gencow/react hooks (for example useQuery({ realtime: true })). Do not import them in application code.

Procedure RPC (internal)

The procedure wire codec (@gencow/client/procedure-rpc) is not for application imports. Generated api.ts uses it indirectly through defineProcedureQuery / defineProcedureMutation; the server uses the same codec for unified RPC routes. @gencow/react/procedure-rpc is deprecated and only re-exports @gencow/client/procedure-rpc for legacy tooling.

Next Steps