$ npx create-nx-workspace nx-monorepo-sample --preset=angular
Note:
Enter application name app1,
and select SASS as default stylesheet format
and select TSLint as default linter
and select No to use Nx Cloud
$ npx nx g @nrwl/angular:app app2
$ npx nx g @nrwl/angular:lib ui
$ npx nx g component header --project=ui --export
Now Add refrence of ui module in both app's main module, and use shared lib in both app.