Skip to content
GitHub Actions edited this page Apr 29, 2026 · 4 revisions

RestNio.js

A Node.js framework with one routing model for HTTP and WebSocket.

npm install restnio

What it is

RestNio is a lightweight Node.js server framework where every route is bimodal by default — the same handler works for HTTP requests and WebSocket messages unless you explicitly opt for one or the other.

  • Bimodal routing — HTTP and WebSocket share the same route definitions by default
  • Built-in validation — param parsing, type coercion, formatting, and checks in one pass
  • JWT auth — per-route permission lists with path-param substitution (dogs.feed.:name)
  • Pluginsrnio.serve(), rnio.cors(), rnio.ratelimit() mount as route middleware
  • Connectors — outbound RestNio.request(), RestNio.http, RestNio.websocket clients built in
  • TypeScript — ships .d.ts declarations with path-param type inference

Quick navigation

Getting started

Page Summary
Quick Start Smallest working server in 10 lines
Routing Bimodal, HTTP-only, WS-only, path params, regex, nested routers
Params & Validation Type coercion, shorthand helpers, checks, formatters

HTTP

Page Summary
HTTP Behavior Response types, cookies, manual control, headers
Auth & Permissions JWT tokens, token.grant(), cookie auth, permission templates

WebSocket

Page Summary
WebSocket Basics Unified routing model, RPC pattern, push, subscriptions
Binary Routing Named binary routes, upload pattern
Codec Negotiation JSON (default) and MessagePack

Server features

Page Summary
Plugins Static files, CORS, rate limiting
Default Routes Override 404 / 403 / 500 / wsConnect / wsBin
Outbound Connectors HTTP and WebSocket outbound clients
Interconnect (S2S) Persistent peer connections between RestNio servers

Reference

Page Summary
TypeScript Declaration files, path-param inference
Progressive Starter Annotated full example to copy and extend
Operational Notes Server options, proxy config, security checklist
Testing & Coverage Test commands and coverage matrix

Clone this wiki locally