Callsheet
Reference

Packages and Imports

What each Callsheet package does and when to use it.

@callsheet/react-query

The main package for React Query apps. It provides everything you need to define calls and use them in components.

import {
  defineCalls,
  query,
  mutation,
  queryOptions,
  useMutation,
} from '@callsheet/react-query';

Includes call builders (query, mutation), React Query helpers (queryOptions, useMutation), and the adapter that connects Callsheet to React Query.

@callsheet/swr

The main package for SWR apps. It provides everything you need to define calls and use them in SWR components.

import {
  defineCalls,
  query,
  mutation,
  useQuery,
  useMutation,
} from '@callsheet/swr';

Includes call builders (query, mutation), SWR hooks (useQuery, useMutation, usePreload), and the adapter that connects Callsheet to SWR.

@callsheet/codegen

Build-time package for generating a calls module from typed sources like GraphQL documents and ts-rest contracts.

Install as a dev dependency. You do not import from this package in your app components.

callsheet.config.ts
import { defineConfig } from '@callsheet/codegen';

export default defineConfig({
  sources: {
    /* ... */
  },
  output: {
    adapter: 'react-query',
    file: './src/generated/calls.ts',
  },
});

For the full config reference, see Codegen Config.

@callsheet/ts-rest

Provides query and mutation wrappers for manually defining calls from ts-rest contract routes.

Install as a runtime dependency, only if you use ts-rest.

import { query, mutation } from '@callsheet/ts-rest';

Skip this package if you're using code generation to build calls from a ts-rest contract, @callsheet/codegen handles the wiring for you.

You only need this package when wrapping ts-rest routes by hand with a defineCalls block.

For more on the ts-rest workflow, see Using Callsheet with ts-rest.

@callsheet/core

The shared lower-level package that powers both adapters. Most app code should import from @callsheet/react-query or @callsheet/swr instead.

You typically do not need to install or import from @callsheet/core directly.

On this page