Angular Project Structure for Modularity and Reusability
This note outlines an Angular folder structure with core, features, and shared modules to keep the app modular and reusable.
Directory Structure
- core
- Contains application-core functionality, including constants, guards, interceptors, models, and services.
- These are accessible by the
featuresdirectory but should never reference features or shared components.
- features
- Each feature module resides here.
- These modules may reference
coreorsharedbut must remain isolated from the rest of the application to maintain modularity.
- shared
- Contains reusable parts like directives, forms, pipes, and services.
- These are available to
featuresbut must avoid referencing them.

src/├── app/│ ├── core/│ │ ├── constants/│ │ ├── decorators/│ │ ├── guards/│ │ ├── interceptors/│ │ ├── interfaces/│ │ │ ├── api/│ │ ├── models/│ │ ├── resolvers/│ │ ├── services/│ │ │ ├── api/│ │ ├── validators/│ ├── features/│ │ ├── auth/│ │ │ ├── password-reset/│ │ │ ├── sign-in/│ │ │ ├── sign-up/│ │ │ ├── verify/│ │ │ ├── auth.module.ts│ │ │ ├── auth.service.ts│ │ │ ├── auth-routing.module.ts│ │ ├── .../│ ├── shared/│ │ ├── components/│ │ ├── directives/│ │ │ ├── attribute/│ │ │ ├── structural/│ │ ├── forms/│ │ │ ├── input/│ │ │ ├── select/│ │ │ ├── .../│ │ ├── pipes/│ │ ├── services/│ ├── app.component.ts│ ├── app.module.ts│ ├── app-routing.module.tsassets/environments/styles/tests/theme/global.scssWhile the Angular coding style guide advises keeping directories flat, you should consider subdirectories when a folder exceeds seven files.
Consider creating sub-folders when a folder reaches seven or more files. – Angular coding style guide
Reference
Related posts
Spying on Mock Object Properties in Jasmine
This note describes how to spy on mock object properties in Jasmine.

Integrating AWS Amplify with Eclipse Mosquitto for MQTT Messaging
This note describes how to integrate AWS Amplify with Eclipse Mosquitto as an MQTT message broker.
Sign in with Slack Using Cognito User Pools and OIDC
This note describes how to federate Cognito user pools with Slack using OIDC to implement "Sign in with Slack".
Deploying FastAPI on AWS Lambda with Lambda Web Adapter
This example guides you through the process of developing API backends with FastAPI using Lambda Web Adapter.
Testing ECMAScript Modules with Jest
This note describes how to test ECMAScript modules with Jest.
