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

littletrek

v0.1.0

Published

Lightweight zero-dependencies library for routing.

Readme

littletrek

Lightweight zero-dependencies library for routing.

Install

NPM:

npm install littletrek

PNPM:

pnpm add littletrek

Usage

Create an instance of router

import { createRouter } from 'littletrek'

// create router
const router = createRouter()

// setup routes and bind handlers
router
  .get('/users/:id', showUser) 
  .patch('/users/:id', updateUser)
  .delete('/users/:id', deleteUser)
  .get('/users', listUsers) 
  // etc...
  // optionally possible to setup a fallback handler
  .fallback(pageNotFound)

Using inside a ServiceWorker

import { createRouter, bindHistoryAPI } from 'littletrek'

const router = createRouter()

// setup custom route
router.get('/hello/:name', ({ params: { name } }) => {
  const body = `Hello, ${name}!`
  return new Response(body, {
    status: 200,
    headers: {
      'Content-Type': 'text/plain; charset=utf-8'
    }
  })
})

// fallback handler
router.fallback(({ request }) => fetch(request)) // get from network

// add event listener
addEventListener('fetch', evt => evt.respondWith(
  router.resolve(evt.request)
))

// ...

Using History API and frontend-side navigation

History API bindings:

import { createRouter, bindHistoryAPI } from 'littletrek'

const router = createRouter()
// omit setup...

// bind history API
const { connect, disconnect, navigate, back } = bindHistoryAPI(router)

// start routing
connect()

// navigation
navigate('/user/123') // internal navigation
back() // step back

// disconnect history API
disconnect() // as needed 

Route syntax

Route is a string which describes a pattern with a simple syntax.

Pieces of the pattern split by a special character - /, just like a path in a filesystem (e.g. /var/log/messages).

Each piece of the pattern can describe a constant, a name of parameter or can be a special form * for matching with anything.

Constants are consist of characters from limited subset a..z, A..Z, 0..9, ., _, -.

The name of parameters starts with special character : and consist of characters from same limited subset like constants, but must begins with a..z, A..Z or _.

Root route defines as /.

Examples:

  • /user/:id will match /user/18263, /user/nobody, but will NOT match /user/18263/messages, /user/;
  • /messages/*/:messageId will match /messages/alma/0a2c7d1b-09ef-11af-dd07-4b4ca6aebbc7, /messages/302362/7123332, but will NOT match /messages/302362, /messages/302362/7123332/23132;
  • /articles/:slug will match /articles/123, /articles/how-to-write-a-router;

License

MIT