> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Platform SDK overview

> The SDK for platforms built on Base44, published as @base44/platform.

> [!WARNING]
>
> The Platform SDK is in beta and is for [white-label](https://docs.base44.com/developers/white-label/overview.md) platforms that run Base44 inside their own product. Ask your onboarding contact to turn it on for your workspace.

The Platform SDK is the package a platform uses to put Base44's app editor and its AI chat inside its own product. Your builders' browsers use it to follow each build as it happens, and your server uses it to receive and verify Base44's webhooks.

> [!TIP]
>
> Building inside one Base44 app, with its entities, functions, and users? Use the [App SDK](https://docs.base44.com/developers/references/sdk/getting-started/overview.md) instead. See [Base44 SDKs](https://docs.base44.com/developers/references/sdks/overview.md) to compare the two.

## Entry points

The Platform SDK has three entry points:

* **`@base44/platform`**: [`createPlatformClient()`](https://docs.base44.com/developers/references/platform-sdk/docs/functions/createPlatformClient) opens the browser connection, and its [`chat`](https://docs.base44.com/developers/references/platform-sdk/docs/interfaces/chat) module follows the AI chat of up to eight apps over one connection.
* **`@base44/platform/react`**: [`useChat()`](https://docs.base44.com/developers/references/platform-sdk/docs/functions/useChat) runs the whole AI chat for one app in your own UI. It's headless, so your components render the conversation.
* **`@base44/platform/server`**: [`createPlatformServer()`](https://docs.base44.com/developers/references/platform-sdk/docs/functions/createPlatformServer) gives your backend the [`webhooks`](https://docs.base44.com/developers/references/platform-sdk/docs/interfaces/webhooks) module, which verifies and handles the events Base44 sends.

## Installation

Install the Platform SDK via npm:

```bash theme={null}
npm install @base44/platform
```

`@base44/platform/react` needs React 18 or later in your app.

## Quick start

Your server keeps the workspace credential. The browser calls your own API routes, and your server calls the [Apps API](https://docs.base44.com/developers/references/apps-api/get-started/overview.md) for it, so no credential reaches the browser.

Pass `useChat()` the functions that reach Base44 through your backend, and render what it returns:

```tsx theme={null}
import { useState } from "react";
import Markdown from "react-markdown";
import { useChat, type ChatBackend } from "@base44/platform/react";

async function post<T>(path: string, body: unknown): Promise<T> {
  const response = await fetch(path, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(body),
  });
  if (!response.ok) throw new Error(`${path} failed: ${response.status}`);
  return response.json();
}

const backend: ChatBackend = {
  createApp: (prompt) => post("/api/chat/apps", { prompt }),
  openLiveSession: (appId) => post("/api/chat/session", { appId }),
  sendMessage: (appId, content) => post("/api/chat/message", { appId, content }),
  submitToolCallInput: (appId, answer) => post("/api/chat/answer", { appId, answer }),
};

function Chat({ prompt }: { prompt: string }) {
  const [appId, setAppId] = useState<string | null>(null);
  const chat = useChat({ appId, backend, onAppCreated: (app) => setAppId(app.id) });

  return (
    <>
      {chat.items.map((item) => (
        <div key={item.id} className={item.role}>
          {item.text && <Markdown>{item.text}</Markdown>}
          {item.steps.map((step) => (
            <small key={step.id}>{step.label}</small>
          ))}
        </div>
      ))}
      {chat.error && <p role="alert">{chat.error.message}</p>}
      <button onClick={() => (appId ? chat.send(prompt) : chat.create(prompt))}>Send</button>
    </>
  );
}
```

The first prompt creates the app. `onAppCreated` keeps its ID, so the next prompts go to that app instead of creating another one.

When the AI asks a question, the step it belongs to carries it in `step.question`, with its answer actions already bound. See [Questions](https://docs.base44.com/developers/references/platform-sdk/docs/functions/useChat.md#questions) for each kind.

> [!NOTE]
>
> Not using React? Use [`createPlatformClient()`](https://docs.base44.com/developers/references/platform-sdk/docs/functions/createPlatformClient) and its [`chat`](https://docs.base44.com/developers/references/platform-sdk/docs/interfaces/chat) module directly, as [Live updates](https://docs.base44.com/developers/white-label/live-updates.md) shows. The connection is read-only, so prompts and answers still go from your server to the Apps API.

## See also

* [Live updates](https://docs.base44.com/developers/white-label/live-updates.md): Open a session on your server, follow the AI chat in the browser, and apply snapshots and events.
* [The build turn](https://docs.base44.com/developers/white-label/the-build-turn.md): What happens between a prompt and a finished build.
* [`useChat()`](https://docs.base44.com/developers/references/platform-sdk/docs/functions/useChat): Every option, field, and action of the chat.
* [`chat`](https://docs.base44.com/developers/references/platform-sdk/docs/interfaces/chat): Sessions, subscriptions, and the events the chat sends.
* [`webhooks`](https://docs.base44.com/developers/references/platform-sdk/docs/interfaces/webhooks): Verify and handle the events Base44 sends your server.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.