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

site-context-chat

v0.1.5

Published

Markdown-backed site chatbot with Supabase Edge Functions, admin panel, and draggable widget.

Readme

site-context-chat

Markdown-backed site chatbot for static sites. Includes:

  • Draggable/resizable chat widget (from production InstaBuild UX)
  • Supabase Edge Functions (site-chat, site-chat-admin)
  • Server-side conversation threading (sessionId + Postgres history)
  • Admin panel for context, appearance, and model settings
  • BYOK Anthropic — API key lives in Supabase secrets only

Architecture

Visitor widget  →  site-chat (edge)  →  Anthropic API
                      ↑
              site_chat_context (markdown)
              site_chat_conversations (history by sessionId)

Threading: the widget sends one message + sessionId. The edge function loads recent history from the DB, calls Claude, then stores both turns.

Setup

1. Supabase project

supabase link --project-ref YOUR_PROJECT_REF
supabase db push
supabase functions deploy site-chat
supabase functions deploy site-chat-admin

2. Edge secrets

supabase secrets set ANTHROPIC_API_KEY=sk-ant-...
supabase secrets set SITE_CHAT_ADMIN_SECRET=your-long-random-secret

ANTHROPIC_API_KEY, SUPABASE_URL, and SUPABASE_SERVICE_ROLE_KEY are available automatically in Edge Functions.

3. Run migration

Applies site_chat_sites, site_chat_context, site_chat_conversations, and RPCs. Seeds a default site.

4. Install package in your app

npm install site-context-chat @supabase/supabase-js
import { ChatbotProvider, SiteChatWidget } from 'site-context-chat';
import 'site-context-chat/styles.css';

export function AppShell({ children }) {
  return (
    <ChatbotProvider
      supabaseUrl={process.env.NEXT_PUBLIC_SUPABASE_URL}
      supabaseAnonKey={process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}
      siteId="default"
    >
      {children}
      <SiteChatWidget routePath={typeof window !== 'undefined' ? window.location.pathname : '/'} />
    </ChatbotProvider>
  );
}

5. Admin panel (private route)

import { AdminPanel } from 'site-context-chat';
import 'site-context-chat/styles.css';

export default function ChatAdminPage() {
  return (
    <AdminPanel
      supabaseUrl={process.env.NEXT_PUBLIC_SUPABASE_URL}
      supabaseAnonKey={process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}
      siteId="default"
    />
  );
}

Unlock with SITE_CHAT_ADMIN_SECRET, paste/import markdown context, save.

Export site markdown

npx site-context-chat export ./content-docs ./context.md

Upload context.md via the admin Context tab.

Smoke test

SUPABASE_URL=... SUPABASE_ANON_KEY=... npm run test:edge
# optional:
SITE_CHAT_ADMIN_SECRET=... npm run test:edge

Edge API

site-chat POST

| action | body | response | |--------|------|----------| | config | { siteId } | public widget config | | history | { siteId, sessionId } | { messages[] } for UI hydration | | chat | { siteId, sessionId, message, routeContext? } | { response } |

Requires Authorization: Bearer <SUPABASE_ANON_KEY>.

site-chat-admin POST

| action | headers | body | |--------|---------|------| | get | x-admin-secret | { siteId } | | save | x-admin-secret | { siteId, site, contextMarkdown } |

History enhancements

  • UI hydration: history action on widget open
  • Model window: last 20 messages sent to Claude
  • sessionId persisted in localStorage per site

WordPress

A frontend plugin lives in wordpress/. Build assets with npm run build:wp, zip wordpress/site-context-chat/, and install via Plugins → Upload.

Backend tutorial (WP-friendly): docs/BACKEND-SETUP.md — dashboard for SQL & secrets, CLI for function deploy.

License

MIT