6

I'm wondering how service oriented architectures can follow the 12-factor principles.

Designing an architecture as microservices means (to me) that you separate the features in services. This means you have multiple code source for the different services.

The first principle of a 12 factor application is "One codebase". So if we have multiple services, we have several codebases and the first principle is broken.

Are the two architectures mutually exclusive or did I misunderstand something?

0

2 Answers 2

5

Did you click through to the full description of the first factor?

If there are multiple codebases, it’s not an app – it’s a distributed system. Each component in a distributed system is an app, and each can individually comply with twelve-factor.

So when thinking about 12-factor apps in the context of microservices, treat each microservice as a separate app.

2

Microservices need not be in separate codebases. There shouldn't be shared dependencies, and that's certainly harder to maintain in a single codebase, but it's not prohibitive. Having your various microservices in a single codebase has some advantages like easier code searching, nicer commit atomicity, easier code backups, easier authentication/authorization, easier testing and static analysis... It's generally how I've seen them setup.

2
  • 1
    MS don't even need to be implemented with the same stack.
    – Laiv
    Commented Apr 6, 2019 at 9:45
  • 1
    Curiously, the very same Codebase chapter states: Multiple apps sharing the same code is a violation of twelve-factor. The solution here is to factor shared code into libraries which can be included through the dependency manager.
    – Laiv
    Commented Apr 6, 2019 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.