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

@roomful/next

v1.1.13

Published

Next.js server-side auth-token helpers for Roomful realtime rooms.

Readme

@roomful/next

Next.js server-side auth-token helpers for Roomful — mint short-lived, relay-compatible JWTs on the server so your clients join rooms without ever seeing the relay secret.

Stable — v1.5. The API is stable and ready for production.

Tokens are signed with Web Crypto, so the helpers run in both the Node and Edge runtimes. There is no next or react dependency — the route handler is a Web-standard (request: Request) => Promise<Response>.

Install

npm install @roomful/core @roomful/next

Server: issue room-scoped tokens (App Router)

Create an App Router Route Handler. Authorize the request (check the session, look up the room), then return the claims — a relay-valid token is minted for you.

// app/api/roomful/route.ts
import { createRoomfulTokenRoute } from '@roomful/next';

export const POST = createRoomfulTokenRoute({
  secret: process.env.ROOMFUL_RELAY_SECRET!,
  authorize: async (req) => {
    const { userId, roomId } = await resolveSession(req);
    return { subject: userId, roomId };
  },
});

Reject unauthorized callers by returning a Response from authorize:

authorize: async (req) => {
  if (!(await isAuthenticated(req))) {
    return new Response(null, { status: 401 });
  }
  return { subject: userId, roomId };
};

Client: fetch the token and join

Fetch the token from your route, then pass it as the core client's relayAuth:

import { createRoom } from '@roomful/core';
import { fetchRoomfulToken } from '@roomful/next';

const room = createRoom('room-1', {
  relayUrl: 'wss://relay.roomful.dev',
  relayAuth: () => fetchRoomfulToken('/api/roomful', { method: 'POST' }),
});

await room.connect();

Passing relayAuth a function means a fresh token is fetched on every (re)connect, so short-lived tokens stay valid across reconnects.

Low-level: mint a token directly

import { issueRoomfulToken } from '@roomful/next';

const token = await issueRoomfulToken({
  secret: process.env.ROOMFUL_RELAY_SECRET!,
  subject: 'user-123',
  roomId: 'room-1',
  expiresInSeconds: 3600, // default
});

The result is a compact HS256 JWT (iat/exp set, plus sub/roomId/nbf and any claims you pass) that @roomful/relay verifies natively.

Documentation

See the Roomful repository for the full API reference.

License

MIT