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

@mintukrishnan/mintai-chat

v0.1.0

Published

AI-powered e-commerce chat widget — OpenAI intent extraction + Constructor.io product search

Readme

@mintukrishnan/mintai-chat

AI-powered e-commerce chat widget. Drop-in React component with OpenAI intent extraction and pluggable product search.

Installation

npm install @mintukrishnan/mintai-chat

Peer dependencies (already in your project):

npm install react react-dom next

Usage

1. Set environment variables

STORE_NAME=Amazon
STORE_DESCRIPTION=Premium outdoor and sailing apparel
STORE_BASE_URL=https://www.amazon.com

OPENAI_KEY=sk-...

CONSTRUCTOR_KEY=your_key
CONSTRUCTOR_API_TOKEN=your_token
CONSTRUCTOR_BASE_URL=https://ac.cnstrc.com   # optional
CONSTRUCTOR_SECTION=Products                  # optional

2. Create the API route

In your Next.js app, create app/api/mintai/route.ts:

import { createHandlers } from "@mintukrishnan/mintai-chat/server";

export const { POST } = createHandlers({
  storeName: process.env.STORE_NAME!,
  storeDescription: process.env.STORE_DESCRIPTION,
  storeBaseUrl: process.env.STORE_BASE_URL,

  openaiKey: process.env.OPENAI_KEY!,

  search: {
    provider: "constructor",
    key: process.env.CONSTRUCTOR_KEY!,
    apiToken: process.env.CONSTRUCTOR_API_TOKEN!,
  },
});

3. Add the widget

import { ChatWidget } from "@mintukrishnan/mintai-chat";

export default function Layout({ children }) {
  return (
    <>
      {children}
      <ChatWidget
        primaryColor="#0071e3"
        title="Shop Assistant"
        greeting="Hi! What are you looking for today?"
      />
    </>
  );
}

ChatWidget props

| Prop | Type | Default | Description | | -------------- | --------------------------------- | ----------------------- | ------------------------------------------- | | apiUrl | string | /api/mintai | POST endpoint created with createHandlers | | primaryColor | string | #0071e3 | Brand colour for header and buttons | | title | string | Shop Assistant | Header title | | placeholder | string | Ask about products... | Input placeholder | | greeting | string | — | Opening message from the bot | | position | 'bottom-right' \| 'bottom-left' | bottom-right | Widget anchor corner |


createHandlers config

Store

| Option | Type | Required | Description | | ------------------ | -------- | -------- | -------------------------------------------------------------------------- | | storeName | string | ✅ | Store name used in the AI system prompt (e.g. "Amazon") | | storeDescription | string | — | Extra context for the AI (e.g. "Premium outdoor apparel") | | storeBaseUrl | string | — | Base URL to resolve relative product URLs (e.g. https://www.mystore.com) |

OpenAI

| Option | Type | Required | Description | | ------------- | -------- | -------- | --------------------------------- | | openaiKey | string | ✅ | OpenAI API key | | openaiModel | string | — | Model to use (default: gpt-4.1) |

Search providers

Pass a search object with one of the built-in providers or a custom implementation.

Constructor.io

search: {
  provider: 'constructor',
  key: '...',
  apiToken: '...',
  baseUrl: 'https://ac.cnstrc.com',  // optional
  section: 'Products',               // optional
}

| Option | Type | Required | Description | | ---------- | --------------- | -------- | ------------------------ | | provider | 'constructor' | ✅ | | | key | string | ✅ | Constructor.io API key | | apiToken | string | ✅ | Constructor.io API token | | baseUrl | string | — | Constructor API base URL | | section | string | — | Catalog section |

Custom provider

Bring your own search (Algolia, Elasticsearch, Shopify, etc.):

search: {
  provider: 'custom',
  searchProducts: async (intents) => {
    // intents: Array<{ name: string, tagline: string }>
    // return: Promise<Product[]>
    return myAlgoliaSearch(intents)
  },
}

Non-Next.js apps

ChatWidget works in any React 18+ app. For the server handler, create your own endpoint using any framework — createHandlers returns a standard Web Request → Response function compatible with Remix, Astro, Hono, and others.

License

MIT