DEV Community

Cover image for How we reduced our nodejs monorepo build time by 70%

How we reduced our nodejs monorepo build time by 70%

Dima Grossman on January 10, 2022

At Novu, we use a monorepo to manage our 24 libraries and apps. There are many debates over whether you should use a monorepo or a poly-repo. For u...
Collapse
 
olyno profile image
Olyno • Edited

What about yarn berry? I didn't make any benchmark about it, but i'm using it in a lot of project and never got any issue so far. Not sure it's faster than pnpm, but it could be :p

Also, nice article! Thanks you for sharing with us your story!

Collapse
 
killshot13 profile image
Michael R. • Edited

I used berry for quite some time to manage web apps built in a monorepo style. (not nearly as many as 24 applications but usually two or three between frontend and backend plus a couple APIs) It was a love-hate relationship.

Maybe if I had been able to build a brand new app from scratch it would have been easier to transition, but ultimately I ended up going back to NPM after v7 came out and everyone was talking about how they've almost managed to catch up with yarn.

Not going to lie, it's still a tad slower, likely considerably slower for a sizable monorepo, but the familiarity and improved verbosity is so much better than the headache berry was causing me every other week.

Collapse
 
scopsy profile image
Dima Grossman

Actually not heard about berry, i'll check it out. Thank you!

Collapse
 
abobos profile image
Blessing Makaraba

Cool Stuff

Collapse
 
jancizmar profile image
Jan Cizmar

We are just migrating to Turborepo, it seems more simple to use then NX and it should be faster as well.

Collapse
 
scopsy profile image
Dima Grossman

That's cool! Congrats Turborepo is very neat and simple indeed. After doing some readings decided to go with NX. Some of the reasons and data we had based on this and a few other benchmarks: github.com/vsavkin/large-monorepo

Collapse
 
ihaback profile image
ihaback

Thanks for sharing both numbers & github link!
Love seeing real world repos like this 🚀🚀

Collapse
 
scopsy profile image
Dima Grossman

With great love, always trying my best on finding how to give back to this amazing community ❤️

Collapse
 
biswarup35 profile image
Biswarup Bouri

Try Turborepo

Collapse
 
scopsy profile image
Dima Grossman

Actually we tried, decided to go with NX in the end.

Collapse
 
biswarup35 profile image
Biswarup Bouri

Yep, because there's not enough resource available to get started with Turborepo. Anyway build caching feature is amazing I'm love it ❤️

Collapse
 
karthik2265 profile image
Karhik Suryadevara

Iam a little confused, what is monorepo and polyrepo

Collapse
 
scopsy profile image
Dima Grossman

A monorepo contains multiple projects in a single git repository, and polyrepo means that you have one project per github repository. Hope this explains it to you :)

Collapse
 
airtonix profile image
Zenobius Jiricek • Edited

yeah nah.

A monorepo is not merely a repo that holds many projects.

A monorepo is a repo that holds two or more separate projects that can define their relationship through a dependancy graph.

If you can't do this, then it's just a repo.

Collapse
 
karthik2265 profile image
Karhik Suryadevara

Now i understand, Thank you

Collapse
 
lirantal profile image
Liran Tal

Thanks for sharing!

I highly recommend to check out bilt for monorepo management: github.com/giltayar/bilt - would love to hear what you think of it.