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

baseswim

v1.0.0

Published

A base swim node

Readme

baseswim

A base swim node

Install

npm i baseswim -g

or

docker pull matteocollina/baseswim

Usage

baseswim [--http 3000] [--port PORT] [peers...]

Each peer is in the form of IP:PORT, like 127.0.0.1:7799

with Docker

On Linux:

docker run -p 3000:3000 -p 7799:7799/udp -d matteocollina/baseswim --host `ip addr show wlan0 | grep -Po 'inet \K[\d.]+'` --http 3000

adjut the host configuration to your own interface/ip address

On Mac:

docker run -p 3000:3000 -p 7799:7799/udp -d matteocollina/baseswim --host `ipconfig getifaddr en0` --http 3000

adjut the host configuration to your own interface/ip address

On docker-machine:

docker run -p 3000:3000 -p 7799:7799/udp -d matteocollina/baseswim --host `docker-machine ip default` --http 3000

If you need to connect it to other peers pass any peer id at the end, like for the normal usage.

as a module

'use strict'

const baseswim = require('baseswim')
const id = '127.0.0.1:7799' // replace your ip address

const swim = basewim(id, {
  http: 3000 // to enable the HTTP endpoints
})

swim.on('peerUp', (peer) => console.log(peer))
swim.on('peerDown', (peer) => console.log(peer))

The swim instance is the same of swim-js. See its README for the API.

constructor options

If you do not pass any options, baseswim will bound to a network interface (not localhost) and pick a free udp port.

You can also pass the host and port as parameters:

const swim = baseswim({
  host: '127.0.0.1',
  port: 7799
})

HTTP endpoints

If enabled by the --http flag, baseswim provides two HTTP endpoint to control the base node.

GET /members

Provides a list of the current members, output:

$ curl `docker-machine ip default`:3000/members
{
  "members": [
    {
      "host": "192.168.99.100:7799",
      "state": 0,
      "incarnation": 0
    }
  ]
}

POST /join

Provides a list of the current members, output:

curl -X POST -d 'PEER' `docker-machine ip default`:3000/members

where PEER is an IP:PORT combination.

Acknowledgements

baseswim is sponsored by nearForm.

License

MIT