The Age of Monorepos

Rate this content
Bookmark

The history of the web can be divided into evolutionary development leaps. The age of inline scripts, the age of jQuery, the age of SPAs, the age of JAMStack...

We are now entering the next stage that has been carefully prepared in the past few years. Let me invite you to the world of modern monorepo solutions and share with you the benefits you will reap by using them in every project size and setup. It's time you automate those boilerplate tasks and reduce the bottlenecks so you can focus on what truly matters.

Get ready for the next leap! Welcome to the age of monorepos!

FAQ

A monorepo, or monolithic repository, refers to a development strategy where code for many projects is stored in the same repository. This approach allows for easier dependency management, more straightforward project tracking, and better collaboration across different segments of an application.

Monorepos improve the developer experience by enabling code collocation, which simplifies dependency management and reduces integration issues. They also facilitate a faster development process by using tools that can pinpoint and build only the affected areas of the repository after changes, thus speeding up testing and deployment cycles.

The key benefits of using monorepos include improved code consistency, simplified project management, enhanced collaboration across teams, and the ability to leverage shared code easily. Additionally, monorepos support advanced features like task orchestration, caching, and distributed task execution to optimize build times and resource usage.

NX is a tool designed to enhance the management of monorepos. It provides functionalities such as intelligent build orchestration and caching mechanisms, which help in efficiently handling multiple interdependent projects within a monorepo. NX also supports distributed task execution and has recently incorporated features from Lerna, another monorepo management tool.

Monorepos address several challenges in web development, including handling dependencies across multiple projects, maintaining consistency in development environments, and streamlining the build process. They help in avoiding integration issues commonly seen with polyrepos and facilitate better resource management during the build and test phases.

Yes, monorepos can provide benefits for even small projects. They offer a structured framework for managing project dependencies and can scale with the project as it grows. The use of tools like NX within a monorepo can help small projects by providing powerful generators and consistent tooling that enhance productivity from the start.

Caching is a critical feature in monorepos that helps reduce build times by storing previously computed results. When a build or test command is run, the system checks if the result is already in the cache. If it is, the cached result is used instead of rerunning the command, significantly speeding up the development process and reducing computational resource usage.

Monorepos can handle multiple versions of the same framework by using hoisted node modules, where each project within the monorepo can maintain its own set of dependencies defined in its package JSON. This setup allows different projects to use different versions of a framework without conflict.

Miroslav Jonas
Miroslav Jonas
25 min
16 Jun, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk is about the world of monorepos, their history, benefits, and features. Monorepos address challenges in web development, such as slow build processes and unstable connections on mobile devices. Collocation in monorepos enables easy sharing of functions and components among projects. Speed and efficiency in monorepos are achieved through collocation, dependency graphs, and task orchestration. Monorepo tools like Learnr offer features such as caching and distributed task execution. Monorepos provide code sharing, consistent tooling, and automated migration, resulting in a 10x developer experience.

Available in Español: La Era de los Monorepos

1. Introduction to Monorepos

Short description:

Thank you all for joining my talk. Today I'm going to be talking about the amazing world of monorepos. But before we dive into that, I have an important disclaimer. In this slide, you will see some examples of extremely bad web design. You will see some flickering colours that might cause happy attacks. And finally, you will see some life-changing features.

Thank you all for joining my talk. Unfortunately, MC decided to resign at the last moment so I have to announce myself, but it's fine. Today I'm going to be talking about the amazing world of monorepos. But before we dive into that, I have an important disclaimer. In this slide, you will see some examples of extremely bad web design. You will see some flickering colours that might cause happy attacks. And finally, you will see some life-changing features. So, if you have medical history with any of these symptoms, perhaps it's better to change the track. Otherwise, I assume you take the full responsibility for being here.

2. Introduction to Web Development History

Short description:

And with that formal note, let me introduce myself. My name is Miroslav Janas. I work for Narval on the tool called nX. Before we dive into what monorepos are, let's take a trip back through history to understand how we got here. In the beginning, the web was static. Pages were boring, but then scripting languages like JavaScript brought dynamicity. As websites became more complicated, single page applications emerged. However, the rise of smartphones brought new challenges with unstable connections.

