DEV Community

Łukasz Budnik
Łukasz Budnik

Posted on • Edited on

Building cloud native apps: Codebase

Everything starts with the code

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

It is the very first factor everyone should consider when building a new 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 manifest also touches on an important matter which I would like to stress 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 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 mind-blowing. 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 could consider AWS CodeCommit and leverage the power of the AWS platform (IAM and other AWS Code* services).

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

Top comments (0)