Search code examples
javaintellij-idearepositorybitbucketmicroservices

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


Solution

  • 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.