Setup & Installation
Bootstrap an Angular app, configure modules, and run locally.
Use this guide for enterprise admin consoles, internal tools, and long-lived Angular applications.
Prerequisites
- Node.js 20 LTS
- Angular CLI 17+
- pnpm (required — do not use npm for installs)
npm install -g @angular/cli
node --version
ng versionCreate the project
ng new admin-console --routing --style=scss --standalone
cd admin-console
pnpm install
ng serveVerify at http://localhost:4200.
Project structure
src/
├── app/
│ ├── core/ # Singleton services, guards, interceptors
│ ├── shared/ # Reusable components, pipes, directives
│ ├── features/ # Feature modules (lazy-loaded)
│ └── app.config.ts # Application providers
├── assets/
└── environments/
├── environment.ts
└── environment.prod.tsEnvironment configuration
// src/environments/environment.ts
export const environment = {
production: false,
apiUrl: "http://localhost:4000/api",
cognito: {
userPoolId: "us-east-1_xxxxx",
clientId: "xxxxxxxx",
domain: "auth.company.com",
},
};Auth interceptor
Register a Cognito token interceptor in app.config.ts:
import { provideHttpClient, withInterceptors } from "@angular/common/http";
import { authInterceptor } from "./core/interceptors/auth.interceptor";
export const appConfig: ApplicationConfig = {
providers: [provideHttpClient(withInterceptors([authInterceptor]))],
};Verify setup
ng servestarts without errors.- Login redirects to Cognito hosted UI.
- Authenticated API calls return data.
ng lintandng testpass.