How to Add an Admin Interface to Modular Monoliths with Packwerk/Stimpack and Privacy Protections?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Hello everyone… can you chime in with your thoughts on how to add an admin interface (eg, https://activeadmin.info) to your modular monoliths built with packwerk/stimpack? we have privacy protections turned on for our domain subsystem, and are exploring how to expose an admin interface for those private models.

• are you including the admin models in the subsytem(s)?
• are you bundling the admin models in a separate ui-pack, and allowing the privacy violation in the deprecated_references.yml ?
• are you exposing enough CRUD in your pack public API to make the admin gem work/happy?
• is there a way to modify the pack description to allow a privacy violation from specific other packs? eg,

enforce_dependencies: true
enforce_privacy: true
privacy_exceptions:
 - "packs/applications/admin"

since you just added that fourth point, check out @AlexEvanczuk’s latest PRs to packwerk to move privacy violations to a plugin system. That would give the community the ability to implement all the above ideas.

You can get somewhat close to your last bullet by excluding the files in the admin package from packwerk’s analysis altogether.

Yep — I’d say the best options are:

  1. Storing admin concerns within the domain pack (ActiveAdmin can make this challenging in some instances, but its possible and this is what we do).
  2. As Stephan suggested, just having packwerk ignore the admin pack. Big downside here is nothing would be in place to ensure the admin UI is using the same public interfaces as the rest of the system.
  3. Have the admin concerns in a separate pack but require them to use public API. Big downside here is you can’t take advantage of a lot of ActiveAdmin features that rely on being passed an ActiveRecord

Thanks guys! Excellent thoughts.

Message originally sent by slack user U70Y7FMSA5D

We took the approach of each pack having its own admin folder and modified the active admin initializer to

config.load_paths = Dir[Rails.root.join("app", "admin")] +
Dir[Rails.root.join("pocks", "*", "app", "admin")]

Message originally sent by slack user U70Y7FMSA5D

That let us have each pack responsible for its own active admin models.