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

feathers-accounts

v0.0.1-1

Published

Token-Based User Account System for FeathersJS

Readme

feathers-accounts

A FeathersJS plugin for simple user signup & login. Its goal is to make authentication easy, while making it easy to use feathers-hooks for access control.

In its current version it only includes the server-side solution. A drop-in client utility is in the master plan.

Getting Started

Setting up feathers-accounts is a three-step process.

1 - The User Service

feathers-accounts uses a regular Feathers service to store accounts. You can pass it any Feathers service that supports at least the find and update methods. Here is an example of creating a feathers-mongodb service:

var fMongo = require('feathers-mongodb');
var db = mongo.db('mongodb://localhost:27017/feathers-tuts');
var userStore = fMongo({collection:db.collection('users')});

2 - The Config Object

The config object is used to configure plugins for auth and communication. There is currently only one plugin, the local plugin, which allows email/password login using tokens instead of cookies. Also for now, feathers-accounts is tightly coupled with the Mandrill email service, so the config object must have all of the attributes in the example below in order to work properly. In the below example, we are passing the userStore that we just created, above, in as the config.store attribute.

var config = {
    store:userStore,
    // Using the `local` plugin for token login.
    local:{
        id:'_id',
        // Make your own unique secret. Used for token generation.
        secret:'A1E7YYKDOYWs9t9Bf2JbJsatbNaplF01',
        // The Mandrill configuration.
        mandrill:{
            key:'fVyBlahBlahbFMGBlahx-A',
            from_email:'[email protected]',
            from_name:'Feathers Tuts',
            subaccount:'feathers-tuts',
            website:'',
            verifyURL:'/#!verify'
        }
    }
};

3 - Register the Plugin

The final step is to register the plugin with the feathers app. Use this first line of code to turn on all of the REST routes for user signup and authentication:

// Turn on REST routes for authentication.
app.configure(accounts(config))

This next bit will setup authentication data on new Socket.io connections that use an auth token string:

// Adds the authentication data to new socket connections.
app.configure(feathers.socketio(function(io){
    accounts.socket(io);
}))

4 - Use feathers-hooks for Access Control

// TODO: Finish documenting feathers-hooks

Bringing it all together

Here is an example server.js file to get you started:

'use strict';

var feathers = require('feathers'),
  hooks = require('feathers-hooks'),
  mongo = require('mongoskin'),
  fMongo = require('feathers-mongodb'),
  bodyParser = require('body-parser'),
  accounts = require('feathers-accounts');

var db = mongo.db('mongodb://localhost:27017/feathers-tuts');
var userStore = fMongo({collection:db.collection('users')});

var config = {
    store:userStore,
    // Using the `local` plugin for token login.
    local:{
        id:'_id',
        // Make your own unique secret. Used for token generation.
        secret:'A1E7YYKDOYWs9t9Bf2JbJsatbNaplF01',
        mandrill:{
            key:'fVyBlahBlahbFMGBlahx-A',
            from_email:'[email protected]',
            from_name:'Feathers Tuts',
            subaccount:'feathers-tuts',
            website:'',
            verifyURL:'/#!verify'
        }
    }
};

var app = feathers()
    .use(feathers.static(__dirname + '/public'))
    .configure(feathers.rest())
    .use(bodyParser())
    // Turn on REST routes for authentication.
    .configure(accounts(config))
    // Adds the authentication data to new socket connections.
    .configure(feathers.socketio(function(io){
        accounts.socket(io);
    }))
    // Enable hooks after auth. Lets us handle auth inside hooks.
    .configure(hooks())
    .configure(feathers.errors());

// Create a todos service.
var todoStore = fMongo({collection:db.collection('todos')});



app.use('api/todos', todoStore);

// Start the server.
var port = 8080;
app.listen(port, function() {
  console.log('Feathers server listening on port ' + port);
});