Nitrokit Nitrokit - Ship faster with AI - No more heavy lifting, build Angular apps at NITROSPEED!

Documentation

Generators

Documentation on Nitrokit's generators

Nitrokit relies heavily on NX generators to do heavy lifting for you! It contains over 35 generators and growing. This contains a bunch of information about the generators... But... You don't even need to know the essentials anymore because Nitrokit is shipped with an AI assistant That AI assistant knows all the nitty-gritty details about those Generators and will execute them for you! You can talk to the AI assistant and it will help you generate whatever you need. Just run :

npx nx run code-assistant:serve

And...

npx nx run code-assistant-electron:serve

Screenshot 2024-10-29 at 21.00.22.png Here is the complete documentation for all your Nx generators, following the specified structure. This is a detailed markdown format for each generator.

Here's a glossary for the Nitrokit Nx Generators documentation, with links to each generator's documentation section:


Glossary of Generators



AI Generator

Goal

Generate anything with AI by leveraging automated processes to simplify complex tasks.

Description

This generator lets AI handle tasks and generation steps that would otherwise require manual effort.

Properties

Property Type Description Required Default
message string The message for the generator Yes
multiple boolean Whether the command contains multiple tasks No false

AI-based

Yes, this generator uses AI for task execution.

Element-based

No, this generator does not produce elements directly.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:ai --message="Generate a dashboard component" --multiple=true

Util Generator

Goal

Generates a utility function in a specified library project.

Description

This generator creates a new utility function within the lib/utils directory of a target library project.

Properties

Property Type Description Required Default
name string The name of the utility function Yes
project string The library project to generate the utility within Yes
exports boolean If set, exports the utility in the barrel file No false
message string Message explaining what to create with AI No

AI-based

Yes, this generator uses AI capabilities for enhanced generation options.

Element-based

Yes, this generator is for generating elements within the library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:util --name=myUtil --project=myLib --exports=true

Concat Generators

Goal

Creates a JSON file aggregating details about all the available generators.

Description

This generator scans all generators in the directory and compiles their properties, tasks, required fields, and metadata into a JSON file, which can be utilized for further context in prompts for language models.

Properties

No properties required.

AI-based

No, this generator does not use AI capabilities.

Element-based

No, this generator does not generate elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:concat-generators

Refactor Library Generator

Goal

Refactor, remove, or rename an existing library project by adjusting its scope, type, or name.

Description

This generator enables flexible refactoring of a library project, changing its name, directory structure, and import paths, based on provided scope, type, and name properties.

Properties

Property Type Description Required Default
project string The name of the library project to refactor Yes
type string The type (ui, data-access, feat, etc.) of the library No
scope string The scope of the library project No
name string The new name of the library No

AI-based

No, this generator does not utilize AI.

Element-based

No, this generator does not generate new elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:refactor-lib --project=myLib --type=ui --scope=auth

Remove Library Generator

Goal

Remove an entire library project from the workspace.

Description

This generator deletes a specified library project and updates dependencies and imports to ensure proper configuration.

Properties

Property Type Description Required Default
project string The project name of the library to remove Yes

AI-based

No, this generator does not use AI.

Element-based

No, this generator does not generate new elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:remove-lib --project=myLib

Remove Element Generator

Goal

Remove an element (such as a component or service) from a specified project.

Description

This generator deletes a specified element from a library or application project, updating any dependencies or imports that rely on the element.

Properties

Property Type Description Required Default
project string The name of the project that contains the element Yes
filename string The filename of the element to be removed Yes

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator is used for elements within a project.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:remove-element --project=myLib --filename=foo.smart-component.ts

Move Element Generator

Goal

Move an element from one library project to another.

Description

This generator moves an element from one library to another, updating all dependencies and imports to reflect the new location.

Properties

Property Type Description Required Default
project string The current library project of the element Yes
newProject string The destination library project for the element Yes
filename string The filename of the element to move Yes

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator applies to elements within a library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:move-element --project=libA --newProject=libB --filename=myComponent.util.ts

App Generator

Goal

Create a new Angular application with optional libraries and components.

Description

This generator builds a new Angular application with a specific structure, including optional components, features, and libraries based on user input.

Properties

Property Type Description Required Default
name string The name of the application Yes
prefix string Prefix for component and directive selectors No
supabaseUrl string Supabase project URL No
supabaseKey string Supabase project key No
search boolean Enables search functionality No true

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a full application structure, not a single element.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:app --name=myApp --prefix=app --supabaseUrl="https://xyz.supabase.co" --supabaseKey="your-key"

