Matelutex
Matelutex

Reputation: 2210

Microservices + Project in Intellij + Bitbucket

I'd like to ask you about the structure of the project in IntelliJ. I'd like to create my first web application based on microservices architecture.

I'd like to see all microservices in one project in IntelliJ as submodules. My question is if I should commit every microservice into separate repository in BitBucket or all microservices into one repository? What's the best practice?

Thank you, Matthew

Upvotes: 3

Views: 1719

Answers (2)

Harry Coder
Harry Coder

Reputation: 2740

[Late Answer] The purpose of microservice architecture is to have isolated services working together. In practice, in enterprises, each microservice is managed by a single team. It is better to have:

  • Isolated projects, here you are free to use any technology
  • Each project with an associated repository, to be able to manage CI/CD easily and independently.

Read this course for more details, about microservices organization in entreprises. You can find this definition from https://microservices.io/ very useful too:

Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are:

Independently deployable, Loosely coupled, Organized around business capabilities, Owned by a small team

Upvotes: 1

Kaidul
Kaidul

Reputation: 15875

Common practices:

  • Separate microservices as separate project in intellij-idea, not separate module
  • Separate repository for each microservice projects

You need this degree isolation in project level because you will need to create CI/CD pipeline for each microservices which is another characteristics of microservice architecture. If these services are combined into one fat project, it would be hard to provide different version of library dependencies for different microservices (even these services are separated by Docker container when deployed). Each team who are working on different microservices should not be worried about project dependencies of another microservice. Though each microservice is part of a large, composite application, from a developer standpoint, it is important to treat each service as an independent unit of code. This makes it possible to deploy newer versions of services without disrupting the application. CI/CD pipelines should be designed to take advantage of the independent versioning.

There are too many reasons and beyond scope of discussing in one answer why you need to have different projects per microservice, but for now, go for different project and you will discover once you are into microservices realm.

Upvotes: 6

Related Questions