pallies

0.9.0 • Public • Published

Pallies

Build Status Coverage Status

Pallies is a user management plugin for hapi, designed to work best with hapipal.

Resources

Features

  • Supports hapi v18+
  • Built-in support for user invite and forgot password tokens
  • Powerful configuration using Confidence
  • Strong password encryption using Argon2
  • Use any database supported by Knex and Objection

Getting Started

This guide assumes you've already created a hapi project using hpal

Looking for a starting point? Check the Pallies Demo Repo.

Install the Pallies module from npm

npm install --save pallies

Configure Pallies

Create a configuration file at server/.palliesrc.js

Example Pallies configuration

Update Your Manifest

// Register Pallies as a plugin in `lib/plugins/pallies.js
'use strict';

const PalliesConfig = require('../../server/.palliesrc');
const User = require('../models/user');

module.exports = (server, options) => ({
    plugins: {
        options: {
            isDev : options.isDev,
            ...PalliesConfig
        }
    }
});
// Register Schwifty in server/manifest.js
{
    plugin: 'schwifty',
    options: {
        $filter: { $env: 'NODE_ENV' },
        $default: {},
        $base: {
            migrateOnStart: true,
            knex: {
                client: 'pg',
                connection: {
                    host: { $env: 'DB_HOST' },
                    user: { $env: 'DB_USER' },
                    password: { $env: 'DB_PASSWORD' },
                    database: { $env: 'DB_DATABASE' }
                },
                migrations: {
                    stub: 'Schwifty.migrationsStubPath'
                }
            }
        },
        production: {
            migrateOnStart: false
        }
    }
}

Update knexfile.js

Add the Pallies migration directory to your migrations configuration

// ...
migrations: {
    directory: [
        'node_modules/pallies/lib/migrations',
        Path.relative(process.cwd(), PluginConfig.migrationsDir)
    ]
}
//...

Apply database migrations

npx knex migrate:latest

Package Sidebar

Install

npm i pallies

Weekly Downloads

156

Version

0.9.0

License

MIT

Unpacked Size

37.2 kB

Total Files

36

Last publish

Collaborators

  • frxnz