DEV Community

loading...

Building cloud native apps: Codebase

lukaszbudnik profile image Łukasz Budnik Updated on ・2 min read

Codebase is a first factor mentioned in the twelve-factor app manifest: https://www.12factor.net/codebase.

Although the twelve-factor app was last updated in 2017 I would still put it as a first factor when building my cloud native app. Why? Because everything starts with the code.

When I started my professional IT career I was working with CVS (Concurrent Versioning System), then I was working with Subversion, did one project in Mercurial, but fell in love with Git.

Git and GitOps

Git is the undisputed king of version control systems. Git makes the dev world go round - it is the foundation of GitOps and what we can now call everything-as-code paradigm (with the most notable examples like infrastructure-as-code, build-as-code, pipeline-as-code, documentation-as-code, and security-as-code). If you're starting a new project, it must be simply Git.

Monorepo vs. Multirepo

The twelve-factor app touches on an important matter which I would like to repeat here as well.

Every app should have its own codebase. If you're building your cloud native app based on microservices then every service should have its own code repository (multirepo approach). Developers have a tendency to do shortcuts, if multiple apps are stored in a single repo (monorepo approach) then there is a risk of referencing other apps/components directly and thus breaking the clear design and component separation. Finally, having one codebase per app simplifies a lot of: code management, release management, and everything we can label as CI/CD pipelines.

Hosting

Where to host your codebase? My preference is GitHub. The list of all the available features is mindblowing. Starting with the basic stuff like storing your code, organising your documentation/pull requests/discussion/teams/organisations/projects, running CI/CD workflows, and last but not least running security scans for your code and 3rd party dependencies. It's where I host all my projects and with (not so) recent announcement of unlimited private repos, GitHub made life so much easier. BitBucket is another alternative. Or perhaps if you're going with AWS then you can consider AWS CodeCommit and leverage the power of the AWS platform (IAM and other AWS Code* services).

Just please don't host Git server yourself. There are examples of companies that did it and it didn't go as planned.

Discussion (0)

Forem Open with the Forem app