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

chatx-ai

v1.0.6

Published

A flexible and reusable SDK for building AI-powered chatbots in React applications, leveraging the Google Gemini API for advanced conversational capabilities.

Readme

ChatX-AI || AI ChatBot SDK

npm version License: MIT

ChatX AI is a flexible and reusable SDK designed for integrating advanced AI-powered chatbots into React applications. Powered by the Google Gemini API, it enables developers to quickly add conversational AI features with minimal setup and maximum customization.

  • Seamless React integration
  • Powered by Google Gemini for state-of-the-art AI conversations
  • Customizable and extensible for various chatbot use-cases
  • Easy to set up and use in any modern React project

Get started building intelligent chatbots for your apps today!


📦 Installation

Install the package using your preferred package manager:

npm install chatx-ai
# or
yarn add chatx-ai
# or
pnpm add chatx-ai

🚀 Integration Guide

1. Get Your Gemini API Key

To use this SDK, you need a Google Gemini API key. Follow these steps:

  1. Visit the Google AI Studio.
  2. Log in with your Google account.
  3. Generate a new API key.
  4. Copy the API key for use in your project.

2. Add Environment Variables

Create a .env.local file in the root of your project and add the following variables:

NEXT_PUBLIC_GEMINI_API_KEY=your-api-key-here
NEXT_PUBLIC_AI_BOT_NAME=My Assistant
NEXT_PUBLIC_SYSTEM_INSTRUCTION= You are a customer support assistant for Acme Corp. Help users with their questions about our products and services.

Note: Never expose sensitive data like API keys directly in your code. Always use environment variables.


3. Integration in Next.js

To use the chatbot in a Next.js application, follow these steps:

Import and Use the Component

// filepath: pages/index.tsx
import ChatBot from "chatx-ai";

export default function Home() {
  return (
    <div>
      <h1>Welcome to My Site</h1>
      <ChatBot
        apiKey={process.env.NEXT_PUBLIC_GEMINI_API_KEY}
        botName={process.env.NEXT_PUBLIC_AI_BOT_NAME}
        systemInstruction={process.env.NEXT_PUBLIC_SYSTEM_INSTRUCTION}
      />
    </div>
  );
}

4. Integration in React

To use the chatbot in a React application, follow these steps:

Add Environment Variables

In React, environment variables must start with REACT_APP_. Update your .env file as follows:

REACT_APP_GEMINI_API_KEY=your-api-key-here
REACT_APP_AI_BOT_NAME=My Assistant
REACT_APP_SYSTEM_INSTRUCTION=You are a helpful assistant.

Import and Use the Component

// filepath: src/App.tsx
import ChatBot from "chatx-ai";

function App() {
  return (
    <div>
      <h1>Welcome to My App</h1>
      <ChatBot
        apiKey={process.env.REACT_APP_GEMINI_API_KEY}
        botName={process.env.REACT_APP_AI_BOT_NAME}
        systemInstruction={process.env.REACT_APP_SYSTEM_INSTRUCTION}
      />
    </div>
  );
}

export default App;

🌍 Environment Variables

| Variable | Description | Required | | -------------------------------- | ----------------------------------- | ----------------------------- | | NEXT_PUBLIC_GEMINI_API_KEY | Your Google Gemini API key | Yes (unless passed via props) | | NEXT_PUBLIC_AI_BOT_NAME | The bot's display name | No | | NEXT_PUBLIC_SYSTEM_INSTRUCTION | Instructions for the bot's behavior | No |

For React, use the REACT_APP_ prefix instead:

| Variable | Description | Required | | ------------------------------ | ----------------------------------- | ----------------------------- | | REACT_APP_GEMINI_API_KEY | Your Google Gemini API key | Yes (unless passed via props) | | REACT_APP_AI_BOT_NAME | The bot's display name | No | | REACT_APP_SYSTEM_INSTRUCTION | Instructions for the bot's behavior | No |


🔒 Security Best Practices

  1. Never expose API keys in client code:

    • Use environment variables.
    • Store sensitive data server-side for SaaS.
  2. Implement rate limiting:

    • Prevent API abuse.
    • Track usage per customer.
  3. Validate inputs:

    • Sanitize user messages.
    • Implement content filtering if needed.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ by Sanchit Pandey