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-users

v1.0.0

Published

Official Street Framework social module: the follow graph (follow/unfollow, followers, following, mutuals) with a pluggable store, in-memory default, and Postgres-backed adapter.

Readme

@streetjs/social-users

Official StreetJS Framework social module: the follow graph. It is the foundation the other social modules (@streetjs/social-feed, @streetjs/social-comments, @streetjs/social-notifications) build on.

  • Directional, idempotent follow edges (follow / unfollow)
  • Followers / following listings and counts
  • Mutual-follow detection (order-independent)
  • Pluggable persistence: in-memory default + Postgres-backed adapter

Install

npm install @streetjs/social-users streetjs

Quick start (in-memory)

import { FollowService } from '@streetjs/social-users';

const social = new FollowService(); // in-memory store by default

await social.follow('ada', 'lin');           // { changed: true, mutual: false }
await social.isFollowing('ada', 'lin');       // true
await social.follow('lin', 'ada');            // { changed: true, mutual: true }
await social.isMutual('ada', 'lin');          // true
await social.followers('lin');                // ['ada']
await social.counts('lin');                   // { followers: 1, following: 0 }
await social.unfollow('ada', 'lin');          // { changed: true, mutual: false }

Postgres-backed

Compose StreetJS's native PgPool. Run the exported migration once at bootstrap.

import { PgPool } from 'streetjs';
import {
  FollowService,
  PgFollowStore,
  SOCIAL_FOLLOWS_MIGRATION_SQL,
} from '@streetjs/social-users';

const pool = new PgPool({ host: '127.0.0.1', port: 5432, user: 'street', password: '…', database: 'app' });
await pool.query(SOCIAL_FOLLOWS_MIGRATION_SQL);

const social = new FollowService({ store: new PgFollowStore(pool) });
await social.follow('ada', 'lin');

PgFollowStore accepts any object satisfying the narrow SocialUsersPool interface (a single query(sql, params) method), so PgPool works directly.

Semantics

| Behaviour | Guarantee | |---|---| | follow(a, b) twice | idempotent — second call reports changed: false | | unfollow(a, b) when not following | no-op — changed: false | | follow(a, a) | throws (no self-follow) | | isMutual(a, b) | true iff both a→b and b→a exist; symmetric | | listings | returned in edge-creation order |

API

  • new FollowService({ store?, now? })
  • follow(followerId, followeeId){ changed, mutual }
  • unfollow(followerId, followeeId){ changed, mutual }
  • isFollowing(a, b)boolean
  • isMutual(a, b)boolean
  • followers(userId) / following(userId)string[]
  • counts(userId){ followers, following }

Stores: InMemoryFollowStore, PgFollowStore. Schema: SOCIAL_FOLLOWS_MIGRATION_SQL.

Testing

npm run test -w packages/social-users          # unit + property tests (no DB)
# add PG_* env to also run the live-Postgres integration suite
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-users

License

MIT