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

@benbassatido/ai-chatbot

v0.1.2

Published

A React chat widget powered by OpenRouter AI with markdown support, RTL/LTR, localStorage persistence, and smooth animations.

Readme

🤖 AI Chatbot

A drop-in React chat widget powered by OpenRouter. Styled with Tailwind CSS, animated with Framer Motion, and renders assistant replies as Markdown.


✨ Features

  • 💬 Floating chat bubble with smooth open / close animation
  • 📝 Markdown rendering for assistant messages
  • 🌐 RTL / LTR support via a single prop
  • 💾 Optional localStorage persistence
  • 🎨 Customizable title, brand color, welcome text, and system prompt
  • 🏢 Pass structured business info so the AI stays grounded

📦 Installation

npm install @benbassatido/ai-chatbot

Peer dependencies

React 18 or 19 must be installed in your project:

npm install react react-dom

🚀 Quick start

import { Chatbot } from "@benbassatido/ai-chatbot";
import "@benbassatido/ai-chatbot/style.css";

function App() {
  return (
    <Chatbot
      apiKey="your-openrouter-api-key"
      title="Support"
      brandColor="#1d4ed8"
      welcomeMessage="Hi! How can I help?"
      systemPrompt="You are a helpful support assistant."
      direction="ltr"
      businessInfo={{
        companyName: "Acme",
        supportEmail: "[email protected]",
      }}
    />
  );
}

🎨 Styling requirements

The widget uses Tailwind CSS utility classes and Google Material Symbols. Your host page must include them for the UI to render correctly.

Tailwind CSS

Add the Tailwind CDN (quick) or install Tailwind in your project (recommended for production):

<script src="https://cdn.tailwindcss.com"></script>

Then extend your Tailwind theme with the colors the widget expects:

tailwind.config = {
  theme: {
    extend: {
      colors: {
        primary: "#004ac6",
        "primary-container": "#2563eb",
        surface: "#f8f9fa",
        "surface-container-lowest": "#ffffff",
        "surface-container-high": "#e8eaed",
        "on-surface": "#191c1d",
        "on-primary": "#ffffff",
        "outline-variant": "#c3c6d7",
        error: "#dc2626",
      },
    },
  },
};

Fonts

<!-- Inter -->
<link
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
  rel="stylesheet"
/>

<!-- Material Symbols Outlined -->
<link
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,[email protected],0..1&display=swap"
  rel="stylesheet"
/>

🔑 API key

Pass your OpenRouter API key via the apiKey prop:

<Chatbot apiKey="sk-or-v1-..." /* ...other props */ />

⚠️ Security note: The API key is sent from the browser and is visible to end users. For production, proxy requests through your own backend so the key stays server-side.


🎛️ Props

| Prop | Type | Default | Description | | ---- | ---- | ------- | ----------- | | apiKey | string | — | Required. Your OpenRouter API key | | title | string | — | Header text displayed in the chat window | | brandColor | string | — | CSS color for the header background | | welcomeMessage | string | — | First message shown by the assistant | | systemPrompt | string | built-in | System prompt sent to the AI model | | businessInfo | object | — | Arbitrary business data injected into the system prompt | | direction | "ltr" \| "rtl" | "ltr" | Text direction | | storageMode | "localStorage" \| "controlled" | "localStorage" | How messages are persisted | | storageKey | string | "chatbot_messages" | localStorage key when storageMode is "localStorage" | | messages | array | — | Controlled messages array (used with storageMode="controlled") | | onMessagesChange | function | — | Callback when messages update in controlled mode |


🧱 Tech stack

| Layer | Choice | | ----- | ------ | | UI | React 19, CSS Modules, Tailwind CSS | | Motion | Framer Motion | | Markdown | react-markdown | | HTTP | axios | | AI API | OpenRouter (chat/completions) | | Tooling | Vite 8, ESLint 9 |


📄 License

MIT


🙏 Acknowledgments