Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including derby-user with all npm packages installed. Try it out:

var derbyUser = require("derby-user")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

derby-user v1.2.0

A user management system for the Derby JS framework.

Derby User

A user library for Derby JS. It uses Passport for authentication and Credential for storing hashes.

Build Status


$ npm install derby-user --save

Server Usage

In your server file, add the middleware:

var user = require('derby-user');

  // ...
  // ...
  // cookieParser, session, transport, model, bodyParser...
  // ...
  // ...
  // app.router, expressApp.router
  .use('/user', user.routes())

App Usage

Example route:

// subscribe to current user in each route
app.get('*', function (page, model) {
  var userId = model.get('');
  var user ='users.' + userId);
  model.subscribe(user, function (err) {
    if (err) return next(err);
    model.ref('_page.user', user);

Example signin controller function:

app.proto.signin = function (username, password) {
  var model = this.model;
  $.post('/user/signin', {
    username: username,
    password: password
  }).done(function (data) {

Example signin view:

<form on-submit="signin(username, password)">
  <input type="text" value="{username}">
  <input type="password" value="{password}">


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free