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

senac-chat

v0.1.0

Published

Client library for SENAC classroom chat over Supabase Realtime

Readme

senac-chat

TypeScript client for a classroom messaging exercise: each student builds a PWA, all apps share one Supabase project, and users identify themselves by phone number (WhatsApp-style, no OTP).

Install

yarn add senac-chat @supabase/supabase-js

Teacher setup (once)

  1. Create one Supabase project for the class.
  2. Run supabase/schema.sql in the SQL editor.
  3. Enable Realtime for public.profiles and public.messages.
  4. Share with students only:
    • project URL
    • anon key
      Never share the service-role key.

Student app usage

import { createSenacChat } from "senac-chat";

const chat = createSenacChat({
  url: import.meta.env.VITE_SUPABASE_URL,
  anonKey: import.meta.env.VITE_SUPABASE_ANON_KEY,
});

// First visit: register with phone as public ID
const me = await chat.register({
  phone: "11999990000",
  displayName: "Ana",
  appName: "AnaChat", // optional: name of this student's PWA
});
localStorage.setItem("senac-phone", me.phone);

// Next visits: restore session
// await chat.identify(localStorage.getItem("senac-phone")!);

const contacts = await chat.listContacts();

await chat.sendMessage({
  to: "11988880000", // classmate phone
  text: "Hello from my PWA!",
});

const thread = await chat.getHistory({ with: "11988880000" });

const unsubscribe = chat.onMessage((message) => {
  // Only messages where to_phone === my phone
  console.log(message.from_phone, message.text);
});

unsubscribe();

Data model

| Table | Role | |-------|------| | profiles | Registered users (phone PK, display_name, app_name) | | messages | Direct messages (from_phone → to_phone, text) |

Phones are normalized to digits only (11 99999-0000 → 11999990000).

Security note

This is intentionally open for a supervised classroom exercise (no Auth / no OTP). Anyone with the anon key can register any phone. Do not use this pattern for a real production messenger.

Scripts

yarn typecheck
yarn test
yarn build

API

| Method | Description | |--------|-------------| | createSenacChat(config) | Creates the client | | register({ phone, displayName, appName? }) | Registers / updates profile and starts session | | identify(phone) | Restores session for an existing phone | | getMe() | Current profile or null | | listContacts() | All registered classmates | | sendMessage({ to, text }) | Sends a direct message | | getHistory({ with?, limit? }) | Inbox or 1:1 thread | | onMessage(callback) | Live inbox for the current phone | | normalizePhone(phone) | Digits-only helper |