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

dromos

v1.0.3

Published

A lib that allows to define and build routes eloquently.

Readme

dromos

A lib that allows to define and build routes eloquently

Installing

Using npm:

$ npm install dromos

Using yarn:

$ yarn add dromos

Usage

builder.define

Define your routes

import { builder, Route, Subroute } from 'dromos'

type Routes = {
  profile: Route
  users: Subroute<{
    friends: Route
    properties: Subroute<{
      hotels: Route
      houses: Route
    }>
  }>
  settings: Subroute<{
    general: Route
    password: Route
  }>
}

export const routes = builder.define<Routes>((root) => {
  root.define('profile')

  root.define('users').subroutes((users) => {
    users.define('friends')
    users.define('properties').subroutes((properties) => {
      properties.define('hotels')
      properties.define('houses')
    })
  })

  root.define('settings').subroutes((settings) => {
    settings.define('general')
    settings.define('password')
  })
})

and use it:

routes.profile()._ // → '/profile'

routes.users()._ // → '/users'
routes.users(123)._ // → '/users/123'
routes.users('abc-def')._ // → '/users/abc-def'

routes.users().properties()._ // → '/users/properties'
routes.users().properties('p1')._ // → '/users/properties/p1'
routes.users('u1').properties('p1')._ // → '/users/u1/properties/p1'
routes.users('u1').properties('p1').hotels()._ // → '/users/u1/properties/p1/hotels'
routes.users('u1').properties('p1').houses()._ // → '/users/u1/properties/p1/houses'

routes.users().friends()._ // → '/users/friends'
routes.users().friends('f1')._ // → '/users/friends/f1'
routes.users('u1').friends('f1')._ // → '/users/u1/friends/f1'

routes.settings().general()._ // → '/settings/general'
routes.settings().password()._ // → '/settings/password'

Config

config.notation

allows to specify the notation that will be used to generate pathnames

| Values | | Implementation Status | | -------------- | ------- | --------------------- | | camelCase | default | available | | kebab-case | | available | | snake_case | | available |

Example

import { builder, Config, Route, Subroute } from 'dromos'

const config: Config = {
  notation: 'kebab-case',
}

type Routes = {
  mainPath: Subroute<{
    subPath: Route
    anotherSubPath: Route
  }>
}

export const routes = builder.define<Routes>((root) => {
  root.define('mainPath').subroutes((mainPath) => {
    mainPath.define('subPath')
    mainPath.define('anotherSubPath')
  })
}, config)

// [Usage]:
routes.mainPath()._ // → '/main-path'
routes.mainPath().subPath()._ // → '/main-path/sub-path'
routes.mainPath().anotherSubPath()._ // → '/main-path/another-sub-path'

Options

options.notation

allows to override global config.notation

Example

import { builder, Config, Route, Subroute } from 'dromos'

const config: Config = {
  notation: 'kebab-case',
}

type Routes = {
  mainPath: Subroute<{
    subPath: Subroute<{
      innerSubPath: Route
      anotherInnerPath: Route
    }>
  }>
}

export const routes = builder.define<Routes>((root) => {
  root.define('mainPath').subroutes((mainPath) => {
    mainPath.define('subPath', { notation: 'camelCase' }).subroutes((subPath) => {
      subPath.define('innerSubPath')
      subPath.define('anotherInnerPath', { notation: 'snake_case' })
    })
  })
}, config)

// [Usage]:
routes.mainPath()._ // → '/main-path'
routes.mainPath().subPath()._ // → '/main-path/subPath'
routes.mainPath().subPath().innerSubPath()._ // → '/main-path/subPath/inner-sub-path'
routes.mainPath().subPath().anotherInnerPath()._ // → '/main-path/subPath/another_inner_path'

builder.from

allows to define routes from an Object schema

Define your routes

import { builder, Schema, Route, Subroute } from 'dromos'

const config: Config = {
  notation: 'kebab-case',
}

type Routes = {
  profile: Route
  users: Subroute<{
    friends: Route
    properties: Subroute<{
      hotels: Route
      houses: Route
    }>
  }>
  settings: Subroute<{
    general: Route
    password: Route
  }>
}

const schema: Schema = {
  profile: types.route,
  users: {
    friends: types.route,
    properties: {
      hotels: types.route,
      houses: types.route,
    },
  },
  settings: {
    general: types.route,
    password: types.route,
  },
}

const routes = builder.from<Routes>(schema, config)

// [Usage]:
routes.profile()._ // → '/profile'

routes.users()._ // → '/users'
routes.users('u1').properties('p1').hotels()._ // → '/users/u1/properties/p1/hotels'
routes.users('u1').properties('p1').houses()._ // → '/users/u1/properties/p1/houses'

routes.settings().general()._ // → '/settings/general'
routes.settings().password()._ // → '/settings/password'

Future Plans

→ Add a helper to generate all the paths from defined routes

→ Include options into schema definition: Possible example:

const schema: Schema = {
  profile: types.route,
  users: {
    __options: {
      notation: 'kebab-case',
    },
    properties: {
      hotels: types.route,
      houses: types.route,
    },
  },
}