Workspace - Specific Schematics

Nx helps promote best practices.

Some of the them are well-established in the Angular community. For instance, most non-trivial Angular projects use NgRx, so Nx comes with a set of built-in code generators and runtime libraries to make sure your applications’ state management is consistent. Just run ng g ngrx accounts --module=one/two/app.module.ts to set everything up.

Some, however, are specific to your organization. But Nx can help with those as well. Say, for example, we want to promote a pattern of encapsulating NgRx-related code into data-access libraries. This is how easy it is to do it with Nx:

Start by generating a new workspace schematic. workspace-schematic-1

Then, provide the implementation. workspace-schematic-2

Finally, invoke it to generate a new data-access lib. workspace-schematic-3

Looking for more best practices for enterprise-scale Angular development from the Nrwl team?

Visit Nx Playbook