Technology

Monorepo Is Code Colocation ?

Understand the difference between monorepo and code colocation

Author Image

Nabeel Shakeel

Mon Nov 27 2023
LinkedIn Icon

While working on a project, I was assigned the task of re-organizing the frontend code into a monorepo. The codebase consists of two frontend apps, the customer portal and the admin panel, along with backend and infrastructure code.

First, it looked to me that it was already a mono-repo but then I learned that there is another concept called code colocation. We often see this pattern followed in organizations where in a single repository we have distinct folders for backend code, frontend code and infra related configs.

What do you call it ? A monorepo OR a code co-location

It's code colocation. Yes!

Monorepo is not just code colocation, it’s more than that. Let’s define it in simple terms:

A monorepo is a single repository containing multiple distinct projects, with well-defined relationships.

So, a repository containing the codebase of several projects without division and relationships among them, then it’s just a big repo. For a monorepo to exist, there should be a well-defined relationship among them.

You can read more about monorepos, why its exists and its features, and the tools available to make monorepos development easier

How I setup it

I used yarn workspaces for the base structure of monorepo. It works on the concept of workspaces. Workspaces are the building blocks of monorepo. Each app and package we add in our monorepo is a workspace and managed by package manager.

For improving the DX (Developer Experience) and handling maintenance overhead, I use Turborepo, a powerful build system optimized for Javascript and Typescript.

It helps us in speeding up the development both on the local machine and CI/CD by providing:

  • Local computation caching
  • Distributed task execution
  • and many more!

You might also be interested in...

Blog Main Image

Navigating the AI Revolution: Transformations, Triumphs, and Trials

Written by Aamir Saeeduddin

Artificial Intelligence (AI) is no longer a fragment of imaginative fiction. It's a pulsating reality, reshaping industries, and determining the trajectory of economies.

Fri Sep 15 2023 Read More
Blog Main Image

React-Vue Micro-Frontend Application using Webpack 5 Module Federation

Written by Nabeel Shakeel

Implementation of micro-frontend application in React and Vue using Webpack 5 Module Federation plugin and Nx

Thu Nov 03 2022 Read More
Blog Main Image

Unlocking Growth: Strategies for AI transformation for mid-sized Businesses

Written by Aqil Khan

Many organizational leaders recognize the transformative potential of artificial intelligence (AI), yet the prospect of initiating an AI journey can be daunting. In this article, we answer how to approach these questions: Would my business benefit from adopting AI? Would it cost me a fortune? Would it take a lifetime? By providing clarity on these points, we aim to empower leaders with the knowledge to make informed decisions about integrating AI into their business strategies.

Tue Aug 06 2024 Read More
WhatsApp Icon