---
title: "Client types"
description: "The browser client types exported by comark-content/client."
canonical_url: "https://content.comark.dev/reference/types/client"
---
# Client types

> The browser client types exported by comark-content/client.

The types describing the browser-safe Content client and its options.

## `ContentFetch`

The fetch signature the [client](https://content.comark.dev/reference/client/create-content-client) uses for every request.

```ts
type ContentFetch = <T = unknown>(url: string, options?: Record<string, any>) => Promise<T>
```

## `ContentClient`

The browser client returned by [`createContentClient()`](https://content.comark.dev/reference/client/create-content-client).

```ts
interface ContentClient {
  get<Data = Record<string, any>>(path: string): Promise<ContentFile<Data> | null>
  list<Data = Record<string, any>>(sources?: string[]): Promise<ContentListFile<Data>[]>
  navigation(): Promise<NavigationItem[]>
  hooks: Hookable<ContentClientHooks>   // local read:after bus; nothing crosses HTTP
  callReadHook(operation: ContentReadOperation, input: ContentReadInput, result: unknown): Promise<void>
}

interface ContentClientHooks {
  'read:after': (ctx: ContentReadContext) => void | Promise<void>
}
```

`read:after` carries the same [`ContentReadContext`](https://content.comark.dev/reference/types/content#contentreadcontext) and tags as the server instance for the same read. Client plugins call `callReadHook()` after their fetch resolves.

## `ContentClientOptions`

Options for [`createContentClient()`](https://content.comark.dev/reference/client/create-content-client#options).

```ts
interface ContentClientOptions {
  baseURL?: string          // default '' (same-origin)
  basePath?: string         // default '/api/content'
  fetch?: ContentFetch
  hooks?: NestedHooks<ContentClientHooks>
}
```

::note
The instance name is the optional **first argument**, not an option:
`createContentClient('blog', { … })`. Same shape as
[`comarkContent()`](https://content.comark.dev/reference/content/comark-content).
::

## `ContentClientWithOptions`

The client as a client plugin's `setup` sees it: [`ContentClient`](#contentclient) plus its resolved `options`.

```ts
interface ContentClientWithOptions extends ContentClient {
  options: { baseURL: string; basePath: string; fetch: ContentFetch }
}
```


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
