Monorepo: Lerna Project Setup — React and Node.js Application under the same umbrella

Shuvo Habib
6 min readFeb 2, 2023
A Lion feeding it’s cubs

In the last few years, Monorepo has gained considerable adoption. People are discussing more and more, if they really need it or not..
In this article, we ‘ll discuss about monorepo along with building your first monorepo lerna project.

Table of contents

  • Prerequisites
  • What is Monorepo?
  • What is Lerna?
  • Setup React.js and Node.js project under the same umbrella
  • Few things to keep in mind, while deciding about Monorepo
  • Conclusion

Prerequisites

  • Node.js Installed
  • NPM Installed
  • Basic idea of React.js or Node.js ecosystem (Although, I have explained each and every lines of code)

What is monorepo?

A monorepo is a centralized repository that stores all the code for multiple projects in one place. This approach to code management can have several benefits, including improved collaboration between teams and individuals, increased code reuse and reduced duplication, and easier management of dependencies and versioning. By having all the code in one place, developers can make changes to the codebase more easily and with more confidence, knowing that any changes will be visible to all other members of the team.

Why Lerna?

Lerna is a popular open-source tool that can help manage a monorepo. It provides features like versioning, publishing, and linking packages together, making it easier to manage multiple projects within a single repository. The benefits of using Lerna include faster builds and development, better control over versioning and releases, and improved reliability and consistency.

How to set up React.js and Node.js application into a single repository or we say a mono repo architecture?

In this section, we’ll be setting up a React and Node.js application in a single monorepo using Lerna. Here are the steps to follow:

--

--

Shuvo Habib

I'm a storyteller about UX, Frontend dev technologies, and A/B testing