A ready-to-use express middleware for authentication.
Last updated a month ago by gwenaelp .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install express-user-management 
SYNC missed versions from official npm registry.


A ready-to-use library for authentication and user management with express.

Uses mongo, passport, and jwt by default.

What does it do?

express-user-management will automatically create API endpoints for :

  • user registration
  • user account activation
  • user login
  • password forgotten
  • password change with a token for the previous route
  • password change when logged in
  • account deletion

It handles everything you need to handle in those routes. You can set various options to adapt it to your project.

It uses nodemailer to send mails, and you can link it easily to your mail service.


npm i express-user-management


const userManagement = require('express-user-management');
userManagement.init(expressApp, options);


Here are the available options with their default values :

const options = {
  /* Adapter to use under the hood. */
  adapter: 'passport-mongo',
  /* Table in the database where users are stored */
  usersTable: 'users',
  /* How API key is handled */
  apiKey: {
    /* Table where to look at API keys */
    table: 'projects',
    /* Key in the document that stores the API key */
    documentKey: 'apiKey.apiKey',
  /* URL of the database */
  mongoUrl: '',
  /* Password reset URL. Used in mail templates below */
  passwordResetAdress: 'http://localhost:30000/resetPassword',
  /* Account activation URL. Used in mail templates below */
  accountActivationAdress: 'http://localhost:30000/activate',
  nodeMailerConfig: undefined,
  /* Whether or not you need to handle account activation on your project */
  activationRequired: true,
  /* Mail templates. See dedicated section in the readme for more info */
  mails: {
    activation: {
      subject: 'Activate your account!',
      sender: '',
      body: `Almost done!
             Please click this link to activate your account!

    passwordReset: {
      subject: 'Password reset link',
      sender: '',
      body: `You are receiving this because you (or someone else) have requested the reset of the password for your account.
            Please click on the following link, or paste this into your browser to complete the process:
            If you did not request this, please ignore this email and your password will remain unchanged.`,


node-mailer is used to handle mailing. Simply put in the options the config object you would give to node-mailer directly.

If no configuration object is provided, mails are not being sent but the output is logged.


This feature is not implement yet!

In order to allow you to execute some arbitrary code when the endpoints are called, some hooks can be provided to the options.

Current Tags

  • 1.5.1                                ...           latest (a month ago)

10 Versions

  • 1.5.1                                ...           a month ago
  • 1.5.0                                ...           2 months ago
  • 1.4.0                                ...           5 months ago
  • 1.3.3                                ...           5 months ago
  • 1.3.2                                ...           5 months ago
  • 1.3.1                                ...           7 months ago
  • 1.3.0                                ...           10 months ago
  • 1.2.1                                ...           10 months ago
  • 1.2.0                                ...           10 months ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (13)
Dev Dependencies (5)
Dependents (0)

Copyright 2014 - 2016 © |