Facade Generator

Goal

Generate a facade for a feature library.

Description

This generator ensures the target project exists and generates facade files in the lib directory, optionally exposing state.

Properties

Property Type Description Required Default
name string The name of the entity to create a facade for No
project string The target library for the facade Yes
exposeState boolean Optionally expose state in the facade No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator generates a facade as an element.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:facade --name=User --project=libA --exposeState=true

Here's the complete documentation for these additional generators in the specified Markdown format:


Library Generator

Goal

Creates an Angular library of a specified type within a given scope.

Description

This generator creates various types of Angular libraries (ui, data-access, feat, util, type, state, guard, backend, const) under a specified scope, allowing for scoped library generation, routing setup, and component customization.

Properties

Property Type Description Required Default
name string The name of the library Yes
type string The type of library (ui, feat, data-access, util, etc.) Yes
scope string The scope or domain the library belongs to Yes
routing boolean Enables router configuration for lazy-loaded libraries No false
search boolean Adds search route No false
shellProject string Connects routing to a specified shell project No
overrideUnexistingScope boolean Prevents error if the scope doesn't exist, allowing creation of new scope No false

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates full libraries, not individual elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:lib --name=myLib --type=feat --scope=auth --routing=true --shellProject=myShell

Service Generator

Goal

Generates a service within a specified library.

Description

This generator creates a service within the lib/services directory of the chosen library, ensuring that the target project is of an appropriate type (e.g., data-access, ui, feat, guard, state, or util).

Properties

Property Type Description Required Default
name string The name of the service Yes
project string The library project where the service will be added Yes
exports boolean If true, exports the service in the barrel file No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a service as an element in the library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:service --name=myService --project=myLib --exports=true

Shell Library Generator

Goal

Creates a "shell" feature library for an Angular application.

Description

This generator creates a feature library named feat-shell with lazy-loaded routing for the specified application, customizing the shell with a facade for state management and a smart entry component (shell-entry).

Properties

Property Type Description Required Default
application string The application that the shell library belongs to Yes
search boolean Indicates if search functionality is required No false

AI-based

No, this generator does not use AI.

Element-based

No, this generator generates a complete library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:shell --application=myApp --search=true

Smart Component Generator

Goal

Generate a smart component in a feature library.

Description

This generator creates a smart component within the specified feat library’s lib/components/smart directory, using options for customizing the component name and export status.

Properties

Property Type Description Required Default
name string The name of the smart component Yes
project string The library project where the component is added Yes
exports boolean Indicates if the component should be exported No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a smart component as an element in a feature library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:smart-component --name=myComponent --project=myLib --exports=true

Constant Generator

Goal

Generate a constant within a specified library.

Description

This generator creates a constant in the lib/constants directory of the specified library, ensuring the target project is of an appropriate type (data-access, ui, feat, guard, state, util, const, or type).

Properties

Property Type Description Required Default
name string The name of the constant Yes
project string The library project where the constant is added Yes
exports boolean Indicates if the constant should be exported No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a constant as an element in the library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:const --name=myConstant --project=myLib --exports=true

Data Test IDs Generator

Goal

Generate data-testid attributes for a specific component's HTML.

Description

This generator adds data-testid attributes to a component's HTML, ensuring the target project and component exist.

Properties

Property Type Description Required Default
filename string The filename of the component Yes
project string The library project where the component resides Yes

AI-based

Yes, this generator uses AI to generate data-test IDs.

Element-based

Yes, this generator is used for generating test attributes in component elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:data-testids --filename=myComponent --project=myLib

---Here's the complete documentation for each generator:


Type Generator

Goal

Generates a new type in a specified library project.

Description

This generator creates a type in the lib/types directory of a specified library project, ensuring the project exists and is of the correct type.

Properties

Property Type Description Required Default
name string The name of the type Yes
project string The library project where the type is generated Yes
exports boolean Export the type in the barrel file if set to true No false

AI-based

Yes, this generator uses AI.

Element-based

Yes, this generator creates a type element in the library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:type --name=myType --project=myLib --exports=true

Form Generator

Goal

Generates a form component in the specified directory.

Description

This generator creates a form component with OnPush change detection, ensuring it’s generated only in ui or feat libraries. It allows customization of primary fields and an AI-driven message for specific form details.

Properties

Property Type Description Required Default
name string The name of the form component Yes
project string The library project where the form is generated Yes
primaryField string The primary field name for setting up the component No name
message string AI-driven message for specific implementation details No
exports boolean Export the component in the barrel file if set to true No false

