pallies
v0.9.0
Published
Robust user management for Hapi
Downloads
748
Maintainers
Readme
Pallies
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
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