Libraries & Monorepos

The Good

B. Chepkorir
SD Tidbits
2 min readAug 27, 2022

--

Photo by Marina M

While monorepos may not be for every project, they can solve some hassles in development. Like, when building custom component or utility libraries.

When working on an Angular/React library, you often need to make and test changes concurrently. To verify that they work or look right.

Of course, there are tools like Storybook or npm link, that when set up correctly are useful for library development too. They are saving graces and then some. However, if you wanna make more out of a library update than just the update. Consider an efficient build system like Nx for a monorepo.

It’s been around for 4+ years with a significant number of adopters — so you know it’s battle-tested. It also plays the agnostic game. So, you can use it for Angular and React projects. Its docs are also detailed which is useful for set-up and development. Configuration and start-up were also seamless when compared to set-ups I’ve tried with alternatives.

With Nx, you can create a publishable library and an application in the same workspace. The app can use the library within the workspace, and other apps can install the published library from a registry.

During development, the changes made in the library are reflected in the running application in the browser. Effectively making development and testing concurrent — skipping the linking step. It also makes testing and using the library a 1 commit and 1 repo change. Or, 2–5 commits 👀

--

--

B. Chepkorir
SD Tidbits

Software Development Enthusiast | Writer on Code Like A Girl & FreeCodeCamp -- I "talk" fast