Documenting the happy path for implementation via Rails engines #361
-
From the README (bolding the relevant bit)
I liked this approach when I worked at Shopify so much so that I want to recreate it but where I worked our packages were well established and I never saw a new one introduced during my tenure. I think lightly documenting the "how" here to illuminate the "Why" that someone might ask after reading that line in the README would be valuable for myself and the rest of the community. I'm happy to own the documentation contribution but I'd love some input. I'll kickstart this with some initial questions I have:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
I'm still happy to contribute to this but I wanted to circle back after finding a conference talk on YouTube that helps make this more clear: All you need is Rails (Engines): Compartmentalising your Monolith) by @pinzonjulian Which also points to @rafaelfranca's helpful repo rafaelfranca/lego |
Beta Was this translation helpful? Give feedback.
-
Hey @tylerwillingham I'm happy you found my talk! I've been meaning to create content around this topic but haven't gotten around to it but I'm all for helping get these ideas out there. However, I'm not sure if Packwerk is the place to document this because it's a very Rails-specific thing. I'd like to hear Packwerk's maintainers take first before committing to writing about this. As a counter argument, any place is better than no place at all. At least having the discussion is a good place to start. Now, on the specifics on how to create an engine for this purpose:
In my opinion, Rails' plugin generator is not the right tool for the job because it was built for a different use case in mind. As I mention in my talk, it generates more than 80 files that are not necessary to get you started. With a couple of folders and a single class inheriting from
This also assumes the package is a Ruby Gem which as I explored in the talk, it's not necessary. An engine can start as a simple code organisation tool and progress into more complex areas as needed like becoming a gem and managing its own dependencies. Again, not necessary for a simple split.
I'm not sure I understand this question. Is this about when to split your monolith into an engine or is it about when should you consider an engine vs a package (i.e. folder with a package.yml in it)? |
Beta Was this translation helpful? Give feedback.
-
One day we will document this, but not in Packwerk. This isn't really a Packwerk feature, it is a Rails feature that already exists today, just not documented. I have an existing documentation inside our internal library already but I'm not happy with it yet. Mostly because I don't want this documentation to become a reason for people write applications in the way Shopify does as soon as they start the application. I'm a strong believer that people should not start applications in a modular way. This is just like starting applications writing microservices. But, when I find the right and balanced way to write this documentation, it will be written. |
Beta Was this translation helpful? Give feedback.
-
Stopping back in to share another resource for future readers interested. I've been trying to pursue the simplest path without relying on layers of other libraries and experimenting with that in tylerwillingham/overengineered (named so that people don't think this is a recommendation on how to build new apps). Like Julian's example repo and Rafael's, it's using engines with some files removed and a few lines of code in application.rb to load those engines. |
Beta Was this translation helpful? Give feedback.
One day we will document this, but not in Packwerk. This isn't really a Packwerk feature, it is a Rails feature that already exists today, just not documented.
I have an existing documentation inside our internal library already but I'm not happy with it yet. Mostly because I don't want this documentation to become a reason for people write applications in the way Shopify does as soon as they start the application. I'm a strong believer that people should not start applications in a modular way. This is just like starting applications writing microservices.
But, when I find the right and balanced way to write this documentation, it will be written.