This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.
Hey, I’d like to know how do you handle admin UIs in an app using packwerk
.
Keeping the admin UI for each pack within the pack itself might be a problem when the UI is not a trivial CRUD, and have dependencies on other packs (any other cons?). But at least the admin UI can easily work with AR models (which I think we all agree shouldn’t be part of a pack API).
On the other hand, having the admin UI for each pack on its own separate pack means exposing a CRUD of every resource in the public API of each other pack.
So, in practice, what are you doing in your projects and how do you think it’d be the best way?
It definitely depends for us at Gusto. We tend to have our admin UIs in the same pack as the things that they are a UI for. This makes sense because it follows our other patterns… that is, we put rails controllers, graphQL objects, and more for each pack within that pack, since they are just different types of interfaces to the domain logic.
Once in a while the admin UI has a dependency that the rest of the other pack doesn’t. A big example for us is the god model company. We don’t want that important model to have any dependencies – instead we want things to depend on IT. On the other hand, the admin page (for now) depends on the whole world to show tons of info about a company. We moved the admin UI for a company into a separate pack to represent this.
Message originally sent by slack user U783ITZM13O
@AlexEvanczuk Lets say i am on the god model company. Filling in my information. Do i then see a screen or section on the form with data/form fields that might come from another pack? Is there a plugin system in place that sorta gels it together for a better ux experience?
Do I then see a screen or section … from another pack?
Yes — filling in company information as an admin will include UX from lots of other packs.
Is there a plugin system?
We don’t have one today. You just have to open up the company admin page and modify it to add your own UX. I’ve chatted with some teams internally about the plugin system idea – you can “add to” the company admin page and invert the dependency structure. I’m not sure if this would actually be valuable in practice though.