React Round Up
RRU 081: NX and Monorepos with Jeffrey Cross and Victor Savkin
Jeffrey Cross and Victor Savkin are the cofounders of NRWL. They used to work together at Google on the Angular team and started NRWL so that people could use Angular 2 well. Victor talks about NRWL’s tool NX, which came from the desire to help people develop like the tech giants. Companies like Google and Facebook develop in the same repository so that people can collaborate. NX is an open source tool for this collaborative development, known as a monorepo.
Monorepo style development is a way to develop applications such that you develop multiple projects in the same repository and you use tooling to orchestrate development. The tooling connects everything, makes the experience coherent, and ultimately makes the monorepo style work. The benefits of monorepo development are that the tool chain enables you to interact with different projects in the same fashion, collaboration is more effective, and multiple apps can be refactored at once.
The panel discusses what situations are appropriate for a monorepo and which are not. Victor believes that any company with more than one large product would benefit from a monorepo, but it would not benefit a company that wants to keep their teams distinct from one another. The hosts express some concerns about implementation, such as scaling and creating the infrastructure. Victor assures them that a monorepo is inherently scalable, and most tools will work for years and years. As for the infrastructure, companies like NRWL specialize in helping companies set up monorepos, and NX provides many of the necessary tools for a monorepo. A monorepo can be tailor-made to fit any size of company, and can even be created for already established projects.
If you wanted to start your own monorepo, you can start by taking a project or handful of projects and moving them to the same place. As you develop, pull pieces of your applications out and put them into packages. Victor cautions that monorepos tend towards a single version policy, so you’ll want to get on the same version as your third party dependencies before you move your next application in. You can move things in and temporarily have different versions, but plan to make them the same version eventually.
Victor talks about how the CI in a monorepo setup looks different, because you run tests against everything that might be broken by that change, not just the project its in. So, when you change something in your code, you need to consider what other pieces of code need to be taken into account. A monorepo does make dependencies more explicit, and when you have good tooling it’s easier to see the effect the changes you make have. This is where NX excels. One of the big advantages of NX is that it allows you to partition your application into packages with a well defined API, and prevents the project from becoming one giant node. You can then interact with those packages, and see what happens when you change something. You have a lot more clarity of how your app is partitioned and what the restraints are. NX allows you to share stuff between the front and backend.
The show concludes with the conversation turning to Jeffrey and Victor’s consulting work. They talk about some of the interesting features that are happening outside of React that we are missing out on. Victor is very impressed with tooling in the Angular community. He talks about a tool called Console for NX. They end by talking about the schematic powered migrations in Angular.
Panelists
Leslie Cohn-Wein
Dave Ceddia
Lucas Reis
With special guest: Jeffrey Cross and Victor Savkin
Sponsors
Sustain Our Software
Sentry use the code “devchat” for 2 months free on Sentry’s small plan
My JavaScript Story
Links
NRWL
Angular
NX
Building Fullstack React Applications in Monorepo
Angular CLI
Follow DevChatTV on Facebook and Twitter
Picks
Lucas Reis: