# API reference

> Every export of effect-atom-boundary and raf-effect-atom, with its signature and JSDoc, generated from the source.

## effect-atom-boundary

Typed error boundaries for Effect Atom: catch an atom's failures by tag, typed by the atom. [The full reference](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md).

| Export | Summary |
| ------ | ------- |
| [`TypeId`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#TypeId) | Literal type used as the boundary components' type identifier. |
| [`TagsOf`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#TagsOf) | The `_tag`s of an error union. |
| [`Unclaimed`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#Unclaimed) | The errors of `E` whose `_tag` isn't in `Tags`. |
| [`Variance`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#Variance) | Variance marker carrying the tags a boundary claims. |
| [`UnclaimedResult`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#UnclaimedResult) | An `AsyncResult`, or a union of them, typed without the errors whose `_tag` is in `Tags`: a failure with no error left is gone from the union, so a read whose failures are all claimed is typed as a success. |
| [`UseErrorBoundary`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#UseErrorBoundary) | A boundary's hook: takes the result a component read under the boundary, throws the failures this boundary and the boundaries above it claim, and returns the result typed without them. |
| [`CatchTagProps`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#CatchTagProps) | Props for a `catchTags` handler: the caught error, and `reset`. |
| [`CatchTags`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#CatchTags) | One optional handler per `_tag` of `E` (or per tag in `Tags`), each typed by the error with that tag. |
| [`ErrorsOf`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#ErrorsOf) | The error type of what a boundary's `errors` names: an `AtomRpc` client (the errors of every procedure), an `AtomHttpApi` client (the errors of every endpoint and its middleware), an atom, or an atom family. |
| [`AtomErrorBoundaryProps`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#AtomErrorBoundaryProps) | Props for an error boundary that catches one atom's failures by `_tag`. |
| [`AtomErrorBoundary`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#AtomErrorBoundary) | Provides an error boundary for one atom that renders a handler per `_tag` of the atom's error, typed by the error with that tag. |
| [`ErrorBoundaryComponent`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#ErrorBoundaryComponent) | A boundary component: renders the `catchTags` handler for the errors it claims and throws the rest to the boundaries above it. |
| [`ErrorBoundary`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#ErrorBoundary) | A boundary component and its hook, which narrows the results read under it, named freely by destructuring. |
| [`ErrorBoundaryOptions`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#ErrorBoundaryOptions) | Options for `createErrorBoundary`. |
| [`createErrorBoundary`](https://raf-effect-atom.katt.dev/docs/api-effect-atom-boundary.md#createErrorBoundary) | Creates a shared error boundary that claims some errors by `_tag`, returned as `[Boundary, useBoundary]`. |

## raf-effect-atom

Render-as-you-fetch for Effect Atom: start atoms from route loaders and stream them into the browser, typed failures intact. [The full reference](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md).

| Export | Summary |
| ------ | ------- |
| [`Source`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Source) | What the verbs start and `useAtomResult` reads: an atom family, a function from arguments to an `AsyncResult` atom such as an `AtomRpc` query, or an `AsyncResult` atom that takes no arguments. |
| [`ArgsOf`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#ArgsOf) | The arguments a source takes: a family's parameters, or none for an atom. |
| [`SuccessOf`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#SuccessOf) | The success type of a source's `AsyncResult`. |
| [`ErrorOf`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#ErrorOf) | The error type of a source's `AsyncResult`. |
| [`HandleKey`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#HandleKey) | A handle's serialization key, branded with its source. |
| [`Handle`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Handle) | An atom a loader started: its source's arguments, and the atom's serialization key. |
| [`LoadedHandle`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#LoadedHandle) | A handle from `Loader.ensure` or `Loader.fetch`: they waited for the result, so the component that reads it renders without suspending. |
| [`Hydration`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Hydration) | Streams a server registry into the browser's, typed failures intact, and hydrates it without requesting anything again. |
| [`Hydration.hydrated`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Hydration.hydrated) | Returns a serializable atom that keeps its hydrated value on its first read, instead of running its effect again. |
| [`Hydration.dehydrate`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Hydration.dehydrate) | Encodes a request registry's serializable atoms for the browser. |
| [`Hydration.hydrate`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Hydration.hydrate) | Applies dehydrated state to the browser's registry. |
| [`Loader`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader) | Starts atoms from route loaders, before anything renders, so nothing waterfalls. |
| [`Loader.SettledResult`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.SettledResult) | A settled `AsyncResult`: what `ensure` and `fetch` return. |
| [`Loader.LeaseTTL`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.LeaseTTL) | How long a loader's lease keeps an atom mounted when no component takes it over. |
| [`Loader.prefetch`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.prefetch) | Starts a source's atom without waiting for it, and returns its handle. |
| [`Loader.prefetchInBrowser`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.prefetchInBrowser) | Starts a source's atom in the browser, and returns its handle: on the server, it starts nothing, and the browser's read starts the atom. |
| [`Loader.ensure`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.ensure) | Starts a source's atom, waits only while it has no result, and returns a handle whose reader renders without suspending. |
| [`Loader.fetch`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.fetch) | Starts a source's atom, or refreshes it if it has a result, waits for the new result to settle, and returns a handle whose reader renders without suspending. |
| [`Loader.result`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.result) | Returns the settled result `ensure` or `fetch` waited for. |
| [`Loader.Loader`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.Loader) | The loader verbs as Promises over one registry, as the framework integrations put them on the router context. |
| [`Loader.MakeOptions`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.MakeOptions) | Options for `make`. |
| [`Loader.make`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#Loader.make) | Creates the Promise verbs over one registry. |
| [`RequestRegistry`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry) | A registry per server request. |
| [`RequestRegistry.Seed`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.Seed) | Prepares a request registry before the loader verbs start atoms in it, such as by setting an atom to the request's cookie. |
| [`RequestRegistry.InitialValues`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.InitialValues) | Atoms paired with the values a registry starts with, as `AtomRegistry.make`'s `initialValues` takes them: build each pair with `Atom.initialValue`. |
| [`RequestRegistry.Options`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.Options) | Options for `make`. |
| [`RequestRegistry.make`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.make) | Creates the registry for one server request. |
| [`RequestRegistry.settled`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.settled) | Waits until a request registry's seed has settled and every atom a verb started while it ran has started. |
| [`RequestRegistry.layer`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.layer) | A layer that provides a request registry as the `AtomRegistry`, disposed when the layer's scope closes. |
| [`RequestRegistry.isRequestRegistry`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RequestRegistry.isRequestRegistry) | Returns whether a registry was made by `make`, for one server request. |
| [`useAtomResult`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#useAtomResult) | Reads a handle through React Suspense, through the source that made it: a result streamed from the server, a hydrated one, or one a loader started. |
| [`useHandleValue`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#useHandleValue) | Reads a handle without React Suspense, through the source that made it, and returns the atom's current result as it is. |
| [`HydrationBoundaryProps`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#HydrationBoundaryProps) | Props for `HydrationBoundary`: the request's `registry` in a server component, or the `state` it dehydrated anywhere else. |
| [`HydrationBoundary`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#HydrationBoundary) | Hydrates the state a server registry dehydrated, streamed results included. |
| [`RegistryProvider`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#RegistryProvider) | Provides the app's registry: a request registry while the framework renders the app on the server, and one registry for the page's lifetime in the browser. |
| [`WaterfallMode`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#WaterfallMode) | What `useAtomResult` does in development when a read starts an atom that no loader, server component, event handler or `useWaterfall` started. |
| [`WaterfallDetection`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#WaterfallDetection) | Sets how `useAtomResult` reports request waterfalls in the tree below. |
| [`useWaterfall`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom.md#useWaterfall) | Starts a source's atom during render and returns its handle, for an input only a render knows, such as an id read from another atom's result. |

## raf-effect-atom/react-router

Connects the loader verbs to React Router's Framework Mode. [The full reference](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md).

| Export | Summary |
| ------ | ------- |
| [`RequestAtoms`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#RequestAtoms) | One request's registry, with the loader verbs over it. |
| [`AtomsContext`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#AtomsContext) | The router context `atomsMiddleware` sets: what `react-router`'s `createContext<RequestAtoms>()` returns. |
| [`MiddlewareArgs`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#MiddlewareArgs) | The parts of React Router's middleware arguments `atomsMiddleware` uses. |
| [`AtomsMiddlewareOptions`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#AtomsMiddlewareOptions) | Options for `atomsMiddleware`. |
| [`atomsMiddleware`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#atomsMiddleware) | Creates a root middleware that gives each server request its own registry, under the given router context. |
| [`clientAtomsMiddleware`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-react-router.md#clientAtomsMiddleware) | Creates a root client middleware that gives client loaders the browser's registry, under the context `atomsMiddleware` uses on the server. |

## raf-effect-atom/rsc

Connects the loader verbs to React Server Components, such as the Next.js App Router. [The full reference](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md).

| Export | Summary |
| ------ | ------- |
| [`RequestAtoms`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#RequestAtoms) | The loader verbs over the request registry of the server render in progress, with its registry. |
| [`makeRequestAtoms`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#makeRequestAtoms) | Creates the verbs and `getRegistry` over a request registry that `seed` prepares. |
| [`getRegistry`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#getRegistry) | Returns the request registry of the server render in progress. |
| [`prefetch`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#prefetch) | `Loader.prefetch` on the request's registry: starts a source's atom, to stream it, and returns its handle. |
| [`prefetchInBrowser`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#prefetchInBrowser) | `Loader.prefetchInBrowser` on the request's registry: returns a handle whose atom the browser's read starts, without starting it on the server. |
| [`ensure`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#ensure) | `Loader.ensure` on the request's registry: starts a source's atom, waits for its result, and returns its handle. |
| [`fetch`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#fetch) | `Loader.fetch` on the request's registry: starts or refreshes a source's atom, waits for the new result, and returns its handle. |
| [`run`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-rsc.md#run) | `Loader.Loader`'s `run` on the request's registry: runs an Effect that needs the registry, such as the Effect verbs in an `Effect.gen`. |

## raf-effect-atom/tanstack-router

Connects the loader verbs to TanStack Router and TanStack Start. [The full reference](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-tanstack-router.md).

| Export | Summary |
| ------ | ------- |
| [`DehydratedRouterAtoms`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-tanstack-router.md#DehydratedRouterAtoms) | The key `setupRouterAtoms` adds to the router's dehydrated state. |
| [`RouterAtomsOptions`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-tanstack-router.md#RouterAtomsOptions) | Options for `setupRouterAtoms`. |
| [`makeRegistry`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-tanstack-router.md#makeRegistry) | Creates the registry for one `getRouter` call: a request registry on the server, and in the browser a registry like `@effect/atom-react`'s `RegistryProvider` makes. |
| [`setupRouterAtoms`](https://raf-effect-atom.katt.dev/docs/api-raf-effect-atom-tanstack-router.md#setupRouterAtoms) | Provides a registry to a TanStack router's app and streams it from the server to the browser. |
