npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sdk-chatbot

v1.0.6

Published

A customizable React Chatbot Widget SDK, supporting normal REST API and Streaming responses.

Readme

SDK Chatbot

A customizable React Chatbot Widget SDK, supporting normal REST API and Streaming responses.

Features

  • 🎨 Customizable Design: Primary color, bot avatar, name, description, and more.
  • 🚀 Easy Integration: Works with Vite, Next.js, and other React frameworks.
  • 📡 Streaming Support: Real-time streaming response support (Server-Sent Events).
  • 📁 File Upload: Built-in support for file attachments (images, PDFs).
  • 💾 Persistence: Auto-saves chat history to localStorage.
  • 📍 Flexible Positioning: Bottom-right, bottom-left, top-right, etc.

Installation

npm install sdk-chatbot
# or
yarn add sdk-chatbot
# or
pnpm add sdk-chatbot

Build for Public Use

To build the package for production/publishing:

  1. Install dependencies:

    npm install
  2. Run the build command:

    npm run build

    This will generate the dist folder containing:

    • index.js (CommonJS)
    • index.mjs (ES Module)
    • index.d.ts (TypeScript Definitions)
    • index.css (Styles)
  3. (Optional) Pack for local testing:

    npm pack

Usage

1. Vite (React)

In a standard Vite project, you can use the widget in your main App.tsx.

src/App.tsx

import { SmartTaxChat } from 'sdk-chatbot';
import 'sdk-chatbot/dist/index.css'; // Don't forget to import CSS!

function App() {
  return (
    <div>
      <h1>My App</h1>
      <SmartTaxChat
        botName="Support Bot"
        botDescription="Online"
        primaryColor="#2563EB"
        welcomeMessage="Hello! How can I help you today?"
        endpoint="https://your-api.com/chat"
        apiKey="your-api-key"
      />
    </div>
  );
}

export default App;

2. Next.js 14+ (App Router)

Since the chatbot uses React hooks (useState, useEffect, etc.), it must be a Client Component.

Option A: Global Widget (in layout.tsx)

To make the chatbot available on every page, create a client wrapper component and import it in your root layout.

components/ChatWrapper.tsx

'use client'; // Essential for Next.js App Router

import { SmartTaxChat } from 'sdk-chatbot';
import 'sdk-chatbot/dist/index.css';

export default function ChatWrapper() {
  return (
    <SmartTaxChat
      botName="Assistant"
      primaryColor="#000000"
      endpoint="/api/chat" // Example internal API route
      useStreaming={true}
    />
  );
}

app/layout.tsx

import ChatWrapper from '@/components/ChatWrapper';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>
        {children}
        <ChatWrapper />
      </body>
    </html>
  );
}

Option B: Page Specific (in page.tsx)

If you want the chatbot only on a specific page.

app/dashboard/page.tsx

'use client';

import { SmartTaxChat } from 'sdk-chatbot';
import 'sdk-chatbot/dist/index.css';

export default function Dashboard() {
  return (
    <main>
      <h1>Dashboard</h1>
      <SmartTaxChat
        botName="Dashboard Helper"
        welcomeMessage="Need help with the dashboard?"
      />
    </main>
  );
}

Configuration (Props)

| Prop | Type | Default | Description | |------|------|---------|-------------| | botName | string | 'Support Bot' | Name displayed in the header. | | botDescription | string | 'Online' | Subtitle under the bot name. | | primaryColor | string | '#2563EB' | Main theme color (header, user bubbles, button). | | welcomeMessage | string | 'สวัสดีครับ...' | First message sent by the bot. | | endpoint | string | - | API URL for chat requests. | | apiKey | string | - | Authorization key for API calls. | | useStreaming | boolean | false | Enable streaming responses (requires compatible endpoint). | | allowFileUpload| boolean | false | Enable file upload button. | | chatbotId | string | - | ID to identify the specific chatbot instance (if needed). | | persistenceKey | string | 'chat_widget_history' | Key for localStorage history. |

Development

  1. Clone the repository.
  2. Install dependencies: npm install
  3. Start development with watch mode:
    npm run dev
  4. In another terminal, run the example app:
    npm run example