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

restnio

v4.7.4

Published

Node implementation of RestNio, the easy peasy API system.

Readme

RestNio.js

One routing model for HTTP and WebSocket. Bimodal routes, built-in validation, JWT auth, and shipped TypeScript types — in one small Node package.

npm node types license

restn.io  ·  Documentation Wiki  ·  npm


Install

npm install restnio

Hello, RestNio

const RestNio = require('restnio');

const app = new RestNio((router, rnio) => {

    router.get('/', () => 'Hello from RestNio');

    router.post('/dog/:name/feed', {
        permissions: ['dog.feed.:name'],
        params: {
            portion: rnio.params.integer
        },
        func: (params) => ({ fed: params.name, amount: params.portion })
    });

    router.ws('/chat', (params, client) => {
        rnio.subs(params.room).obj({ from: client.state.name, text: params.text });
    });

}, { port: 7070 });

app.bind();

Same route, both protocols. The POST above works over curl and over a WebSocket envelope { "path": "/dog/fido/feed", "params": { "portion": 2 } } — no extra wiring.

What's in the box

  • Bimodal routing — HTTP and WebSocket share route definitions by default
  • Param validation — type coercion, shorthand helpers, checks and formatters in one pass
  • JWT auth — per-route permissions with path-param substitution (dog.feed.:name)
  • Pluginsserve(), cors(), ratelimit() mount as route middleware
  • Binary WS routing — named binary routes and codec negotiation (JSON + MessagePack)
  • Outbound connectorsRestNio.request, RestNio.http, RestNio.websocket
  • Interconnect — persistent peer links between RestNio servers, with reusable route definitions
  • TypeScript — ships .d.ts with path-param type inference

Documentation

The full guide lives in the GitHub Wiki:

| | | |---|---| | Quick Start | Smallest working server | | Routing | Bimodal, HTTP-only, WS-only, path params, nesting | | Params & Validation | Types, checks, formatters, shorthands | | Auth & Permissions | JWT tokens, cookie auth, permission templates | | WebSocket | Routing, subscriptions, broadcasting | | Binary Routing | Upload pattern, named binary routes | | Codecs | JSON and MessagePack negotiation | | Plugins | Static serving, CORS, rate limiting | | Connectors | Outbound HTTP + WebSocket clients | | Interconnect | Persistent server-to-server peer links | | TypeScript | Declarations and inference | | Operations | Proxy config, security checklist |

Scripts

npm test                  # all tests
npm run test:unit         # unit tests
npm run test:integration  # integration tests
npm run test:e2e          # end-to-end
npm run test:coverage     # coverage (80% lines/stmts/branches/fns)
npm run test:types        # typecheck .d.ts
npm run build:types       # regenerate .d.ts from JSDoc

License

MIT © 7kasper