Angular Project Structure and Important Files

Angular 12 min min read Updated: Nov 16, 2026 Beginner
Angular Project Structure and Important Files
Beginner Topic 3 of 5

Folder Overview

text my-first-app/ src/ app/ app.ts component class app.html component template app.css component styles app.spec.ts unit test app.config.ts application providers app.routes.ts routes index.html the one HTML page main.ts starting point styles.css global styles public/ static files (images, favicon) angular.json CLI and build settings package.json dependencies and scripts tsconfig.json TypeScript settings
File names: Newer CLI versions generate short names like app.ts and the class App. Older tutorials and many company projects use app.component.ts and AppComponent. Both work the same way. In this course we sometimes use the longer style with a suffix (for example UserService) because it makes the role of a class obvious.

index.html

html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>MyFirstApp</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <app-root></app-root> </body> </html>

This is the only page. app-root is a custom tag. Angular fills it with your application.

main.ts: The Starting Point

typescript import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { App } from './app/app'; bootstrapApplication(App, appConfig) .catch((err) => console.error(err));

It starts the root component and gives it the configuration.

app.config.ts: Providers

typescript import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core'; import { provideRouter } from '@angular/router'; import { provideHttpClient } from '@angular/common/http'; import { routes } from './app.routes'; export const appConfig: ApplicationConfig = { providers: [ provideBrowserGlobalErrorListeners(), provideRouter(routes), provideHttpClient(), ], };

Here you switch on features: routing, HTTP, animations and more. In older projects this was done with AppModule.

The Root Component

typescript // app.ts import { Component, signal } from '@angular/core'; import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', imports: [RouterOutlet], templateUrl: './app.html', styleUrl: './app.css', }) export class App { protected readonly title = signal('my-first-app'); }
html <!-- app.html --> <h1>{{ title() }}</h1> <router-outlet />
PartMeaning
@Component({...})Decorator that tells Angular this class is a component
selectorThe HTML tag name (app-root)
importsOther components, directives and pipes used in this template
templateUrl / templateHTML file or inline HTML
styleUrl / stylesCSS for this component only

angular.json and package.json

  • angular.json: build, serve and test settings, asset folders, global styles
  • package.json: dependencies and scripts such as npm start, npm run build, npm test
  • tsconfig.json: TypeScript strict settings (keep them on)
  • public/: files copied as they are to the final site
Where do I write code? Almost all your work is inside src/app/. Each feature gets its own folder with components, services and routes.

Conclusion

main.ts starts the app, app.config.ts registers features, App is the root component shown in index.html and you build everything else inside src/app.

Quick Summary: index.html > main.ts > bootstrapApplication(App, appConfig) > app-root.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators