This is how I tend to think about code that goes in lib/
:
- It is not coupled to my app’s domain models.
- It can be reused on other projects.
- It can potentially become its own gem. Thus, putting it in
lib/
is the first step in that direction.
Services:
- They tend to know a decent amount about the inner workings of domain models.
- Perform work that is specific to business domain in my app.
- Tend to be coupled to specific models.