AdonisJS authentication scaffolding
Flair provides a way to quickly add authentication to your AdonisJS application using TailwindCSS and Alpine.js.
While doing its thing, Flair is going to create and overwrite some files. Hence, Flair is meant to be used on a fresh AdonisJS application. In addition to that, your application should already have the following packages installed and configred:
- Encore (can be easily done at the point of creating the application)
- Lucid
- Auth
- Shield
First, install Flair with your preffered package manager:
npm install @mezielabs/flair
# or
yarn add @mezielabs/flair
# or
pnpm add @mezielabs/flair
Next, configure the package using the configure
command:
node ace configure @mezielabs/flair
This will scaffold and create the necessary files.
Finally, make sure to add the following middlewares inside the start/kernel.ts
file:
Server.middleware.registerNamed({
'...',
guest: () => import('App/Middleware/Guest'),
confirmPassword: () => import('App/Middleware/ConfirmPassword'),
})
Want to learn how to build projects like this with AdonisJS? Check out Adonis Mastery, where you get to learn AdonisJS through practical screencasts.