Building an API from the Domain Outwards
When building backend services, it is very easy to start with the framework. Create the controller. Generate the database entity. Add the repository. Then somewhere between HTTP requests and database tables, try to find a place where the business logic fits. I have built many systems this way. It works. Until it doesn’t. Over time I have started moving in the opposite direction: Start with the domain. Everything else is just an adapter. ...