Is there support for multiple user models in adonisjs

Currently, I wasn’t able to find anything in the docs on how to set it up

this feature would become handy in situation where you want to completely separate the different user types into different user models like (admins, managers, customers):

  1. for the paranoid who would not feel comfortable using same user model for both the admins and customers.
  2. when the different models require different table structure.

this is something that has been done by other nodejs frameworks like loopback but the implementation in loopback was a bit buggy and caused the data for users from different models to leak to each others when they’re using the same user id (even though they’re in two different models) in databases like mysql.

overall i’m really excited for adonisjs 4. it looks really promising and it is right now one of the few nodejs frameworks that are under active development.
i sincerely wish you the best of luck and hopefully and soon enough it will attract the attention that it deserves.


@virk is this something we can do now in Adonis and if not, will it be possible in the foreseeable future?

I haven’t worked much with multiple users system. But I believe you can simply can multiple models for each type of user?

Hello there is already something that knows this need because I am developing an api and authentication has different levels of client is manager, I see no elegant way to get around this problem.

Cerberus can be handy for this situation @brunosousadev: Cerberus - A Hellhound that protect your API endpoints 😈