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

@zosmaai/reva-staging

v1.3.4-develop.1

Published

A lightweight, embeddable AI chat widget that can be easily integrated into any website with API key configuration.

Readme

🤖 Reva Chat Widget

A lightweight, embeddable AI chat widget that can be easily integrated into any website with API key configuration.

✨ Features

  • 🔧 Ultra-Simple Integration: Single script tag with data attribute
  • 🔐 API Key Configuration: Secure API key management
  • 🎨 Shadow DOM Isolation: No CSS conflicts with your website
  • Auto-Initialization: Automatically starts with api-key
  • 📱 Responsive Design: Works on all device sizes
  • 🔄 Destroy/Reinitialize: Full control over widget lifecycle

🚀 Quick Start

Step 1: Include the Script

Add the Reva script to your HTML page:

<script src="https://cdn.zosma.ai/reva.js"></script>

Step 2: Add API Key

Add your API key as a data attribute:

<script
  src="https://cdn.zosma.ai/reva.js"
  api-key="your-api-key-here"></script>

Complete Example

<!DOCTYPE html>
<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <h1>Welcome to my website!</h1>

    <!-- Your page content -->

    <!-- Reva Chat Widget - Auto-initializes with api-key -->
    <script
      src="https://cdn.zosma.ai/reva.js"
      api-key="your-api-key-here"></script>
  </body>
</html>

📖 API Reference

Auto-Initialization (Recommended)

The widget automatically initializes when you include the API key as a data attribute:

<script src="https://cdn.zosma.ai/reva.js" api-key="your-api-key"></script>

Reva.init(config) (Manual)

For advanced use cases, you can still manually initialize the widget:

Parameters:

  • config (object): Configuration object
    • apiKey (string, optional): Your Reva API key

Example:

Reva.init({
  apiKey: 'reva_sk_1234567890abcdef',
});

Note: Manual initialization is only needed if you don't use the api-key attribute.

Reva.destroy()

Destroys the current widget instance and removes it from the DOM.

Example:

Reva.destroy();

Reva.isInitialized()

Checks if the widget is currently initialized.

Returns:

  • boolean: true if initialized, false otherwise

Example:

if (Reva.isInitialized()) {
  console.log('Widget is active');
}

Reva.getConfig()

Gets the current widget configuration (immutable copy).

Returns:

  • RevaConfig | null: Current configuration or null if not initialized

Example:

const config = Reva.getConfig();
if (config) {
  console.log('API Key:', config.apiKey);
}

🔧 Development

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/zosma-ai/reva-chatbot.git
cd reva-chatbot

# Install dependencies
npm install

Development Server

# Start development server
npm run dev

Building for Production

# Build the widget
npm run build

This generates:

  • dist/reva.js - The main widget script
  • dist/reva.css - Widget styles (auto-injected)

Testing

You can test the widget integration by creating a simple HTML file or integrating it into your existing project.

🏗️ Project Structure

src/
├── embed/                 # Widget embed system (modular)
│   ├── types.ts          # TypeScript interfaces & types
│   ├── widget-manager.tsx # Core widget creation & management
│   └── index.ts          # Main embed orchestration
├── components/
│   ├── atoms/            # Basic UI components (Button, Input, etc.)
│   └── molecules/        # Complex UI components
│       └── chat-widget.tsx  # Main chat widget component
├── lib/                  # Utility functions
├── schema/               # Data type definitions
├── embed.tsx             # Main entry point (re-exports embed/*)
└── index.css             # Global styles & Tailwind

dist/                     # Built files
├── reva.js              # Main widget script (IIFE format)
└── vite.svg            # Build artifact

Architecture Overview

  • embed/types.ts - All TypeScript interfaces and type definitions
  • embed/widget-manager.tsx - Core widget creation, DOM manipulation, and React mounting
  • embed/index.ts - Main orchestration and global object exposure
  • embed.tsx - Entry point that re-exports the modular system

This modular structure provides:

  • Separation of Concerns - Each file has a single responsibility
  • Type Safety - Centralized type definitions
  • Maintainability - Easy to modify individual components
  • Testability - Pure functions that can be tested in isolation
  • Scalability - Easy to add new features without bloating single files

🎯 Roadmap

Current Features

  • ✅ Auto-initialization with data attributes
  • ✅ API key configuration
  • ✅ Basic chat interface
  • ✅ Shadow DOM isolation
  • ✅ Responsive design
  • ✅ Modular architecture
  • ✅ Functional programming patterns

Planned Features

  • [ ] Multiple theme options
  • [ ] Custom positioning
  • [ ] Message history persistence
  • [ ] File upload support
  • [ ] Typing indicators
  • [ ] Real-time API integration
  • [ ] Custom welcome messages
  • [ ] Analytics integration

🔐 Security

  • API keys are only stored in memory during widget operation
  • Shadow DOM provides style isolation
  • No data persistence in browser storage (currently)
  • Input validation and sanitization

🤝 Contributing

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

Code Style

  • Follow ES6+ modern JavaScript patterns
  • Use functional programming approaches where possible
  • Maintain TypeScript strict mode compliance
  • Follow the existing modular architecture

📄 License

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

🆘 Support

For support, please contact:

🔗 Links


Made with ❤️ by Zosma AI