And with that formal note, let me introduce myself. My name is Miroslav Janas. I work for Narval on the tool called nX, which you're going to hear a lot about today. I also co-organise two meet-ups in Vienna, ViennaJS and AngularVienna.

Now, before we dive into what monorepos are, in order to understand how we come to the point where monorepos are needed, we need to take a trip back through history all the way to the beginning of the web to retrace our steps to see how we got here. Fasten your seatbelts, it's history time.

In the beginning, as you all know, the web was static. It was merely a collection of HTML pages linked with hyperlinks. The first web pages looked something like this Yahoo page. They had lots of text, lots of links, very small images, it was dial up time so things have to be small and fast. Usually, they had a contrasting choice of colours but pages were boring. They were too static, so people came up with graphical format that would shade things a bit. Who remembers this dancing baby? Some pages took this to a whole new level where the entire page was spinning in animations. But you see, it still wasn't what we needed because this was running in a loop, it wasn't controlled animation, it wasn't controlled movement. So Brendan Eich from Netscape, a company producing the popular browser at the time, was given a task to come up with a language in just two weeks that would pick up some ideas from Java and that would finally bring dynamicity to the browser. And two weeks later, LiveScript was born which was later renamed to JavaScript much to the delight of generations of recruiters and headhunters ever since.

And so the age of scripting began and with this we finally had pages that had fancy image galleries, we had crazy menu effects, buttons that would run away from our cursor but the pages, well, they could still look very ugly but now they had controlled movement finally. And as number of scripts on a page grew, we started to encounter certain patterns to recognize certain things that were repeating. At the same time this was a moment of a famous browser wars between Microsoft and Netscape and there was lots of inconsistencies between standards in these two browsers, so developer usually had to implement things for both browsers. Luckily we had now helper libraries, most notably jQuery, which would overcome these differences and would create like a wrapper around DOM manipulation. This would allow you to quickly create your websites. And as websites became more and more complicated, we started calling them web applications, not websites.

But encapsulating DOM and animations wasn't the only boilerplate. There was still a lot to be encapsulated like routing, event management, state management, and this is what led to single page applications. The first world popular framework that implemented single page application was AngularJS, and soon React and Vue followed. All of these are still used today in some variations and they together change our thinking of web development. They set up the web development as we know it today. Unfortunately for them, this was also the time when our phones became smart, and now suddenly we no longer browse the internet on our desktop computers, but we started browsing internet on our mobile phones while sitting on park benches or being in a public transport or sitting on a toilet seat. In these places, connection wasn't really stable. We could hope for 3G at best with lots of interruptions.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
Learn more about how to leverage the default features of npm workspaces to help you manage your monorepo project while also checking out some of the new npm cli features.
End the Pain: Rethinking CI for Large Monorepos
DevOps.js Conf 2024DevOps.js Conf 2024
25 min
End the Pain: Rethinking CI for Large Monorepos
Scaling large codebases, especially monorepos, can be a nightmare on Continuous Integration (CI) systems. The current landscape of CI tools leans towards being machine-oriented, low-level, and demanding in terms of maintenance. What's worse, they're often disassociated from the developer's actual needs and workflow.Why is CI a stumbling block? Because current CI systems are jacks-of-all-trades, with no specific understanding of your codebase. They can't take advantage of the context they operate in to offer optimizations.In this talk, we'll explore the future of CI, designed specifically for large codebases and monorepos. Imagine a CI system that understands the structure of your workspace, dynamically parallelizes tasks across machines using historical data, and does all of this with a minimal, high-level configuration. Let's rethink CI, making it smarter, more efficient, and aligned with developer needs.
Federated Microfrontends at Scale
React Summit 2023React Summit 2023
31 min
Federated Microfrontends at Scale
Top Content
The talk will be a story of how Personio went from rendering through a Monolithical PHP architecture, to a microfrontend oriented Next JS app, powered by Module Federation and the NX monorepo toolchain.
Scale Your React App without Micro-frontends
React Summit 2022React Summit 2022
21 min
Scale Your React App without Micro-frontends
As your team grows and becomes multiple teams, the size of your codebase follows. You get to 100k lines of code and your build time dangerously approaches the 10min mark 😱 But that’s not all, your static CI checks (linting, type coverage, dead code) and tests are also taking longer and longer...How do you keep your teams moving fast and shipping features to users regularly if your PRs take forever to be tested and deployed?After exploring a few options we decided to go down the Nx route. Let’s look at how to migrate a large codebase to Nx and take advantage of its incremental builds!
Remixing Your Stack in a Monorepo Workspace
Remix Conf Europe 2022Remix Conf Europe 2022
22 min
Remixing Your Stack in a Monorepo Workspace
Remix entered the stage with a unique and refreshing take on how to develop on the web. But how do you integrate it into your existing ecosystem of applications? Do you want to test-drive Remix on a small project, or do you want to go full-in, but it is tricky to do a big-bang migration from your existing React app? In this talk, we're going to explore how a monorepo-based code organization can help integrate Remix with your existing React and TypeScript infrastructure, facilitating high code reuse and a migration path to Remix.
Fast React Monorepos with High Quality DX
React Summit 2022React Summit 2022
22 min
Fast React Monorepos with High Quality DX
Monorepos have been around for some time but only recently gained popularity in the JavaScript community. The promise of easily sharing code, better enforcing organizational standards, greater developer mobility due to common tooling, and more is very appealing. Still, if approached naively, a monorepo will quickly turn into a huge mess: skyrocketing slow CI times, spaghetti dependencies among projects, hard to navigate, and ultimately leading to frustration. In this talk, we will look at the available tooling, how to kickstart a new React monorepo in particular, and we will learn the key ingredients required to build a successful, long-running monorepo that scales.

