Package Reference
Prerequisites
Required peer dependencies
Before installing the package, make sure your project meets the following requirements. These are the minimum versions the package has been built and tested against.
| Package | Minimum Version | When Needed | Purpose |
|---|---|---|---|
| react | 17+ | Always | UI framework |
| react-dom | 17+ | Always | DOM rendering |
| zustand | 4+ | Always | Chat state store |
| tailwindcss | v4 | Always | Package UI is built with Tailwind utility classes |
| @tailwindcss/vite | v4 | Vite projects only | Tailwind's Vite plugin |
| @tailwindcss/postcss | v4 | Next.js projects only | Tailwind's PostCSS plugin |
| next | 13+ | Next.js projects only | App Router support |
| react-hot-toast | 2+ | Optional | Only required if you use the built-in showNotification helper |
Typical peer install for a Vite app (adjust the Tailwind plugin for Next.js):
pnpm add react react-dom zustand tailwindcss @tailwindcss/vite
Bundled dependencies (do not install separately)
The following libraries are already bundled inside the package and should not be added to your project's dependencies. Installing them separately can create duplicate instances (especially socket.io-client) and hard-to-debug runtime conflicts.
axios— REST client used by the package API layersocket.io-client— realtime transport for messages and presenceradix-ui— accessible overlays and menus inside drawers and modalslucide-react— icons used by the default UIemoji-picker-react— reaction / emoji pickerclsx,tailwind-merge,class-variance-authority— class composition helpers
Backend credentials
You will need the following values from your RealtimeX backend (or your own compatible backend) before you can render a working chat. Obtain clientId, API host, and user JWTs from your RealtimeX dashboard or login API — then keep them in chat.config.ts (see Project Setup).
| Field | Example | Notes |
|---|---|---|
| clientId | "xxxxxxxxxxxxxxxxxxxxxxxx" | Your tenant / client id |
| accessToken | JWT string | User access token |
| loggedUserDetails._id | "xxxxxxxxxxxxxxxxxxxxxxxx" | Must match the _id encoded inside the JWT |
| loggedUserDetails.name | "chat1" | Display name shown in the UI |
| loggedUserDetails.email | "chat1@example.com" | Used during client-user login |
| apiUrl | https://example.com/api/v1 | REST API base URL — must end with /api/v1 |
| socketUrl | https://example.com | Socket host, no /api/v1 suffix; optional, derived from apiUrl if omitted |
| themeColor | "#6366f1" | Optional brand accent color |