---
title: "What is the new “builder API” in Angular CLI 21?"  
description: "What is the new “builder API” in Angular CLI 21?"  
author: "Anubhav Sharma"  
published: 2025-12-23  
updated: 2025-12-23  
canonical: https://www.mindstick.com/interview/34428/what-is-the-new-builder-api-in-angular-cli-21  
category: "angular js"  
tags: ["angular js"]  
reading_time: 4 minutes  

---

# What is the new “builder API” in Angular CLI 21?

### What the Builder API *Is*

The *Builder API* (often just called [**Angular CLI**](https://www.mindstick.com/interview/34419/what-is-the-difference-between-angular-cli-14-15-16-and-cli-21) **Builders**) isn’t brand-new in Angular 21—it’s been part of the Angular CLI for years as the mechanism that executes CLI tasks like `ng build`, `ng serve`, and `ng test` by delegating to “builders.” A **builder** is a function that performs a task (build, test, serve, etc.) based on options and context provided by the CLI. You can also write **custom builders** to extend the CLI’s capabilities.

In Angular CLI:

- **Builders** replace older internal tooling like direct Webpack configs.
- They are configured in `angular.json` under `"architect"` (or `"targets"` in newer formats).
- Each builder has:

   - An **options schema** that defines input.
   - A **handler function** that performs the work.
   - Access to a **BuilderContext** for reporting and scheduling tasks.

### Why It Matters in Angular CLI 21

While the underlying Builder API hasn’t fundamentally changed *just for v21*, **Angular 21 makes greater use of it** by shifting default tooling toward new, modern builders:

#### Default Builders Evolved

Angular CLI 21 now uses more modern builders out of the box:

- **Vitest-based test builder**`@angular/build:unit-test` as the default for `ng test` instead of the older Karma/Jasmine builders.
- The **modern application builder** (often based on `@angular/build:application`) that uses esbuild + Vite for faster builds and dev server tasks.

These builders are implemented using the Builder API and configured in `angular.json`, so the CLI commands now delegate to new underlying implementations. The Builder API makes this extensible and configurable.

#### Custom Builders Still Supported

You can still create your own builders to:

- Customize build/test/serve processes
- Integrate alternative toolchains
- Automate custom workflows

This is done using the **Builder API utilities** like `createBuilder()` and implementing a builder handler that returns a `BuilderOutput`.

### TL;DR

- **CLI Builder API** is the core extensibility layer that Angular CLI uses to run commands like build, serve, and test.
- Angular CLI 21 leverages this API to provide **modern builders** (e.g., esbuild/Vite-based application builder and Vitest test builder) for better performance and defaults.
- You can create and use **custom builders** by implementing and registering them in your workspace.

## Answers

### Answer by Anubhav Sharma

### What the Builder API *Is*

The *Builder API* (often just called [**Angular CLI**](https://www.mindstick.com/interview/34419/what-is-the-difference-between-angular-cli-14-15-16-and-cli-21) **Builders**) isn’t brand-new in Angular 21—it’s been part of the Angular CLI for years as the mechanism that executes CLI tasks like `ng build`, `ng serve`, and `ng test` by delegating to “builders.” A **builder** is a function that performs a task (build, test, serve, etc.) based on options and context provided by the CLI. You can also write **custom builders** to extend the CLI’s capabilities.

In Angular CLI:

- **Builders** replace older internal tooling like direct Webpack configs.
- They are configured in `angular.json` under `"architect"` (or `"targets"` in newer formats).
- Each builder has:

   - An **options schema** that defines input.
   - A **handler function** that performs the work.
   - Access to a **BuilderContext** for reporting and scheduling tasks.

### Why It Matters in Angular CLI 21

While the underlying Builder API hasn’t fundamentally changed *just for v21*, **Angular 21 makes greater use of it** by shifting default tooling toward new, modern builders:

#### Default Builders Evolved

Angular CLI 21 now uses more modern builders out of the box:

- **Vitest-based test builder**`@angular/build:unit-test` as the default for `ng test` instead of the older Karma/Jasmine builders.
- The **modern application builder** (often based on `@angular/build:application`) that uses esbuild + Vite for faster builds and dev server tasks.

These builders are implemented using the Builder API and configured in `angular.json`, so the CLI commands now delegate to new underlying implementations. The Builder API makes this extensible and configurable.

#### Custom Builders Still Supported

You can still create your own builders to:

- Customize build/test/serve processes
- Integrate alternative toolchains
- Automate custom workflows

This is done using the **Builder API utilities** like `createBuilder()` and implementing a builder handler that returns a `BuilderOutput`.

### TL;DR

- **CLI Builder API** is the core extensibility layer that Angular CLI uses to run commands like build, serve, and test.
- Angular CLI 21 leverages this API to provide **modern builders** (e.g., esbuild/Vite-based application builder and Vitest test builder) for better performance and defaults.
- You can create and use **custom builders** by implementing and registering them in your workspace.


---

Original Source: https://www.mindstick.com/interview/34428/what-is-the-new-builder-api-in-angular-cli-21

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
