You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor(store): isolate ngrx store from app logic via facades
* chore(store): install and setup ngxs [WIP]
* feat(store): implement `ngxs` as alternative store
* chore: update packages
* chore(app): standalone components by default
Copy file name to clipboardExpand all lines: README.md
+32-6Lines changed: 32 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,14 +33,33 @@ Live application: [angular-authentication.netlify.app](https://angular-authentic
33
33
-[Node.js](https://nodejs.org/en/)
34
34
-[Angular CLI](https://angular.io/cli)
35
35
36
-
### Setup & Usage
36
+
### Setup & Local Development
37
37
38
38
- Clone this repository: `git clone git@github.com:nikosanif/angular-authentication.git`
39
39
-`cd angular-authentication`
40
40
- Install dependencies: `npm install`
41
41
- Serve the Angular app: `npm start`
42
42
- Open your browser at: `http://localhost:4200`
43
43
44
+
### Use it as a Template
45
+
46
+
The main purpose of this repository is to provide a simple Angular application that demonstrates best practices for user authentication and authorization flows. The application is configured to use a fake API server (interceptor) that simulates the backend server. Also, it includes two state management libraries, NgRx and NGXS, so you can choose which one to use.
47
+
48
+
If you want to use this repository as a template for your project, you can follow these steps:
49
+
50
+
- Clone this repository
51
+
- Remove fake API:
52
+
- Delete `src/app/core/fake-api` folder
53
+
- Remove all references from the `fake-api` folder
54
+
- Remove the `fakeApiInterceptor` from `app.config.ts`
55
+
- Choose the state management library you want to use:
56
+
- NgRx: Remove `src/app/auth/store/ngxs` folder and the `index.ngxs.ts` file
57
+
- NGXS: Remove `src/app/auth/store/ngrx` folder and the `index.ngrx.ts` file
58
+
- Rename the `index.XXX.ts` file to `index.ts` in the `src/app/auth/store` folder
59
+
- Update the `app.store.ts` file to import the correct store module
60
+
- Remove all unused packages from `package.json`
61
+
- Update the Google Analytics tracking ID by replacing `UA-XXXXX-Y` in the `index.html` file and in the `src/app/core/services/google-analytics.service.ts` file. Or remove the Google Analytics service if you don't want to use it.
62
+
44
63
### Useful Commands
45
64
46
65
-`npm start` - starts a dev server of Angular app
@@ -63,14 +82,16 @@ Live application: [angular-authentication.netlify.app](https://angular-authentic
63
82
- Standalone Angular components
64
83
- Angular Material UI components
65
84
- Lazy loading of Angular components
66
-
- API requests with `@ngrx/effects`
85
+
- API requests with `@ngrx/effects` or `@ngxs/store` (you can choose at `src/app/app.config.ts`)
- State Management. This repos demonstrates **two** state management libraries, you can choose which one to use by following the instructions in the [Use it as a Template](#use-it-as-a-template) section.
-[Angular Material UI](https://material.angular.io/)
75
96
-[Tailwind CSS](https://tailwindcss.com/)
76
97
- Other dev tools
@@ -90,15 +111,20 @@ Below is the high-level structure of the application.
90
111
│ ├── app.component.ts
91
112
│ ├── app.config.ts
92
113
│ ├── app.routes.ts
114
+
│ ├── app.store.ts # configure store based on NgRx or NGXS
93
115
│ │
94
116
│ ├── auth # includes authentication logic
95
117
│ │ ├── auth.routes.ts
96
118
│ │ ├── auth.service.ts
97
-
│ │ ├── guards
98
119
│ │ ├── index.ts
120
+
│ │ ├── guards
99
121
│ │ ├── interceptors
100
122
│ │ ├── login
101
-
│ │ └── store
123
+
│ │ ├── models
124
+
│ │ ├── tokens
125
+
│ │ └── store # Choose one of the following
126
+
│ │ ├── ngrx # store based on NgRx
127
+
│ │ └── ngxs # store based on NGXS
102
128
│ │
103
129
│ ├── core # includes core utilities
104
130
│ │ ├── fake-api
@@ -139,7 +165,7 @@ If you have found any bug in the source code or want to _request_ a new feature,
139
165
## Support
140
166
141
167
- Star this repository 👆⭐️
142
-
- Help it spread to a wider audience: [](https://x.com/intent/tweet?text=An%20Angular%20application%20that%20demonstrates%20best%20practices%20for%20user%20authentication%20and%20authorization%20flows.%0A%0A%40nikosanif%20%0A%F0%9F%94%97%20https%3A%2F%2Fgithub.com%2Fnikosanif%2Fangular-authentication%0A%0A&hashtags=Angular,NgRx,MDX,tailwindcss,ngAuth)
168
+
- Help it spread to a wider audience: [](https://x.com/intent/tweet?text=An%20Angular%20application%20that%20demonstrates%20best%20practices%20for%20user%20authentication%20and%20authorization%20flows.%0A%0A%40nikosanif%20%0A%F0%9F%94%97%20https%3A%2F%2Fgithub.com%2Fnikosanif%2Fangular-authentication%0A%0A&hashtags=Angular,NgRx,NGXS,MDX,tailwindcss,ngAuth)
0 commit comments