Hanami project structure


Hi everybody.
I’m new to Hanami and for now something is unclear for me.
I have a question related to project structure.
I have some logic for calculation box size, weight, pack few of them into separate package regarding to some options. I have few services for calculation, some “presenters” for responses and I’m not sure where to place all this logic.
Can I create /apps/web/services and /apps/web/presenters similar like in Rails?
I had a thought to move some logic to /lib directory but I’m not sure if this is a good idea.
Thanks for any help or advise.



Calculations etc. sound like general-purpose code, which is not dependent on being inside web application. I’d put it in lib. Not sure how your presenters look like, but probably they, in turn, more like belong to apps/web/presenters.



I agree with @katafrakt. The calculation for box size, weight and etc is your business logic, and it should not be located on your apps.
Imagine in the future you might want to add an api app to your project, that would reuse your package business logic but would interface with your user in a different way. It would be much easier to handle this if that logic was not dependent on the web app.