[ $davids.sh ] โ€” david shekunts blog

๐Ÿ’‰ Microservices by Dependency ๐Ÿ’‰

# [ $davids.sh ] ยท message #247

๐Ÿ’‰ Microservices by Dependency ๐Ÿ’‰

Building on previous posts (1, 2), I want to highlight another reason for splitting into microservices.

#microservice

  • @ [ $davids.sh ] ยท # 1520

    Sometimes you need to add a large set of features that could conditionally be a separate "mini-product" that integrates with yours.

    For example, your system's clients use it for their clients and want you to add the ability to bill their clients.

    In fact, this is not part of your platform and could be implemented through your external API as a separate application.

    But for one reason or another, you want to be able to reuse some of the infrastructure and codebase, so it makes sense to build this mini-product as a microservice, but within your monorepo.

    It can also make direct requests to the main database (to avoid creating additional endpoints), BUT only to tables it reads from. All tables it writes to must be unique to this service.

    Also, it's important that the main codebase doesn't change for this service; at most, new features that might be of interest to this mini-product are added.

    That is, the main product should not depend on the mini-product, but the mini-product will depend on the main one.

    And in such a situation, separating it into a microservice is an excellent idea, because then the main product's codebase will be safe, plus a tired developer will be prevented from breaking this dependency when writing code.

    You could call this "responsibility," but what's more important here is who depends on whom and adhering to that dependency.