Angular Academy · Lesson

Bootstrapping a Standalone App

Start an app with bootstrapApplication.

Lesson 4 of 413 steps

Bootstrapping a Standalone App 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.

Bootstrapping a Standalone App

A fully standalone app starts with bootstrapApplication instead of bootstrapping a root NgModule. You hand it your root component.

The Entry Point: main.ts

The application entry file is main.ts. It calls bootstrapApplication with the root component, typically AppComponent.

import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent);

Where bootstrapApplication Comes From

bootstrapApplication is imported from @angular/platform-browser. It replaces the older platformBrowserDynamic().bootstrapModule pattern.

The Root Component

The root component is an ordinary standalone component. It usually hosts the router outlet or your top-level layout.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: '<h1>My App</h1>'
})
export class AppComponent {}

Providing Application Services

App-wide providers go in the second argument: an object with a providers array. This is where the router, HTTP client, and global services are configured.

bootstrapApplication(AppComponent, {
  providers: []
});

Providing the Router

Use provideRouter(routes) to set up routing for a standalone app.

import { provideRouter } from '@angular/router';
import { routes } from './app.routes';

bootstrapApplication(AppComponent, {
  providers: [provideRouter(routes)]
});

Providing HttpClient

Enable HTTP with provideHttpClient() in the providers array.

import { provideHttpClient } from '@angular/common/http';

bootstrapApplication(AppComponent, {
  providers: [provideHttpClient()]
});

Combining Providers

List as many provide* functions as you need together.

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter(routes),
    provideHttpClient()
  ]
});

The app.config.ts Pattern

The CLI commonly extracts providers into app.config.ts as an ApplicationConfig, keeping main.ts clean.

import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [provideRouter(routes)]
};

Using app.config in main.ts

Then main.ts simply passes appConfig along.

import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, appConfig);

Error Handling

bootstrapApplication returns a Promise. You can catch startup errors to log them.

bootstrapApplication(AppComponent, appConfig)
  .catch(err => console.error(err));

Quick Check: Bootstrapping

How does a standalone app start?

Recap: Bootstrapping

You bootstrap a standalone app with bootstrapApplication(AppComponent), passing app-wide providers like provideRouter and provideHttpClient. The CLI factors these into app.config.ts. No root NgModule is needed. You have completed the Standalone Components deep dive.

Free to start

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 “Bootstrapping a Standalone App” lesson free?

Yes — any 3 lessons of the Angular Academy learning path, including “Bootstrapping a Standalone App”, 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 “Bootstrapping a Standalone App”?

Start an app with bootstrapApplication. 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 “Bootstrapping a Standalone App” 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. Why Standalone Components
  2. Creating Standalone Components
  3. Importing Dependencies Directly
  4. Bootstrapping a Standalone App
← Back to Angular Academy