Angular Schematics

Scaffolding library for Angular applications using Akita.

akita-schematics provides CLI commands for generating files when building new features with Akita. Built on top of Schematics, this tool integrates with the Angular CLI.


ng add @datorama/akita

Default Schematics Collection

To use @datorama/akita as the default collection in your Angular CLI project, add it to your angular.json:

ng config cli.defaultCollection @datorama/akita

The collection schema also has aliases to the most common schematics used to generate files.

The package extend the default @schematics/angular collection. If you want to set defaults for schematics such as generating components with scss file, you must change the schematics package name from @schematics/angular to @datorama/akita in angular.json:

"schematics": {
"@datorama/akita:component": {
"styleext": "scss"

Create a New Feature

ng g @datorama/akita:feature todos/todos

The defauls feature will output an entity feature, you can choose between different kind of EntityService :

You can also generate the normal feature with the option plain:

ng g @datorama/akita:feature todos/todos --plain

Note that the akita-schematics: prefix is only needed when the default collection isn't set to akita-schematics

Generate a Store

ng g @datorama/akita:as todos
ng g @datorama/akita:aes todos // entity store

Generate a Query

ng g @datorama/akita:query todos
ng g @datorama/akita:entity-query todos
ng g @datorama/akita:aq todos
ng g @datorama/akita:aeq todos // entity query

Generate a Model

ng g @datorama/akita:model todo
ng g @datorama/akita:am todo

Generate a Service

ng g @datorama/akita:service todos
ng g @datorama/akita:asr todos

Generate an NgEntityService

ng g @datorama/akita:http-entity-service todos
ng g @datorama/akita:ahes todos

Generate Tests

Add the --spec option. For example:

ng g af products/products --spec

Generate Module

Add the --withModule to generate module and akita component. (only for entity store)