Currently, I'm using this article to organize my Angular folder structure. Basically, we have three main folders - core, shared, views.
- core: it has the
CoreModule
which provides all app common services. It's imported only once in AppModule
. In this folder, I have services and guards subfolders because they are injectables (question 2 answer). guards I don't provide at CoreModule
, I provide them at routing modules, i.e AppRoutingModule
.
- shared: it has the
SharedModule
which declare and exports all app common components, pipes, enums, classes and directives (all classes expect services and guards). SharedModule
is imported by views
module.
- views: it gets all views modules (generally lazy-load modules).
The structure is (question 3 answer):
/app
|---/core
| |---/guards
| |---/services
| |---core.module.ts
|
|---/shared
| |---/components
| |---/directives
| ...
| |---shared.module.ts
|
|---/views
| |---/view-X
| |---/components
| |---/directives
| |---view-X.component.html
| |---view-X.component.css
| |---view-X.component.spec.ts
| |---view-X.component.ts
| |---view-X.module.ts
| |---view-X-routing.module.ts
In your case, could have three views folders/modules: authenticate, user-stock and user-edit. Each one will have the structure similar to the view-X
folder example (question 1 answer).