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

peersignal-server

v0.1.3

Published

Simple WebRTC signaling server with code-based pairing

Readme

peersignal-server

npm version CI License: MIT

Simple WebRTC signaling server with code-based P2P pairing. Works with the peersignal client.

Install

npm install peersignal-server

Usage

npx peersignal-server
# Server running on http://localhost:3000

Or programmatically:

import { createServer } from 'http';
import { createPeerSignalServer } from 'peersignal-server';

const httpServer = createServer();
const io = createPeerSignalServer(httpServer);

httpServer.listen(3000);

How It Works

  1. Peer A creates room → gets code like k7m-p2x-9nf
  2. Peer A shares code out-of-band (text, DM, etc.)
  3. Peer B joins with code
  4. WebRTC P2P connection established (auto-approved by default)
+----------+                        +----------+
|  Peer A  |<-- P2P DataChannel --> |  Peer B  |
+----+-----+                        +-----+----+
     |                                    |
     +------ Signaling via Server --------+

The server only helps establish the connection - all data flows directly between peers.

CORS

CORS is enabled by default (origin: '*'). Override via options:

createPeerSignalServer(httpServer, {
  cors: { origin: 'https://yourdomain.com' }
});

Code Format

  • 9 characters: xxx-xxx-xxx
  • Safe charset: a-z (no i,l,o) + 2-9 (no 0,1)
  • Case-insensitive

DDoS Protection

Built-in rate limiting and abuse prevention:

| Protection | Default | Env Var | |------------|---------|---------| | Connections per IP | 20/min | - | | Room creation per IP | 5/min | - | | Join attempts per IP | 30/min | - | | Signals per socket | 50/sec | - | | Max pending peers/room | 10 | MAX_PENDING_PER_ROOM | | Max rooms per IP | 5 | MAX_ROOMS_PER_IP | | Idle timeout | 5 min | IDLE_TIMEOUT_MS | | Max payload size | 16KB | MAX_PAYLOAD_SIZE |

Admin Dashboard

Optional admin dashboard for monitoring server activity.

Enabling

Set the ADMIN_PASSWORD environment variable:

ADMIN_PASSWORD=mysecretpassword npx peersignal-server

Accessing

Navigate to /admin and authenticate with:

  • Username: admin
  • Password: Your ADMIN_PASSWORD value

Features

  • Real-time stats: Active rooms, connected peers, pending requests
  • Room list: View all active rooms with their connection status
  • Activity log: Recent connections, room creations, and peer approvals
  • JSON API: GET /admin/api/stats for programmatic access
  • Auto-refresh: Dashboard refreshes every 10 seconds

Security Notes

  • Dashboard is completely disabled if ADMIN_PASSWORD is not set
  • Uses HTTP Basic Authentication
  • Recommended: Use HTTPS in production
  • Keep your admin password secure

Configuration

| Env Var | Default | Description | |---------|---------|-------------| | PORT | 3000 | Server port | | ADMIN_PASSWORD | - | Enable admin dashboard (disabled if not set) | | MAX_PENDING_PER_ROOM | 10 | Max pending join requests per room | | MAX_ROOMS_PER_IP | 5 | Max rooms one IP can create | | IDLE_TIMEOUT_MS | 300000 | Disconnect idle sockets (5 min) | | MAX_PAYLOAD_SIZE | 16384 | Max signaling payload size (16KB) |

Client

Use the peersignal client:

npm install peersignal

Or via CDN:

<script src="https://unpkg.com/peersignal"></script>

License

MIT