Workshops on related topic

React at Scale with Nx
React Summit 2023React Summit 2023
145 min
React at Scale with Nx
Top Content
Featured WorkshopFree
Isaac Mann
Isaac Mann
We're going to be using Nx and some its plugins to accelerate the development of this app.
Some of the things you'll learn:- Generating a pristine Nx workspace- Generating frontend React apps and backend APIs inside your workspace, with pre-configured proxies- Creating shared libs for re-using code- Generating new routed components with all the routes pre-configured by Nx and ready to go- How to organize code in a monorepo- Easily move libs around your folder structure- Creating Storybook stories and e2e Cypress tests for your components
Table of contents: - Lab 1 - Generate an empty workspace- Lab 2 - Generate a React app- Lab 3 - Executors- Lab 3.1 - Migrations- Lab 4 - Generate a component lib- Lab 5 - Generate a utility lib- Lab 6 - Generate a route lib- Lab 7 - Add an Express API- Lab 8 - Displaying a full game in the routed game-detail component- Lab 9 - Generate a type lib that the API and frontend can share- Lab 10 - Generate Storybook stories for the shared ui component- Lab 11 - E2E test the shared component
Node Monorepos with Nx
Node Congress 2023Node Congress 2023
160 min
Node Monorepos with Nx
Top Content
WorkshopFree
Isaac Mann
Isaac Mann
Multiple apis and multiple teams all in the same repository can cause a lot of headaches, but Nx has you covered. Learn to share code, maintain configuration files and coordinate changes in a monorepo that can scale as large as your organisation does. Nx allows you to bring structure to a repository with hundreds of contributors and eliminates the CI slowdowns that typically occur as the codebase grows.
Table of contents:- Lab 1 - Generate an empty workspace- Lab 2 - Generate a node api- Lab 3 - Executors- Lab 4 - Migrations- Lab 5 - Generate an auth library- Lab 6 - Generate a database library- Lab 7 - Add a node cli- Lab 8 - Module boundaries- Lab 9 - Plugins and Generators - Intro- Lab 10 - Plugins and Generators - Modifying files- Lab 11 - Setting up CI- Lab 12 - Distributed caching