What is a codebase?
A codebase is all the source code for a piece of software, together with the files needed to build and run it. You will hear it next to repository and source code, which mean something slightly different. This page explains all three and how to find your way around a codebase you didn't write.
Codebase, defined
A codebase is the complete body of source code for a program, application or system. It includes the code people wrote and the files that turn it into working software: build configuration, dependency lists, database migrations, scripts and tests.
Codebase vs repository vs source code
| Codebase | Repository | |
|---|---|---|
| What it is | The code of a piece of software | The storage for a project's files and their history |
| Includes history | No, it is the code as it is | Yes, every commit, branch and tag |
| Managed by | The people who write it | A version control system such as Git |
| How many | One product can span several | One can hold one codebase or many (a monorepo) |
Source code is the narrowest of the three: the human-written program text, without build files or history. People use the words loosely, and in a small project all three point at the same folder.
What is in a typical codebase
my-app/
src/ the application code
tests/ automated tests
migrations/ changes to the database schema
scripts/ build and maintenance scripts
package.json dependencies and commands (or pyproject.toml, go.mod, Cargo.toml)
README.md what it is and how to run it
.github/ CI workflows and templatesThe layout varies by language and framework, but most codebases have the same parts: the code, its tests, its dependencies, the way to build and run it, and the configuration for the environments it runs in.
Monorepos and polyrepos
- A monorepo keeps several codebases, such as a web app, an API and shared libraries, in one repository. Changes across them land in one commit, and tooling has to handle the size.
- A polyrepo setup gives each codebase its own repository. Each is smaller and independent, but a change across services needs several coordinated pull requests.
Finding your way around a codebase
Joining an existing codebase is mostly about building a mental map: what the main parts are, where requests come in, and where data is stored. Start from how it runs, find the entry points, then follow one feature from end to end. The guide on how to understand a large codebase walks through it step by step.
Nodeway is a desktop app, free to start, that draws that map for you: it reads a repository on your computer and shows its files, functions, routes and database tables, and how they connect. See what the code map shows.
Questions
What is a repository?
A repository, or repo, is the storage for a project's files together with their full history, managed by a version control system such as Git. It usually holds one codebase, plus everything else the project keeps: documentation, configuration and scripts.
Is a codebase the same as a repository?
Often in practice, but not exactly. The codebase is the code itself. The repository is where it is stored, with its history. One repository can hold several codebases (a monorepo), and one product's codebase can be split across many repositories.
Is it codebase or code base?
Both are used, but codebase, as one word, is now the common spelling.
How big is a typical codebase?
Anywhere from a few hundred lines for a small tool to millions for a large product. Size matters less than structure: a well-organised large codebase can be easier to learn than a tangled small one.