Application Structure

Akita doesn’t restrict how you structure your code. Instead, it enforces a set of high-level principles:

1. The Store is a single object that contains the store state and serves as the “single source of truth.”

2. The only way to change the state is by calling setState() (or one of the update methods based on it).

3. A component should NOT get data from the store directly but instead use a Query.

4. Asynchronous logic and update calls should be encapsulated in services and data services.

As long as you follow these rules, it’s up to you how to structure your project. Here is how Akita recommends structuring the project, for the sake of maintaining modularity and order.

── todos
└── state
├── todos.query.ts
├── todos.store.ts
├── todos.service.ts
└── todos.module.ts
└── todos-page.component.ts
└── todo
└── todo.component.ts
└── todo.component.html
└── todo.component.scss
└── todo.component.spec.ts

For more information, check out the CLI.