Skip to main content

📦 Installation

Get started with XHub Chat by installing the packages you need for your project.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js version 18.0 or higher
  • Package Manager: pnpm (recommended), npm, or yarn
  • TypeScript 4.9+ (recommended for type safety)

Package Overview

XHub Chat is distributed as a monorepo with multiple packages:

PackageDescriptionWhen to Use
@xhub-chat/coreFramework-agnostic core functionalityAlways required
@xhub-chat/reactReact hooks and componentsWhen building React apps

Installation Options

# Install both core and react packages
pnpm add @xhub-chat/core @xhub-chat/react

# Or install only the core package
pnpm add @xhub-chat/core

Option 2: Using npm

# Install both core and react packages
npm install @xhub-chat/core @xhub-chat/react

# Or install only the core package
npm install @xhub-chat/core

Option 3: Using yarn

# Install both core and react packages
yarn add @xhub-chat/core @xhub-chat/react

# Or install only the core package
yarn add @xhub-chat/core

Peer Dependencies

For React Projects

If you're using @xhub-chat/react, ensure you have React installed:

pnpm add react react-dom

Supported React versions: ^18.0.0 || ^19.0.0

TypeScript Support

XHub Chat is written in TypeScript and includes type definitions out of the box. No additional @types packages are needed.

TypeScript Configuration

Ensure your tsconfig.json includes these settings:

{
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}

Verify Installation

After installation, verify that the packages are correctly installed:

# Check installed versions
pnpm list @xhub-chat/core @xhub-chat/react

# Or with npm
npm list @xhub-chat/core @xhub-chat/react

Troubleshooting

Common Issues

Package Not Found

If you get a "package not found" error, ensure you're using the correct package names:

  • @xhub-chat/core (correct)
  • xhub-chat-core (incorrect)

Peer Dependency Warnings

If you see peer dependency warnings with React, ensure you have a compatible React version installed (18.0+).

Type Errors

If you encounter type errors, ensure your TypeScript version is 4.9 or higher:

pnpm add -D typescript@latest

Next Steps

Now that you have XHub Chat installed, you're ready to:

  1. 📚 Quick Start Guide - Build your first chat app
  2. ⚙️ Configuration - Learn about configuration options
  3. 💡 Core Concepts - Understand the architecture

Need Help?