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

@riogz/router

v1.0.5

Published

A simple, lightweight, powerful, view-agnostic, modular and extensible router

Downloads

18

Readme

npm version CI Deploy License: MIT gzip

@riogz/router

Modern, flexible and framework-agnostic router — a continuation of router5 with improved architecture and TypeScript support.

✨ Key Features

  • 🎯 Framework Agnostic — works with any frameworks and libraries
  • 🔄 View/State Separation — router processes instructions and outputs state updates
  • 🌍 Universal — works on client and server
  • 🧩 Modular Architecture — use only what you need
  • High Performance — optimized algorithms and caching
  • 🔒 Type-Safe — full TypeScript support
  • 🛡️ Route Guards — access control and transition validation
  • 🔗 Hierarchical Routes — nested routes and dynamic segments
  • 🤹‍♀️ Compatable with Router5 — use your existing router5 routes, plugins and middlewares

🚀 Quick Start

Installation

# Core router
npm install @riogz/router

# For React applications
npm install @riogz/router @riogz/react-router

# For browser integration
npm install @riogz/router-plugin-browser

# For debugging
npm install @riogz/router-plugin-logger

Basic Setup

import createRouter from '@riogz/router'
import browserPlugin from '@riogz/router-plugin-browser'

const routes = [
  { name: 'home', path: '/' },
  { name: 'users', path: '/users' },
  { name: 'users.detail', path: '/:id' }
]

const router = createRouter(routes)
router.start()

// Navigation
router.navigate('users.detail', { id: '123' })

With React

import React from 'react'
import { createRouter, RouterProvider, useRouter } from '@riogz/router'
import browserPlugin from '@riogz/router-plugin-browser'

const routes = [
  { name: 'home', path: '/' },
  { name: 'users', path: '/users' },
  { name: 'users.detail', path: '/:id' }
]

const router = createRouter(routes)
router.usePlugin(browserPlugin())
router.start()

function App() {
  return (
    <RouterProvider router={router}>
      <Navigation />
         <RouteNode nodeName="home">
            <Home />
         </RouteNode>
         <RouteNode nodeName="users" children={Users} />
    </RouterProvider>
  )
}

function Navigation() {
  const router = useRouter()
  
  return (
    <nav>
      <button onClick={() => router.navigate('home')}>
        Home
      </button>
      { /* -or- */}
      <Link routeName="users">Users</Link>
    </nav>
  )

}

📚 Documentation

📦 Package Ecosystem

Core Packages

| Package | Description | Version | Bundle | |---------|-------------|---------|----------| | @riogz/router | Core router | npm | gzip | | @riogz/react-router | React integration with hooks and components | npm | gzip |

Plugins

| Package | Description | Version | Bundle | |---------|-------------|---------|----------| | @riogz/router-plugin-browser | Browser integration (History API, hash) | npm | gzip | | @riogz/router-plugin-logger | Transition logging for debugging | npm | gzip | | @riogz/router-plugin-persistent-params | Parameter persistence between transitions | npm | gzip |

Utilities

| Package | Description | Version | Bundle | |---------|-------------|---------|-----------| | @riogz/router-helpers | Route manipulation utilities | npm | gzip | | @riogz/router-transition-path | Transition path computation | npm | gzip |

🎯 Core Concepts

Hierarchical Routes

const routes = [
  { name: 'app', path: '/app' },
  { name: 'app.users', path: '/users' },
  { name: 'app.users.detail', path: '/:id' },
  { name: 'app.users.detail.edit', path: '/edit' }
]

// Resulting paths:
// app → /app
// app.users → /app/users  
// app.users.detail → /app/users/:id
// app.users.detail.edit → /app/users/:id/edit

Route Guards

const router = createRouter(routes, {
  defaultRoute: 'home'
})

// Guard for authorization check
router.canActivate('admin', (toState, fromState) => {
  return user.isAuthenticated && user.hasRole('admin')
})

// Async guard
router.canActivate('users.detail', async (toState) => {
  const user = await api.getUser(toState.params.id)
  return user.exists
})

Middleware

// Transition logging
router.useMiddleware((toState, fromState) => {
  console.log(`Transition: ${fromState?.name} → ${toState.name}`)
})

// Analytics
router.useMiddleware((toState) => {
  analytics.track('page_view', {
    route: toState.name,
    params: toState.params
  })
})

Route Node Lifecycle


const routes = [
  { name: 'app', path: '/app' },
  { 
    name: 'app.users', 
    browserTitle: 'Users',
    path: '/users',
    onEnterNode: (toState, fromState, deps) => {
      console.log('Entering users node')
    },
    onExitNode: (toState, fromState, deps) => {
      console.log('Leaving users node')
    },
    onNodeInActiveChain: (toState, fromState, deps) => {
      console.log('Users node is in the active chain')
    },
    children: [
      {
        name: 'app.users.detail',
        path: '/:id'
      }
    ]
  }
]

🤝 Compatibility

  • Node.js: 14+
  • TypeScript: 4.0+
  • React: 17.0+ (for @riogz/react-router)
  • Browsers: modern browsers with ES2018 support

📄 License

MIT © Vyacheslav Krasnyanskiy

🤝 Contributing

We welcome contributions from the community! Read the contributor's guide for detailed information on how to contribute to the project.

🔗 Links