Skip to content

How to understand a Angular codebase

Angular apps are organised around components, services and dependency injection. Newer projects use standalone components bootstrapped with `bootstrapApplication`; older ones group everything into NgModules. State flows through injected services, RxJS observables and, since Angular 16, signals.

How to tell it's Angular

  • angular.json and @angular/core in package.json
  • Files named *.component.ts, *.service.ts, *.module.ts
  • src/main.ts calling bootstrapApplication or platformBrowserDynamic().bootstrapModule

Where things usually live

src/main.ts
Bootstraps the root component or module.
src/app/app.config.ts
Standalone apps: global providers such as router, HTTP client and interceptors.
src/app/app.routes.ts
Route definitions, lazy-loaded features and guards.
src/app/**/*.component.ts
Components: class logic, with the template inline or in a .component.html file.
src/app/**/*.service.ts
Injectable services: API calls, shared state and business logic.
src/app/core/ and shared/
A common convention: app-wide singletons in core, reusable pieces in shared.
src/environments/
Per-environment settings swapped at build time.

Conventions, not rules. Real projects rename and move things, so confirm against the repository.

Where to start reading

  1. src/main.ts and app.config.ts (or app.module.ts), to see providers and interceptors
  2. app.routes.ts, to map URLs to features
  3. The services a feature injects, since most logic lives there

How a request moves through the code

  1. 1main.ts bootstraps the app with its providers.
  2. 2The router matches the URL, runs guards and resolvers, and lazy-loads the feature if needed.
  3. 3The routed component is created; Angular injects the services listed in its constructor or inject() calls.
  4. 4Services call the backend through HttpClient, passing through any HTTP interceptors (auth headers, error handling).
  5. 5Results arrive as observables or signals, and the template updates through change detection.

Questions to ask about the repository

  • Which HTTP interceptors are registered, and what does each one do to requests?
  • Which services are singletons and which are provided per component?
  • Which routes are lazy-loaded, and what guards protect them?
  • Is this app using signals, RxJS or both for state, and where?

What trips people up

  • Where a service is provided changes whether components share one instance; check providedIn and component providers arrays.
  • Observables do nothing until subscribed, so a call that seems to do nothing may be missing a subscription or an async pipe.
  • Templates in .component.html files hold much of the logic; read them alongside the class.