AI-based

Yes, this generator uses AI.

Element-based

Yes, this generator creates a form component.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:form --name=myForm --project=myLib --primaryField=name --message="Detailed form generation"

Interface Generator

Goal

Generates an interface within a library project.

Description

This generator ensures the specified project exists and is valid, generating an interface in the lib/interfaces directory.

Properties

Property Type Description Required Default
name string The name of the interface Yes
project string The library project where the interface is added Yes
exports boolean Export the interface in the barrel file if true No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates an interface.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:interface --name=myInterface --project=myLib --exports=true

Pipe Generator

Goal

Generates a pipe within a feature (feat) or UI (ui) library.

Description

This generator creates a pipe in the lib/pipes directory, with options to customize naming and exports, ensuring the library is of the correct type.

Properties

Property Type Description Required Default
name string The name of the pipe Yes
project string The library project where the pipe is generated Yes
exports boolean Export the pipe in the barrel file if true No false

AI-based

Yes, this generator uses AI.

Element-based

Yes, this generator creates a pipe.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:pipe --name=myPipe --project=myLib --exports=true

UI Component Generator

Goal

Generate a UI component within a feature (feat) or UI (ui) library.

Description

This generator creates a UI component with options for customizing exports and enabling OnPush change detection. It ensures the library project is of the correct type.

Properties

Property Type Description Required Default
name string The name of the UI component Yes
project string The library project where the component is added Yes
exports boolean Export the component in the barrel file if true No false
onpush boolean Enable OnPush change detection if true No true

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a UI component.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:ui-component --name=myComponent --project=myLib --exports=true

Directive Generator

Goal

Generate a directive within a specified library.

Description

This generator creates a directive in the lib/directives directory, validating that the project exists and is of the correct type.

Properties

Property Type Description Required Default
name string The name of the directive Yes
project string The library project where the directive is added Yes
exports boolean Export the directive in the barrel file if true No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a directive.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:directive --name=myDirective --project=myLib --exports=true

DTO Generator

Goal

Generate a DTO (Data Transfer Object) within a data-access library.

Description

This generator creates a DTO file in the lib/dtos directory of the specified data-access library project.

Properties

Property Type Description Required Default
name string The name of the DTO Yes
project string The library project where the DTO is generated Yes
exports boolean Export the DTO in the barrel file if true No false

AI-based

Yes, this generator uses AI.

Element-based

Yes, this generator creates a DTO.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:dto --name=myDto --project=myDataLib --exports=true

State Machine Generator

Goal

Generate a state machine in a specified library.

Description

This generator creates a state machine file in the lib/state-machines directory, ensuring the target project exists and is of the correct type (ui, feat, state, or guard).

Properties

Property Type Description Required Default
name string The name of the state machine Yes
project string The library project where the state machine is added Yes
exports boolean Export the state machine in the barrel file if true No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a state machine.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:state-machine --name=myStateMachine --project=myLib --exports=true

Interceptor Generator

Goal

Generate an interceptor in a data-access library project.

Description

This generator creates an interceptor in the lib/interceptors directory, validating that the target project exists and is of the correct type (data-access).

Properties

Property Type Description Required Default
name string The name of the interceptor Yes
project string The library project where the interceptor is added Yes
exports boolean Export the interceptor in the barrel file if true No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates an interceptor.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:interceptor --name=myInterceptor --project=myDataAccess --exports=true

Guard Generator

Goal

Generates a guard within a feature or guard-specific library.

Description

This generator creates a guard file in the lib/guards directory, validating that the project is of the correct type (feat or guard).

Properties

Property Type Description Required Default
name string The name of the guard Yes
project string The library project where the guard is generated Yes

| | | exports | boolean | Export the guard in the barrel file if true | No | false |

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a guard.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:guard --name=myGuard --project=myLib --exports=true

Data Service Generator

Goal

Generate a data service within a data-access library.

Description

This generator creates a data service in the lib/data-services directory, ensuring the target project exists and is of type data-access.

Properties

Property Type Description Required Default
name string The name of the data service Yes
project string The library project where the service is added Yes
exports boolean Export the data service in the barrel file if true No false

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a data service.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:data-service --name=myDataService --project=myDataLib --exports=true

Here's the Markdown documentation for each additional generator:


Supabase Library Generator

Goal

Creates a Supabase library within a specified scope.

Description

This generator sets up a new backend library for Supabase within the specified scope, configuring necessary Supabase settings and linking the project appropriately.

Properties

