Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It seems like maybe your onion could use an additional layer or two.

If I understand your example, the usual solution is to separate your business objects from your business logic, and add a data access layer between them.

In terms of dependencies, you would want the data access layer module to depend on the business object modules. And your business logic modules would depend on both the data access layer and business object modules. You may find that it is ok to group business objects from multiple domains into a single module.

Note that this somewhat mirrors the structure you might expect to see in a microservices architecture.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: