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

@databridgeai/react

v1.0.0

Published

DataBridge AI React — Drop-in React chat widget for natural language database queries

Downloads

10

Readme

@databridgeai/react

Drop-in React chat widget for natural language database queries.

Add a ChatGPT-like interface to your React app that lets users query your database in plain English. Renders tables, images, and charts automatically.

Quick Start

npm install @databridgeai/react
import { ChatWidget } from '@databridgeai/react';

function App() {
  return (
    <ChatWidget
      endpoint="/api/ai/chat"
      userContext={{
        userId: currentUser.id,
        orgId: currentUser.organizationId,
        role: currentUser.role,
      }}
      title="Data Assistant"
    />
  );
}

That's it. Your users can now ask questions like:

  • "Show me this month's revenue"
  • "Who are our top 10 customers?"
  • "Compare sales by region as a bar chart"

Features

  • Table rendering: Query results displayed in clean, sortable tables
  • Chart visualization: Automatic Chart.js rendering (bar, pie, line, doughnut)
  • Image detection: URLs to images render as inline thumbnails
  • Responsive design: Works on desktop and mobile
  • Customizable: Adjust colors, title, placeholder text
  • TypeScript: Full type safety included

Props

interface ChatWidgetProps {
  /** Your backend chat endpoint (e.g., "/api/ai/chat") */
  endpoint: string;

  /** User context for tenant isolation */
  userContext: {
    userId: string;
    orgId: string;
    role: string;
  };

  /** Widget title (default: "AI Assistant") */
  title?: string;

  /** Input placeholder text */
  placeholder?: string;

  /** Custom CSS class for the container */
  className?: string;

  /** Custom headers for API requests */
  headers?: Record<string, string>;
}

Backend Requirement

This widget requires a backend endpoint powered by @databridgeai/connector:

// Your Express backend
import { initExecutorAgent } from '@databridgeai/connector';

const agent = await initExecutorAgent({
  apiKey: process.env.DATABRIDGE_API_KEY!,
  db: pool,
  exposeTables: ['users', 'orders', 'products'],
  tenantField: 'organization_id',
});

app.post('/api/ai/chat', agent.middleware());

Response Format

The widget expects this JSON response structure:

{
  "message": "Here are the top 5 customers by revenue:",
  "data": {
    "rows": [...],
    "columns": ["name", "revenue", "avatar_url"]
  },
  "visualization": {
    "type": "bar",
    "title": "Revenue by Customer",
    "labels": ["Acme", "Globex", "Initech"],
    "datasets": [{ "label": "Revenue", "data": [50000, 42000, 38000] }]
  }
}

Peer Dependencies

  • react >= 18
  • react-dom >= 18

Related Packages

| Package | Purpose | |---------|---------| | @databridgeai/connector | Backend connector (required) | | @databridgeai/toolkit | Schema introspection & utilities | | @databridgeai/core | Shared types & validators |

License

MIT