low-level Angular architecture diagram showing what happens internally when you create and run an app (ng new sampleapp + ng serve), and how execution flows through files like main.ts, app.module.ts, app.component.ts, app.html, etc., especially where debugging breakpoints (step over, step into) are effective.
Here’s a detailed breakdown and flow + diagram explanation 👇
🧩 1. Angular Application Structure (after ng new sampleapp)
⚙️ 2. Runtime Flow (Execution Order)
(A) ng serve
-
Compiles and serves your Angular app in development mode.
-
Uses Webpack Dev Server to bundle TS → JS → browser.
(B) main.ts
Entry Point
👉 Starts the Angular app by bootstrapping AppModule.
🟩 Breakpoints:
Set breakpoints here to debug initial app bootstrap (first executed file).
(C) app.module.ts
Root Module Definition
👉 Registers components and modules.
🟩 Breakpoints:
Place in constructor or ngOnInit() (if any service injected).
(D) app.component.ts
Root Component
🟩 Breakpoints:
-
constructor() -
ngOnInit()
This is where runtime logic starts when UI is rendered.
(E) app.component.html
Template for AppComponent
👉 UI rendering happens here.
🟩 Breakpoints:
No TS breakpoints — but inspect DOM via browser DevTools.
(F) app.routes.ts (or app-routing.module.ts)
Routing setup
👉 Controls navigation paths.
🟩 Breakpoints:
In constructor of routed components or ngOnInit().
(G) app.spec.ts
Unit Testing File
👉 Runs only during testing (ng test), not ng serve.
(H) index.html
Root HTML
👉 Angular replaces <app-root> with AppComponent content.
(I) styles.css
Global Styles
Affects all components (like body font, layout, etc.).
🧠3. Debugging Step-by-Step (VS Code)
🧩 To enable debugging:
-
Open project in VS Code
-
Go to Run → Add Configuration → Chrome Launch
-
It creates
.vscode/launch.json -
Run app:
ng serve -
Press
F5to launch debugger
🟩 Set breakpoints in:
-
main.ts→ Entry point -
app.module.ts→ Module load -
app.component.ts→ Component init -
Any other service or lifecycle hook
Use Step Over (F10), Step Into (F11), Continue (F5).
📊 4. Low-Level Angular Flow Diagram (Text Version)
If you’d like, I can generate a professional diagram (with arrows, modules, and lifecycle flow) showing exactly:
-
Entry points (
main.ts → AppModule → AppComponent) -
Routing
-
HTML/CSS connection
-
Debugging breakpoint icons (🟥 for active breakpoints)