0Pricing
Angular Academy · Lesson

Building and Serving

Run the dev server and produce builds.

Building and Serving is a free Angular Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Building and Serving

The CLI runs your app locally during development and produces optimized output for production. The two key commands are ng serve and ng build.

ng serve

ng serve starts a local development server with live reload. Edit a file and the browser refreshes automatically.

ng serve

The Default Address

By default the dev server runs at http://localhost:4200. Open that URL to see your app.

Changing Port and Host

Override the port or host with flags.

ng serve --port 4300 --host 0.0.0.0

Opening the Browser

The open flag launches your default browser automatically.

ng serve --open
# or: ng serve -o

ng build

ng build compiles the app into static files for deployment, written to a dist folder.

ng build

Production Optimizations

Production builds apply optimizations: ahead-of-time compilation, minification, tree-shaking, and bundling, producing smaller, faster output.

The dist Output

The build output lands in dist/<project-name>/. Deploy these static files to any web host or CDN.

Build Configurations

angular.json defines configurations like production and development. Select one with the configuration flag.

ng build --configuration production

Watching During Build

For continuous rebuilds without serving, the watch flag rebuilds on file changes.

ng build --watch

Running Tests

Related commands include ng test for unit tests and ng lint (when configured) for static analysis.

ng test

Quick Check: Serve vs Build

Local dev versus deployment.

Recap: Build and Serve

Use ng serve for local development with live reload at localhost:4200, and ng build to produce optimized static files in dist/ for deployment. Configurations and flags tune host, port, and optimization level. You have completed the CLI course.

Frequently asked questions

Is the “Building and Serving” lesson free?

Yes — the full text of “Building and Serving” is free to read here on the web, and the Angular Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Angular Academy course, upgrade to CoddyKit PRO.

What will I learn in “Building and Serving”?

Run the dev server and produce builds. You practise Angular Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Angular Academy?

No prior experience is required. Angular Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Building and Serving” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Angular Academy lesson?

Yes. Every Angular Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Generating a New Project
  2. Project Structure Explained
  3. Generating Code with ng generate
  4. Building and Serving
← Back to Angular Academy