Learn how to integrate Bit into a Nx Monorepo, exploring tips and tricks.
Note: The code for the original NX monorepo example is taken from the official nx-recipes/react-monorepo repository.
This example contains two React applications and three shared libraries that started from the react-monorepo preset.
npx create-nx-workspace@latest myngapp --preset=react-monorepo
It contains
- two React application:
apps/react-storeandapps/inventory - three local libraries:
libs/products,libs/ordersandlibs/shared/uito demo how to modularize a codebase - uses Nx module boundary rules to enforce architectural constraints
Follow through the tutorial linked above for more details.
Clone it locally, install all dependencies using npm install. You can then run commands Like
npx nx buildto build the React applicationnpx nx serveto serve the app- you can use
npx nx graphto visualize the structure
You can find the Bit components created for the demo in ashanfernando/bit-with-nx scope in Bit cloud.