Property Type Description Required Default
scope string The scope (domain) the library belongs to Yes
overrideUnexistingScope boolean Prevents errors if scope does not exist No false

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a full library, not individual elements.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:supabase-lib --scope=auth --overrideUnexistingScope=true

CRUD Create Component Generator

Goal

Generates a "Create" component for CRUD operations within a feature library.

Description

This generator creates a "Create" component, checking that the target project exists as a feature library, generating a form component if needed, and customizing the output based on the provided entity name, path, primary field, and scope.

Properties

Property Type Description Required Default
name string The name of the entity (singular) Yes
entityPath string The entity path, such as the Supabase table name Yes
project string The project where the component is generated Yes
primaryField string The primary field for setup No name

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a smart CRUD component.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-create --name=Product --entityPath=products --project=myFeatureLib --primaryField=id

Supabase Type Generator

Goal

Creates types for a Supabase entity.

Description

This generator creates type files for a specified Supabase entity, generating Row, Insert, and Update types within the type-supabase directory and exporting them in the index.ts barrel file.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
scope string The scope (domain) of the library Yes

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a set of types.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:supabase-type --name=Product --entityPath=products --scope=auth

CRUD Detail Component Generator

Goal

Generates a "Detail" component for displaying CRUD entity details.

Description

This generator creates a "Detail" component for an entity, verifying the project is a feature library, and checking if a form component exists (generating one if needed). The output is customized based on entity name, path, primary field, and scope.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
project string The project where the component is generated Yes
primaryField string The primary field for setup No name

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a smart CRUD detail component.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-detail --name=Product --entityPath=products --project=myFeatureLib --primaryField=id

CRUD List Component Generator

Goal

Generates a "List" component for displaying CRUD entities.

Description

This generator creates a list component for CRUD entities within a feature library, verifying that the specified project exists. It checks if a form component is present for the entity and generates one if necessary.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
project string The project where the component is generated Yes
primaryField string The primary field for setup No name

AI-based

No, this generator does not use AI.

Element-based

Yes, this generator creates a smart CRUD list component.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-list --name=Product --entityPath=products --project=myFeatureLib --primaryField=id

CRUD Feature Library Generator

Goal

Creates a feature library for a specified CRUD entity.

Description

This generator creates a feature library in the specified scope, configured with routing, and integrates it into a shell project. It generates components for list, create, and detail views, a facade for state management, and customizable options for the entity.

Properties

Property Type Description Required Default
name string The name of the entity (singular) Yes
scope string The scope (domain) of the library Yes
entityPath string The path to the Supabase entity or table Yes
search boolean Enables a search route No true
primaryField string The primary field for setup No name

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a complete CRUD feature library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-feat-lib --name=Product --scope=auth --entityPath=products --search=true

CRUD State Library Generator

Goal

Creates a state management library for a specified CRUD entity.

Description

This generator creates a library in libs/{scope}/state-{name} for managing the state of the specified entity, with a customized state machine.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
scope string The scope (domain) of the library Yes

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a state management library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-state-lib --name=Product --entityPath=products --scope=auth

CRUD Data Access Library Generator

Goal

Creates a data-access library for a specified CRUD entity.

Description

This generator creates a data-access library with a focus on CRUD operations for the specified entity. It customizes generated services and types based on the entity name and scope.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
scope string The scope (domain) of the library Yes

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a data-access library.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-data-access-lib --name=Product --entityPath=products --scope=auth

Complete CRUD Generator

Goal

Generates a complete CRUD setup for an entity within a specified scope.

Description

This generator creates the full CRUD setup, including data-access, state management, and feature libraries. It includes support for Supabase types and updates the barrel file for exports.

Properties

Property Type Description Required Default
name string The name of the entity Yes
entityPath string The path to the Supabase entity or table Yes
scope string The scope (domain) of the library Yes
primaryField string The primary

field for setup | No | name | | search | boolean | Enables a search route | No | true |

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a full CRUD setup across libraries.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:crud-complete --name=Product --entityPath=products --scope=auth --primaryField=id --search=true

Search Library Generator

Goal

Generates a search feature library within a specified scope.

Description

This generator creates a feature library named feat-search with routing enabled. It customizes search functionality and exports the SearchComponent.

Properties

Property Type Description Required Default
scope string The scope where the library is added Yes

AI-based

No, this generator does not use AI.

Element-based

No, this generator creates a feature library with search functionality.

Usage Example

npx nx g @nitrokit/code-assistant-util-automation:search-lib --scope=auth

Have questions?

Still have questions? Talk to support.

Previous
Forms