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

schema-couch-roles

v0.0.5

Published

Using json-schemas, make a pretty decent couch api. Relationships (and batteries) included.

Readme

schema-couch

Yes, yes, couchdb is schemaless, but sometimes, it is really nice to have a some 'typed' json docs.

schema-couch takes a directory full of schemas, and creates a couchdb design-doc that helps you with doc manipulation, queries and relationships based on those schemas. Validation, navigation, a decent api, all in a very minimal package.

Usage

npm install schema-couch -g

From command-line

schema-couch schemafolder http://admin:admin@localhost:5984/db

In node

var schema_couch = require('schema-couch');

schema_couch(__dirname + '/schemas', 'http://admin:admin@localhost:5984/db', function(err){
    // hey, all done
});

Example

See the example in the exmaple directory

node example/test.js

After it uploads, use futon to create a new doc, like:

{
  type: "quiz"
}

And keep trying to save. The error messages will hopefully guide you.

Relationships

As you can see in the example schemas, some additional (non-standard) properties are used to describe relationships between schemas. Also, a way to create filters of lists, and values that appear in lists. More information will come later as we/you experiment. Feedback welcome.

API

Here are some examples of the api created by the example.

/_design/schema/_rewrite/ -> list all types
/_design/schema/_rewrite/quiz  -> list all quizes
/_design/schema/_rewrite/quiz/schema -> the quiz schema
/_design/schema/_rewrite/quiz/filters -> [category,difficulty], filters you can user
/_design/schema/_rewrite/quiz/filters/category -> list quiz category counts (where category is in quiz.list.filters)
/_design/schema/_rewrite/quiz/filters/category/film -> first level filter
/_design/schema/_rewrite/quiz/filters/catagory/film/5 -> second level filter
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5 -> quiz document
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many -> [submissions, related, subquestions] list the types of children
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/submissions -> list related submissions
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/submissions/filters -> []
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/related/filters -> [category, difficulty]
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/subquestions/filters -> [category, difficulty]
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/subquestions/filters/category -> list quiz category counts
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/has_many/subquestions/filters/category/film ->
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/belongs_to -> [related_from, parent_quiz]
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/belongs_to/related_from -> many docs?
/_design/schema/_rewrite/quiz/id/6366d891e7a1f90bc1092577d6093fa5/belongs_to/parent_quiz -> one doc
/_design/schema/_rewrite/submission -> list all submissions
/_design/schema/_rewrite/submission/filters -> []
/_design/schema/_rewrite/submission/6366d891e7a1f90bc1092577d608be94/has_many -> []
/_design/schema/_rewrite/submission/6366d891e7a1f90bc1092577d608be94/belongs_to -> [quiz, user]
/_design/schema/_rewrite/submission/6366d891e7a1f90bc1092577d608be94/belongs_to/quiz -> one doc
/_design/schema/_rewrite/submission/6366d891e7a1f90bc1092577d608be94/belongs_to/user -> one doc