Building and Serving
Run the dev server and produce builds.
Building and Serving is a free Angular Academy lesson on CoddyKit. This is lesson 4 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, and your progress syncs across the web and the CoddyKit app. The Angular Academy course includes 4 lessons in total.
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 serveThe 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.0Opening the Browser
The open flag launches your default browser automatically.
ng serve --open
# or: ng serve -ong build
ng build compiles the app into static files for deployment, written to a dist folder.
ng buildProduction 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 productionWatching During Build
For continuous rebuilds without serving, the watch flag rebuilds on file changes.
ng build --watchRunning Tests
Related commands include ng test for unit tests and ng lint (when configured) for static analysis.
ng testQuick 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.
Learn HTML with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 38
- Lessons
- 144
Frequently Asked Questions
Is the “Building and Serving” lesson free?
Yes — any 3 lessons of the Angular Academy learning path, including “Building and Serving”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The Angular Academy course includes 4 lessons in total.
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, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
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
- Generating a New Project
- Project Structure Explained
- Generating Code with ng generate
- Building and Serving