How to create modules in adonis JS 5? Kind of HMVC

I am working on an enterprise application. The API is made using Adonis. However, with the growing codebase it’s getting difficult to maintain things without modular architecture.

Any suggestions will be appreciated!

Yeah it’s a great problem but you can easily import export and automate your task by creating your own cli…
Here can be a structure of a moduler code…

app/
  UserModule/
      /Models 
      / Controller 
      /Routes 
     ...........
   ChatModule/
      /Models 
      / Controllers
      /Routes 
     ................

You can change the command a bit or create your own to add files like this and using this way. You can set your own classes, helper classes and common classes outside.

2 Likes