In this article we will study about angular folder structure. In the development of applications in the context of an Angular workspace. A workspace holds the files for one or more projects. A project is the set of files that constitute a standalone application or a shareable library for you.
The Angular CLI ng new command creates a workspace.
ng new <project-name>
When you run this command in the terminal, the CLI installs the needed Angular npm packages and other dependencies in a new workspace, with a root-level application named project-name. The workspace root folder contains various support and configuration files, and a README file with generated descriptive text that you can customize on your own.
By default, ng new designs an initial skeleton application at the root level of the workspace, along with its end-to-end tests. The skeleton is for a simple Welcome page application that is ready to run and easy to change. The root-level application has the same name as the workspace, and the source files reside in the src/ subfolder of the workspace.
This default mode is suitable for a typical “multi-repo” development style where each application resides in its workspace. Beginners and intermediate users are encouraged to use ng new to create a separate workspace for each application.
Angular also supports workspaces with multiple projects. This type of development environment is becoming for advanced users who are developing shareable libraries, and for enterprises that use a “monorepo” development style, with a single repository and global arrangement for all Angular projects.
To set up a monorepo workspace, you should skip the building the root application. See Setting up for a multi-project workspace below.
Angular 8 workspace structure configuration files.
|WORKSPACE CONFIG FILES||PURPOSE|
|Configuration for code editors.|
|Specifies intentionally untracked files that Git should be ignore.|
|Introductory documentation for the root app.|
|CLI configuration defaults for all of projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as TSLint, Karma, and Protractor. For details, see Angular Workspace Configuration.|
|Configures npm package dependencies that are available to all projects in the workspace.|
|Provides version information for all packages installed into |
|Source files for the root-level application project.|
|Provides npm packages to the entire workspace. Workspace-wide |
|Default TypeScript configuration for projects in the workspace.|
|Default TSLint configuration for projects in the workspace.|
Angular 8 Application project files
By default, the CLI command ng new my-app-name creates a workspace folder named “my-app-name” and generates a new application skeleton in an src/ folder at the top level of the workspace. A newly created application contains source files for a root module, with a root component and template.
When the workspace file structure is in place, you can use the ng generate command on the command line to add functionality and data to the application. This initial root-level application is the default app for CLI commands (unless you change the default after creating additional apps).
Besides using the CLI on the command line, you can also use an interactive development environment like Angular Console, or manipulate files directly in the app’s source folder and configuration files.
For a single-application workspace, the src/ subfolder of the workspace contains the source files (application logic, data, and assets) for the root application. For a multi-project workspace, additional projects in the projects/ folder contain a project-name/src/ subfolder with the same structure.
Angular 8 Application source files
|APP SUPPORT FILES||PURPOSE|
|Contains the component files in which your application logic and data are defined.|
|Contains image and other asset files to be copied as-is when you build your application.|
|Contains build configuration options for particular target environments. By default there is an unnamed standard development environment and a production (“prod”) environment. You can define additional target environment configurations.|
|An icon to use for this application in the bookmark bar.|
|The main entry point for your application. Compiles the application with the JIT compiler and bootstraps the application’s root module (AppModule) to run in the browser. You can also use the AOT compiler without changing any code by appending the |
|Provides polyfill scripts for browser support.|
|Lists CSS files that supply styles for a project. The extension reflects the style preprocessor you have configured for the project.|
|The main entry point for your unit tests, with some Angular-specific configuration. You don’t typically need to edit this file.|
Inside the src/ folder, the app/ folder contains your project’s logic and data. Angular components, templates, and styles are go here.
|Defines the logic for the app’s root component, named |
|Defines the HTML template associated with the root |
|Defines the base CSS stylesheet for the root |
|Defines a unit test for the root |
|Defines the root module, named |
Angular 8 Application configuration files
The application-specific configuration files for the root application remain at the workspace root level. For a multi-project workspace, project-specific configuration files are in the project root, under projects/project-name/.
Project-specific TypeScript configuration files inherit from the workspace-wide tsconfig.json, and project-specific TSLint configuration files inherit from the workspace-wide tslint.json.
|APPLICATION-SPECIFIC CONFIG FILES||PURPOSE|
|Configures sharing of target browsers and Node.js versions among various front-end tools. See Browserslist on GitHub for more information.|
|Application-specific Karma configuration.|
|Application-specific TypeScript configuration, including TypeScript and Angular template compiler options. See TypeScript Configuration.|
|TypeScript configuration for the application tests. See TypeScript Configuration.|
|Application-specific TSLint configuration.|
Learn full details: https://angular.io/guide/file-structure