# Installation

URL: https://developers.uidu.org/docs/foundations/installation

> Install @uidu/client and configure tokens.

## Install the packages

```bash
npm install @uidu/client
# or
yarn add @uidu/client
# or
pnpm add @uidu/client
```

If you're using React, also install the bindings:

```bash
npm install @uidu/react
```

Both packages publish `"sideEffects": false` and are fully tree-shakable — only the functions you import end up in your bundle.

## Configure tokens

A site needs a **public token** (*Workspace → Settings → Public tokens*, safe in the browser) and,
for anything that writes or reads private data, an **API key** (*Workspace → Settings → API keys*,
server only). [Authentication](https://developers.uidu.org/docs/foundations/authentication.md) explains which to use where.

A typical `.env`:

```bash
UIDU_WORKSPACE=acme
UIDU_PUBLIC_TOKEN=pk_live_...
UIDU_API_KEY=sk_live_...     # server only
UIDU_PROJECT_ID=Z2lkOi8v...   # legacy Projects CMS only
```

## Verify the install

```ts
import { createClient } from '@uidu/client';

const client = createClient({
  workspace: process.env.UIDU_WORKSPACE!,
  publicToken: process.env.UIDU_PUBLIC_TOKEN!,
});

const ping = await fetch(client.endpoint).then((r) => r.status);
console.log(ping); // 200 if reachable, 401 if token is wrong
```

<Callout type="info">
  The endpoint resolves to `https://{workspace}.uidu.org/graphql` by default. Override with the `endpoint` option for local Rails dev (`http://localhost:3000/graphql`).
</Callout>

Continue with the [quickstart](https://developers.uidu.org/docs/paths/public-website.md).
