Microservice pattern: why you need it and how to implement it in development

Today we will focus on templates that allow our teams to create new microservices in just a few minutes. We will tell you how it works and why this story is not only about the automation of manual labor, but about the effectiveness of development as such.





Many developers use templates in one form or another. Most often, they copy code from older projects to save time. From our point of view, this practice has several disadvantages at once:





1. You can choose an unsuccessful microservice for copying - with missing elements, incorrect settings, etc.





2. If developers do not have a benchmark, the risk of additional errors increases. This means that someone will have to spend extra time to fix them.





3. There is always a risk of overlooking important elements, not noticing a missing pipeline, using an old version of the library, specifying incorrect authorization or logging settings.





In general, if an operation is repeated from time to time, it is already worthy of being automated. But saving time is far from the main advantage of implementing a template.





What the microservice template does

A microservice template is a building block of a software product, a building block that can be reused from project to project.





With its help, you provide teams with a common technological base - everyone works according to the same template, which by default includes all the elements that are needed in the project (we will talk more about the composition of the template below). Developers are freed from both copying code and having to check it again.





And from a business point of view, this is an opportunity to better manage your resources so that the development pipeline moves faster and smoother:





  • Using templates provides developers with consistent quality with fewer resources. It is enough to spend time on the selection of the necessary elements once - and after that all the developers will have ready-made tools at hand.





  • The less time it takes for unnecessary actions, the less time-to-market. Releases are shipped more frequently, the product develops faster.





  • Production Ready. , , Feature Flags, .





  • . ยซยป โ€“ , , , . .





  • , , .. , , โ€“ .





  • - , . , โ€“ . .









  1. Rest API, , ,

















    • (CI/CD)





    • , Observability, , , health check monitoring





  2. , : Git , Jenkins/Gitlab.





.Net

Microsoft Visual Studio :





  • Web API Project - -, HTTP-.





  • Data base project โ€“ .





  • HTTP Service client project โ€“





  • MassTransit consumers project โ€“ RabbitMQ.





  • Job Project โ€“ - .





. UI, :





Visual Studio , .





, , . : , , . โ€“ -, ..





What's next? - We will replicate this experience to other teams. We want to preserve the integrity of the template as much as possible and at the same time make it universal for use in different projects. We will be creating templates for all platforms. This way we will ensure ourselves the same level of quality and a single set of best practices, regardless of the conditions in each case.








All Articles