What are Monorepos

Share this video with your friends

Social Share Links

Send Tweet

A monorepo is a group of small projects that can be combined to build bigger projects, or they could just be small projects that doesn't know anything about the other projects.

One great thing about monorepos is that the code is available for everyone at every time. If you are a frontend engineer, and you're working in the blog application and you see that there is a bug in the backend application, you can go and fix it right away.

Instructor: [0:00] Let's talk about monorepos. A monorepo is a group of small projects that can be combined to build bigger projects, or they could just be small projects that doesn't know anything about the other projects.

[0:15] For instance, you can take Next.js as an example. The Next.js project is a monorepo that contains many projects inside of it. For instance, in a monorepo, you could have a blog application, a backend application, and a dashboard application, and those application, they don't know anything about each other. They are completely independent.

[0:36] In a monorepo, you could have shared packages. For instance, we have this lib1, lib2, and lib3. They share code between some of the applications. If we were not using a monorepo, we could have this lib1 as an npm package, and we would have to publish it alone and then make blog application and dashboard application consume them.

[1:02] One great thing about monorepos is that the code is available for everyone at every time. If you are a frontend engineer, and you're working in the blog application and you see that there is a bug in the backend application, you can go and fix it right away.

[1:17] You don't have to clone a different repo. You don't have to open a peer in a different repository. All that you have to do is to open the backend application, fix the bug, and then push a fix, and it will fix the bug for every other application that uses it.

[1:33] For instance, if you have TypeScript types in the backend application, and you want to share them with the frontend, you can do it. You can just put those types in this lib2, for example, and then share them with the blog application.

[1:47] It's important to know that a monolith is different from a monorepo. A monolith is a group of projects that can form one big project. In this case, it's this application, and this application depends on all these shared packages.

[2:05] For instance, if you break something in this shared package, you don't know if this shared package is going to break, or this is going to break, or this is going to break, because there are no clear boundaries between them. If you remember, in the monorepo, we have the libs completely isolated from each other, but here, everything depends on everything.