📦 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:
| Package | Description | When to Use |
|---|---|---|
@xhub-chat/core | Framework-agnostic core functionality | Always required |
@xhub-chat/react | React hooks and components | When building React apps |
Installation Options
Option 1: Using pnpm (Recommended)
# 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:
- 📚 Quick Start Guide - Build your first chat app
- ⚙️ Configuration - Learn about configuration options
- 💡 Core Concepts - Understand the architecture
Need Help?
- 📖 Check the FAQ
- 🐛 Report an issue
- 💬 Discussions