React monorepo using Nx, pnpm and Vite, including:
apps/portal: main frontend portalapps/admin: admin applicationlibs/shared/ui: shared UI library, built as@my-mono-fe/ui(shadcn + Tailwind)
The codebase is managed with a pnpm workspace and orchestrated by Nx. Common commands are grouped in Taskfile.yml and invoked via the task CLI.
- Nx 22 – monorepo management, build/test/lint orchestration
- React 19, React Router 6
- Vite 7 – bundler for
portalandadmin - pnpm – workspace package manager
- TailwindCSS + shadcn/ui (in
libs/shared/ui) - TypeScript 5.9, ESLint, Prettier
- Husky + commitlint – conventional commits (
"prepare": "husky"inpackage.json) - go-task (
Taskfile.yml) – thin wrapper around common Nx/pnpm commands
pnpm installIf Husky is not initialized yet:
pnpm prepareUse task instead of memorizing individual Nx commands:
# Portal (default)
task dev
# Or specify the app
task dev APP=portal
task dev APP=adminDefault dev servers:
portal: http://localhost:4200/admin: http://localhost:4300/
# Build default app (portal)
task build
# Build specific app
task build APP=portal
task build APP=admin
# Build all projects
task build:allBuild Docker image for the app (using the root Dockerfile, currently building portal):
task docker:build # APP=portal (default)
task docker:run # run container locally, map HOST=8080 -> container:80# Test
task test # test default app
task test APP=admin
task test:all # test all projects
# Lint
task lint # lint default app
task lint APP=admin
task lint:all
# Typecheck
task typecheckThese commands wrap nx g for convenience:
# Create a new React app in the monorepo
task new:app NAME=my-new-app
# Create a new React library
task new:lib NAME=my-shared-lib
# Create a new React component in a project (e.g. portal)
task new:cmp NAME=Button PROJECT=portalIf you prefer using Nx directly instead of task:
pnpm nx g @nx/react:app demo
pnpm nx g @nx/react:lib mylibapps/portal– main app, uses shadcn UI from@my-mono-fe/uiapps/admin– admin applibs/shared/ui– shared UI library, exported as the@my-mono-fe/uipackageTaskfile.yml– central place for dev/build/test/lint/generate commandsDockerfile+nginx.conf– build and serveportalas a static site via NGINX
- Getting started with Nx React monorepos: https://nx.dev/getting-started/tutorials/react-monorepo-tutorial
- Running tasks with Nx: https://nx.dev/features/run-tasks
- Generators & plugins: https://nx.dev/concepts/nx-plugins