Skip to content

xpert-ai/chatkit-js

Repository files navigation

ChatKit

An all-in-one AI chat framework that makes building conversational experiences dead simple.

🤔 Still building chat UIs from scratch? Managing message state manually? Implementing streaming yourself?

Let ChatKit handle the heavy lifting. Get a complete AI chat experience up and running in minutes.

License

✨ Why ChatKit?

  • Save Time: Integrate a full-featured chat in 30 minutes, not weeks
  • Flexible: Works with React, Vue, vanilla JS—customize themes your way
  • Complete: Streaming, tools, uploads, threads—all built in

🚀 Quick Start

Backend (FastAPI)

Config environment by copying .env.example to .env and filling in your values.

from fastapi import FastAPI

app = FastAPI()

@app.post("/api/chatkit/session")
async def create_session():
  return {"client_secret": "your_session_token"}

Full example: pnpm managed-chatkit:dev

Frontend (React)

npm install @xpert-ai/chatkit-react

Config environment by copying .env.example to .env and filling in your values.

import { ChatKit, useChatKit } from '@xpert-ai/chatkit-react';

export function MyChat() {
  const { control } = useChatKit({
    api: {
      async getClientSecret() {
        const res = await fetch('/api/chatkit/session', { method: 'POST' });
        const { client_secret } = await res.json();
        return client_secret;
      },
    },
    theme: { colorScheme: 'light', radius: 'round' },
  });

  return <ChatKit control={control} className="h-[600px]" />;
}

📦 Key Features

  • 🎨 Deep Customization - Control colors, fonts, spacing—make it yours
  • ⚡ Real-time Streaming - Messages flow in smoothly, token by token
  • 🔧 Tool Integration - Seamless client and server tool support
  • 📎 File Uploads - Attach files and images with flexible config
  • 💬 Thread Management - Switch conversations, track history
  • 🌍 i18n Ready - 68+ locales out of the box
  • 🎯 Framework Agnostic - React/Vue/Angular/UI5/vanilla JS all work

📁 Project Structure

chatkit-js/
├── packages/
│   ├── chatkit/              # Shared ChatKit type contracts
│   ├── chatkit-web-shared/   # Shared browser utilities and messaging
│   ├── web-component/        # <xpertai-chatkit> Web Component
│   ├── chatkit-js/           # Vanilla JS integration helpers
│   ├── chatkit-react/        # React bindings
│   ├── chatkit-vue/          # Vue bindings
│   ├── chatkit-vue2/         # Vue 2 bindings
│   ├── chatkit-angular/      # Angular bindings
│   ├── chatkit-ui5/          # SAP UI5 bindings
│   ├── chatkit-ui/           # Iframe chat UI application
│   ├── chatkit-widgets/      # A2UI React widget renderer
│   ├── host-automation/      # Host page client-tool automation
│   └── browser-extension/    # Chrome extension host package
├── examples/
│   ├── managed-chatkit/      # React + FastAPI full-stack example
│   ├── managed-chatkit-angular/
│   └── excel-echarts-chatkit/
└── docs/                    # Documentation

📦 Workspace Packages

🛠️ Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run full-stack example
pnpm managed-chatkit:dev

# Run Angular example
pnpm managed-chatkit-angular:dev

# Run Excel/ECharts example
pnpm excel-echarts-chatkit:dev

# Dev UI components
pnpm dev:ui

# Run tests
pnpm test

# Lint code
pnpm lint

Publish

This repo uses Changesets + GitHub Actions for automated npm publishing. The private browser extension package is versioned by Changesets and packaged separately by .github/workflows/publish-browser-extension.yml.

One-time setup

  1. For packages that already exist on npm, configure this GitHub repository as a Trusted Publisher for the package(s) released from this repo.
  2. For brand-new packages, do a one-time manual publish first, then configure trusted publishing for subsequent releases.
  3. Ensure GitHub Actions has permission to create pull requests and request an OIDC token (used by .github/workflows/release.yml).

Release flow

  1. Make package changes in a feature branch.
  2. Add a changeset:
pnpm changeset
  1. Commit and merge into main.
  2. GitHub Action Release will run on main push:
    • Create/update a Release PR with version bumps and changelogs.
    • After the Release PR is merged, publish packages to npm automatically.

First publish for a new package

Trusted publishing can only be configured after the package already exists on npm. For a brand-new package such as @xpert-ai/chatkit-angular:

  1. Sign in to npm with an account that has publish access to the @xpert-ai scope.
  2. Build the repo:
pnpm build
  1. Publish the new package once manually:
pnpm --filter @xpert-ai/chatkit-angular publish --access public
  1. After the first publish succeeds, configure the package to use this repo's trusted publisher / .github/workflows/release.yml.
  2. Future releases of that package can then go through the normal Changesets + GitHub Actions flow.

Manual fallback (optional)

If you need to publish manually from your local machine, make sure you are authenticated with npm first (npm login or an npm access token), then run:

pnpm build && pnpm changeset publish

📚 Learn More

💻 Browser Support

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • Modern mobile browsers

🗺️ Roadmap

  • Core message streaming
  • Thread management
  • File attachments
  • Advanced theming
  • Tool call visualization
  • Voice I/O
  • WebSocket support

🤝 Contributing

We love contributions!

  1. Fork the project
  2. Create a branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📞 Support

📄 License

Apache License 2.0


Built with ❤️ by the Xpert AI team

Got questions? Want to chat? Feel free to open an issue or join the discussion

About

ChatKit is a batteries-included framework for building high-quality, AI-powered chat experiences. It’s designed for developers who want to add advanced conversational intelligence to their apps fast—with minimal setup and no reinventing the wheel. ChatKit delivers a complete, production-ready chat interface out of the box.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages