Anatomy of an Angular Workspace
As a Technical Lead, you know that project architecture is the foundation of scalability. When you run ng new, Angular generates a strictly defined workspace. Following this standard structure allows multiple developers to collaborate seamlessly, as every file has a predictable home. In a clean architecture approach, we separate our core logic from our UI and our configuration.
- Root Configuration Files
The root of your project contains configuration files that govern the entire workspace, from build settings to dependency management.
- angular.json: The CLI configuration. It defines how your app is built, served, and tested.
- package.json: Manages your NPM dependencies and scripts (like
npm start). - tsconfig.json: Configures the TypeScript compiler options for the project.
- src/: The heart of the application where all source code lives.
- The 'src' Folder
Inside src, you find the files that actually get compiled into your web application. This is where the 'magic' happens.
| Folder/File | Description |
|---|---|
| app/ | Contains the components, services, and modules of your application. |
| assets/ | Stores static files like images, icons, and global configuration JSONs. |
| environments/ | Holds environment-specific variables (e.g., API URLs for Dev vs Prod). |
| index.html | The main HTML page served to users; Angular injects your app here. |
| main.ts | The entry point for the application that bootstraps the root module. |
| styles.scss | Global CSS/SCSS styles applied to the entire application. |
- The 'app' Folder Structure
Inside src/app, a common professional pattern is to group files by feature or type. For a complex tool like Revochamp, you might see subfolders like core/ (for singleton services), shared/ (for reusable UI components), and features/ (for specific app modules).
File Naming Conventions
Angular uses a specific naming convention: name.type.extension. For example, a component for user profiles would be named user-profile.component.ts. This makes it immediately obvious what each file does without opening it.