DEV Community

Cover image for Intro: Fullstack JS User Roles & Management

Posted on

Intro: Fullstack JS User Roles & Management


I've been working on developing minimum viable product (MVP) starters since I work with a lot of startups and entrepreneurs. This starter is for B2B businesses, creating a full user-auth workflow with basic user management. I would not consider this a beginner project, as it integrates quite a lot, so if you're just starting out, don't be overwhelmed! Though I hope it can be a useful reference for those looking to expand their skills.

Tech Stack

It uses a Quasar frontend (cross-platform Vue component framework), Feathers backend, Amazon SES for transactional emails, and MongoDB as the datastore. It can be run with Docker Compose, or separately in their respective repos for development.


This starter is relatively basic. It has the following features:

  • User Registration with email verification
  • User Login/Logout
  • Password Reset
  • Update Profile
  • Update Email
  • Update Password
  • User Roles
  • User Administration (update users, including user role, send password reset, deactivate user)

The Series

I'll be breaking this down into a multi-part series. I'm not sure how many parts there will be as of this writing - I'll cover as much makes sense. Leave comments with questions, thoughts, suggestions, and I'll incorporate it into future sections. I'm also open to peer reviews of the code and suggestions for improvement!


Below are some links to technology resources that are used in this project. Otherwise, let's move onto the next part, where I'll review the client code.

The Repository

Note: I would advise against copying/pasting any code snippets found in any article in this series and instead go directly to the repository to view the code. Due to the amount of code involved, I've omitted lines of code in these articles for brevity. Please view the repo for the full source code.

GitHub logo meditatingdragon / quasar-feathersjs-user-management

Sample repository with user management and roles using Quasar and FeathersJS

Tech Links

Top comments (1)

lturel profile image

Hi Rachel,

Thanks for this 3 parts series of posting (User Roles & Management), It is very concise and complete.

I am trying to implement your example with knex and Postgres.
I download and run your code (server/Mongoose and client) and it works fine, super.
Changed the server part, I used knex/postgres instead of mongoose/mongodb.

Progressing step by step, skipping other details, in (server) user.hooks.js

// --------------------------------------
module.exports = {
before: {
all: [],
find: [authenticate("jwt")],
get: [authenticate("jwt")],
create: [hashPassword("password"), verifyHooks.addVerification()],
// create: [hashPassword("password")],
update: [hashPassword("password"), authenticate("jwt")],
patch: [hashPassword("password"), authenticate("jwt")],
remove: [authenticate("jwt")],
// ------------------------------------------------

in "before / create" hook if I run only

create: [hashPassword("password")], it works fine and sends verification e-mail.

but if I add "verifyHooks.addVerification()" parameter,
create: [hashPassword("password"), verifyHooks.addVerification()],

it throws error as:
POST localhost:3030/users 400 (Bad Request) QAjaxBar.js?7ea5:65
and does NOT create a record in postgres database.

Another trial with knex, but SQLITE as the database;
it works fine with "verifyHooks.addVerification()" parameter, sends e-mail and CREATES a record in database, having "isVerified" as 0 (zero). But when I click the link in the e-mail, it doesn't complete verification steps and gives another error.

I used the same (knex) user model for both postgres and sqlite database cases.
// -----------------------------------------------------
.then(function () {

  // Initialize your table
  return db.schema.createTable("users", function (table) {

.then(function () {
  console.log("CREATED USERS table");
.catch((e) => console.error(`Error creating ${tableName} table`, e));
Enter fullscreen mode Exit fullscreen mode

// -----------------------------------------------------

Is that a problem because of postgres' camelcase column name limitations?
What do you think about the source of problem would be?
Did you create any example with knex/Postgres similar to your example?

Thanks in advance for helping ideas on this issue.