Location of Services in the codebase

It looks like there’s a bit of a confusion of where do services belong in the OFN code base.
I’d like to get that clarified.
As of today we have 2 places where services are:

  • app/services
  • lib/open_food_network


My opinion is that we should use this approach from now on:

  • Services that are related to ofn business logic and could never work without the ofn data model - these should always be under /app/services
  • Generic services that could with more or less effort be extracted into separate gems - these should belong in /lib


On namespaces, I believe most services should be namespaced. We should have very few services directly on /app/services and none on /lib. I think we should get rid of the /lib/open_food_network namespace and have more specific namespaces instead, for example, /app/services/subscriptions, /app/services/reports, /app/services/products and /app/services/enterprise_fees

I’d love to hear your thoughts on this one so we can get to some decisions.

100% aligned. I can’t think of anything to add.

1 Like

That sounds good to me.

1 Like