Bootstrapping a Standalone App
Start an app with bootstrapApplication.
Bootstrapping a Standalone App 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.
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.
Frequently asked questions
Is the “Bootstrapping a Standalone App” lesson free?
Yes — the full text of “Bootstrapping a Standalone App” 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 “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; 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 “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
- Why Standalone Components
- Creating Standalone Components
- Importing Dependencies Directly
- Bootstrapping a Standalone App