Skip to content

Commit f6c2c04

Browse files
authored
chore(readme): Updates to the readme to include NGXS and a diagram (#281)
1 parent 6e66be3 commit f6c2c04

File tree

3 files changed

+71
-8
lines changed

3 files changed

+71
-8
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ take up to 60 seconds once the docker build finishes.
1414

1515
## Index
1616

17+
### First steps
18+
19+
- Install git commit template: [Commit Template](docs/commit.template.md).
20+
- Volta: [Volta](#volta)
21+
1722
### Recommended
1823

1924
- Compodoc: [Compodoc Conventions](docs/compodoc.md).
2025
- Docker Commands: [Docker Commands](docs/docker.md).
2126
- Git Conventions: [Git Conventions](docs/git-convention.md).
22-
- Install git commit template: [Commit Template](docs/commit.template.md).
23-
- Volta: [Volta](#volta)
24-
- Redux DevTools: [Redux DevTools](#redux-devtools)
27+
- NGXS: [NGXS Conventions](docs/ngxs.md).
2528

2629
### Optional
2730

@@ -53,8 +56,3 @@ npm run test:check-coverage-thresholds
5356

5457
OSF uses volta to manage node and npm versions inside of the repository
5558
Install Volta from [volta](https://volta.sh/) and it will automatically pin Node/npm per the repo toolchain.
56-
57-
## Redux DevTools
58-
59-
OSF Angular uses [NGXS](https://github.com/ngxs) for state management. It is highly recommended to install
60-
the `Redux DevTools` extension from the Chrome web store.

docs/assets/osf-ngxs-diagram.png

100 KB
Loading

docs/ngxs.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# NGXS State Management Overview
2+
3+
The OSF Angular project uses [NGXS](https://www.ngxs.io/) as the state management library for Angular applications. NGXS provides a simple, powerful, and TypeScript-friendly framework for managing state across components and services.
4+
5+
---
6+
7+
## Purpose
8+
9+
The goal of using NGXS is to centralize and streamline the handling of application state, reduce boilerplate, and maintain a predictable flow of data and events throughout the OSF Angular app.
10+
11+
---
12+
13+
## Core Concepts
14+
15+
- **State**: Defines a slice of the application state and how it is modified in response to actions.
16+
- **Actions**: Dispatched to signal state changes or trigger effects (e.g., API calls).
17+
- **Selectors**: Functions that extract and transform data from the store.
18+
- **Store**: Centralized container that holds the application state.
19+
- **Effects** (via `@ngxs-labs/effects` or `@ngxs/store`): Side-effect handling such as HTTP requests, logging, etc.
20+
21+
### Diagram
22+
23+
[![OSF NGRX Diagram](./assets/osf-ngxs-diagram.png)](./assets/osf-ngxs-diagram.png)
24+
25+
---
26+
27+
## Directory Structure
28+
29+
Typical NGXS-related files are organized as follows:
30+
31+
```
32+
src/app/shared/stores/
33+
└── addons/
34+
├── addons.actions.ts # All action definitions
35+
├── addons.models.ts # Interfaces & data models
36+
├── addons.state.ts # State implementation
37+
├── addons.selectors.ts # Reusable selectors
38+
```
39+
40+
```
41+
src/app/shared/services/
42+
└── addons/
43+
├── addons.service.ts # External API calls
44+
```
45+
46+
---
47+
48+
## Tooling and Extensions
49+
50+
- [Redux DevTools](https://github.com/zalmoxisus/redux-devtools-extension) is supported. Enable it in development via `NgxsReduxDevtoolsPluginModule`.
51+
- [NGXS Logger Plugin](https://www.ngxs.io/plugins/logger) can be used for debugging dispatched actions and state changes.
52+
- [NGXS Storage Plugin](https://www.ngxs.io/plugins/storage) allows selective persistence of state across reloads.
53+
54+
---
55+
56+
## Testing
57+
58+
- Mock `Store` using `jest.fn()` or test-specific modules for unit testing components and services.
59+
60+
---
61+
62+
## Documentation
63+
64+
Refer to the official NGXS documentation for full API details and advanced usage:
65+
[https://www.ngxs.io/docs](https://www.ngxs.io/docs)

0 commit comments

Comments
 (0)