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

@streetjs/social-comments

v1.0.0

Published

Official Street Framework social module: threaded comments with reactions and @mentions, with a pluggable store, in-memory default, and Postgres-backed adapter.

Readme

@streetjs/social-comments

Official StreetJS Framework social module: threaded comments with reactions and @mentions, on any subject (a post, photo, listing — anything with an id).

  • Comments and threaded replies (parentId)
  • @mention extraction (normalized, deduped) with reverse lookup
  • Per-user reactions (toggle, idempotent) with counts
  • Author-scoped deletion (clears the comment's mentions and reactions)
  • Pluggable persistence: in-memory default + Postgres-backed adapter

Install

npm install @streetjs/social-comments streetjs

Quick start (in-memory)

import { CommentService } from '@streetjs/social-comments';

const comments = new CommentService();

const root = await comments.comment({ subjectId: 'post1', authorId: 'ada', text: 'great post @bob!' });
root.mentions;                                  // ['bob']
await comments.comment({ subjectId: 'post1', authorId: 'bob', text: 'thanks @ada', parentId: root.id });

await comments.thread('post1');                 // chronological comments
await comments.replies(root.id);                // direct replies
await comments.mentionsOf('bob');               // comments mentioning @bob

await comments.react(root.id, 'cat', '👍');     // true (added)
await comments.react(root.id, 'cat', '👍');     // false (idempotent)
await comments.reactions(root.id);              // { '👍': 1 }

Postgres-backed

import { PgPool } from 'streetjs';
import { CommentService, PgCommentStore, SOCIAL_COMMENTS_MIGRATION_SQL } from '@streetjs/social-comments';

const pool = new PgPool({ /* … */ });
await pool.query(SOCIAL_COMMENTS_MIGRATION_SQL);
const comments = new CommentService({ store: new PgCommentStore(pool) });

Semantics

| Behaviour | Guarantee | |---|---| | thread(subject) | chronological (ascending), cursor-paginated by after = seq | | replies | a reply must share its parent's subject; missing parent rejected | | mentions | @handle parsed at creation, lowercased, deduped; email-like @ ignored | | react / unreact | idempotent; changed flag reflects whether state moved | | delete(id, authorId) | author-scoped; also clears mentions + reactions |

API

  • new CommentService({ store?, now?, idGen? })
  • comment({ subjectId, authorId, text, parentId? }) → Comment
  • thread(subjectId, { limit?, after? }) / replies(parentId) → Comment[]
  • mentionsOf(handle) → Comment[]
  • react/unreact(commentId, userId, reaction) → boolean
  • reactions(commentId) → Record<reaction, count>
  • reactionsByUser(commentId, userId) → string[]
  • delete(commentId, authorId) → boolean
  • extractMentions(text) → string[] (exported helper)

Stores: InMemoryCommentStore, PgCommentStore. Schema: SOCIAL_COMMENTS_MIGRATION_SQL.

Testing

npm run test -w packages/social-comments     # unit + property tests (no DB)
PG_HOST=127.0.0.1 PG_PORT=5433 PG_USER=street PG_PASSWORD=street_secret \
  PG_DATABASE=street_test npm run test -w packages/social-comments

License

MIT