Microservices: when to apply them and how to maintain their structure in small projects

143

    After six months working full-time in backend development, I've recently talked about the three-layer architecture, a structure that has helped me tremendously to keep the code clean and understandable in every project.
    Today I want to go a step further and talk about something that is constantly mentioned when projects grow: the microservices.


    What is a microservices system

    A microservices system consists of divide a large application into several independent services, where each one fulfills a very specific function. For example:

    • A service for authentication,
    • Another one for data processing,
    • Another one for notifications,
    • And so on.

    Each microservice can be developed with different technologies, have its own database, and communicate with others using APIs.
    The great benefit is that You can scale and deploy each part separately., without an update affecting the rest of the system.

    Microservices Architecture for Enterprise Large-Scaled Application | by Mehmet Ozkaya | Design Microservices Architecture with Patterns & Principles | Medium


    Why microservices are so useful in large projects

    When you work on large projects —especially with multiple developers or teams—, microservices become almost a necessity.
    They allow for the distribution of responsibilities, the reduction of points of failure, and faster deployment.

    Also, if you use Docker containers, You can have each service isolated and controlled, which facilitates continuous integration, testing, and scalability in production environments.

    Therefore, in complex companies or projects, Microservices architecture is practically the current standard. But of course… not all projects need to reach that point.


    And if the project is small… is it worth using microservices?

    This is where the practical part comes in.
    If you're developing it yourself, or the project isn't going to grow much, Creating multiple containers to simulate a complete microservices system can be more of a burden than a benefit.
    More containers means more configuration, more maintenance, and more points where errors can occur.

    But that doesn't mean you have to give up on its structure.


    How to apply microservices logic without splitting everything

    Even if your project is small, You can continue to apply the microservices philosophy within a single container or repository.
    I usually do it this way in my personal projects:
    I maintain a modular structure, where each module of the code represents what in a large system would be a microservice.

    For example:

    /auth ├── routes ├── controllers └── models
    /analytics ├── routes ├── controllers └── models
    /notifications ├── routes ├── controllers └── models
    

    In this way, even though everything runs within a single container, the project It is now ready to grow without disorder.
    And if one day you decide to separate the modules into actual microservices, the jump will be almost immediate, because the structure is already designed for it.


    Modular architecture as an intermediate point

    This way of working allows you to combine the best of both worlds:

    • The simplicity single deployment and lightweight configuration.
    • And the organization and scalability typical of microservices.

    In summary: You don't need a huge project to think like one..
    Designing with a modular mindset from the start saves you a lot of headaches in the future.


    Conclusion

    Microservices are one of the best tools for scaling a system, but they are not always the ideal starting point.
    If the project is small or personal, the smartest thing to do is maintain the microservices structure within a single container, with well-separated modules and clear responsibilities.

    So, when the time comes to grow up, You won't have to redo anything, just divide what is already well designed.

    Because in the end, Good architecture does not depend on the size of the project, but on the clarity with which it is conceived..

    ✉ SHALL WE TALK?

    Let's talk

    If we share interests in artificial intelligence, data, or software development, I'd be happy to exchange ideas. You can also contact me for professional matters.

    Read the blog