Skip to content

ogm710811/monster-angular-app

Repository files navigation

Angular Directory Structure

Best Practices:

  1. Standalone Components:

    • Each component can be standalone, meaning they don’t need to be declared in a module.
    • This allows for better modularity and reusability.
  2. Core Module:

    • Keep the core directory for singleton services, guards, interceptors, and models.
    • Core services and utilities that are used globally should be placed here.
  3. Shared Module:

    • The shared directory is for components, directives, and pipes that are reused across multiple features.
    • Standalone components, directives, and pipes can be placed here without needing to declare them in a module.
  4. Feature Modules:

    • Organize features into their own directories.
    • Feature-specific components, services, and routing modules should be placed within these directories.
  5. Routing:

    • Define routing in feature-specific routing modules.
    • Lazy loading should be utilized to load feature modules on demand.

Summary:

  • Standalone Components: Utilize standalone components for modularity and reusability.
  • Core and Shared Directories: Maintain a clear separation of core and shared resources.
  • Feature Modules: Organize features into their own modules with dedicated routing.
  • Routing: Use lazy loading for better performance and manage routing in feature-specific modules.
  src/
  ├── app/
  │ ├── core/
  │ │ ├── interceptors/
  │ │ ├── services/
  │ │ ├── guards/
  │ │ ├── models/
  │ │ ├── core.module.ts
  │ │ └── ...
  │ ├── shared/
  │ │ ├── components/
  │ │ ├── directives/
  │ │ ├── pipes/
  │ │ └── ...
  │ ├── features/
  │ │ ├── feature1/
  │ │ │ ├── components/
  │ │ │ │ ├── example/
  │ │ │ │ │ ├── example.component.html
  │ │ │ │ │ ├── example.component.scss
  │ │ │ │ │ ├── example.component.ts
  │ │ │ │ │ ├── example.component.spec.ts
  │ │ │ ├── services/
  │ │ │ │ ├── example.service.ts
  │ │ │ │ ├── example.service.spec.ts
  │ │ │ ├── feature1-routing.module.ts
  │ │ │ ├── feature1.module.ts
  │ │ │ └── ...
  │ │ ├── feature2/
  │ │ │ ├── components/
  │ │ │ ├── services/
  │ │ │ ├── feature2-routing.module.ts
  │ │ │ ├── feature2.module.ts
  │ │ │ └── ...
  │ ├── main.ts
  │ ├── app.component.html
  │ ├── app.component.scss
  │ ├── app.component.ts
  │ └── ...
  ├── assets/
  ├── environments/
  ├── styles/
  ├── index.html
  ├── polyfills.ts
  ├── test.ts
  └── ...

About

Angular 18 fundamentals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published