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

@lastshotlabs/slingshot-community

v0.0.2

Published

Community forum plugin for Slingshot — containers, threads, replies, reactions, moderation

Readme


title: Human Guide description: How to use @lastshotlabs/slingshot-community in a real Slingshot app

@lastshotlabs/slingshot-community adds a community/forum surface to a Slingshot app. Use it when you want containers, threads, replies, reactions, moderation, bans, reports, and notification hooks without building and wiring that whole domain yourself.

Auth Bridge

Community requires a communityPrincipal on the request context. The built-in authBridge config handles this automatically:

{
  "plugins": [{ "plugin": "slingshot-community", "config": { "authBridge": "auto" } }]
}

When authBridge is "auto", the plugin registers middleware that reads actor.id and roles from the framework auth context and sets communityPrincipal for community routes. This eliminates the most common handler file pattern. Use "none" (default) to wire the bridge yourself.

Example:

createCommunityPlugin({ authBridge: 'auto', containerCreation: 'user' });

When To Use It

Install this package when:

  • your app needs a forum, discussion, or member-generated content surface
  • you want the content model, route policy, and moderation behavior to come as one package
  • you are already using Slingshot plugins and want community to behave like a first-class domain

What You Need Before Wiring It In

This package is not standalone. In practice, most apps need:

  1. An auth story so requests have a user identity.
  2. A slingshot-permissions plugin so shared permission state exists in pluginState.
  3. A small middleware bridge that sets communityPrincipal on the request context from your auth identity.

Minimum Setup Shape

Manifest (recommended):

{
  "plugins": [
    { "plugin": "slingshot-auth", "config": { ... } },
    { "plugin": "slingshot-community", "config": { "authBridge": "auto", "containerCreation": "user" } }
  ]
}

App config:

import { defineApp } from '@lastshotlabs/slingshot';
import { createAuthPlugin } from '@lastshotlabs/slingshot-auth';
import { createCommunityPlugin } from '@lastshotlabs/slingshot-community';
import { createNotificationsPlugin } from '@lastshotlabs/slingshot-notifications';
import { createPermissionsPlugin } from '@lastshotlabs/slingshot-permissions';

export default defineApp({
  plugins: [
    createAuthPlugin({
      auth: { roles: ['user', 'admin'], defaultRole: 'user' },
      db: { auth: 'memory', sessions: 'memory', oauthState: 'memory' },
    }),
    createNotificationsPlugin(),
    createPermissionsPlugin(),
    createCommunityPlugin({ authBridge: 'auto', containerCreation: 'user' }),
  ],
});

First Config Knobs To Know

  • authBridge: 'auto' wires auth context to community principal automatically; 'none' (default) requires manual middleware
  • containerCreation: choose 'user' or 'admin'
  • scoring: choose the built-in ranking algorithm and weights
  • mountPath: move the package off /community if needed
  • disableRoutes: turn off specific generated route groups

Gotchas

  • Community expects communityPrincipal to exist for protected flows.
  • Register createPermissionsPlugin() before community so the shared permission state is available during setup.
  • This package is intentionally config-driven. If you find yourself reintroducing lots of bespoke route logic around it, that is usually a sign you want a different abstraction boundary.