The most scalable backends are those where the 'what' (business logic) is separated from the 'how' (HTTP/Database).
1Encapsulation
A Service should encapsulate a specific domain or feature. For example, an OrderService would handle everything related to processing payments, calculating taxes, and updating stock levels.
2Dependency Injection
Services often depend on other services or models. By injecting these dependencies rather than hardcoding them, you make your code modular and extremely easy to mock during testing.
3Statelessness
Good services are stateless. They take an input, perform an action, and return an output. They don't store user session data, which makes them easy to scale horizontally.
