# Call Uniform APIs on the server with the Next.js App Router SDK

> Recipe: get compositions, routes, project map nodes and the manifest on the server with the server-only clients of the Next.js App Router SDK.

Source: https://docs.uniform.app/docs/sdk/nextjs-app-router/server-clients

> **Developer Preview:**
>
> This page documents the developer preview of the SDK, version `20.81.1-alpha.25.sha-f076f9b857`.

**Task:** get data from a Uniform API in a Server Component, a Route Handler or a Server Action, with the Next.js data cache.

The SDK has server-only clients that are configured for the Next.js data cache:

```ts
import {
  getCompositionDeliveryClient,
  getManifest,
  getManifestClient,
  getProjectMapClient,
  getRouteClient,
} from "@uniformdev/next-app-router";
```

```ts
import { CANVAS_PUBLISHED_STATE } from "@uniformdev/canvas";
import { getCompositionDeliveryClient, getManifest, getProjectMapClient } from "@uniformdev/next-app-router";

// Get a composition by its ID
const composition = await getCompositionDeliveryClient({ state: CANVAS_PUBLISHED_STATE }).get({
  compositionId: "abc123",
  state: CANVAS_PUBLISHED_STATE,
});

// Get the published Context manifest
const manifest = await getManifest({ state: CANVAS_PUBLISHED_STATE });

// Get the project map nodes, with the Next.js default fetch cache
const { nodes } = await getProjectMapClient({ cache: { type: "default" } }).getNodes({});
```

Each getter takes one of these options:

| Option | Cache |
| --- | --- |
| `{ cache: { type: "force-cache" } }` | The `fetch` cache mode that you set. `{ type: "revalidate", interval: 60 }` revalidates after 60 seconds. |
| `{ state }` | `no-cache` for the draft and editor states, `force-cache` for published. |
| `{ searchParams, draftModeEnabled }` | `no-cache` in draft mode, in visual editing and in development, else `force-cache`. |

The route, composition and manifest clients add [cache tags](https://docs.uniform.app/docs/sdk/nextjs-app-router/caching#cache-tags), so the webhook handler can revalidate them. The project map client adds no tags. These clients import `server-only`. You cannot use them in client components. For the methods, refer to [Route Client](https://docs.uniform.app/docs/sdk/route-client) and [Project Map Client](https://docs.uniform.app/docs/sdk/project-map-client).

`getCanvasClient` is deprecated. Use `getCompositionDeliveryClient`.
