Modern Angular: Signals, Standalone Components and SSR · Capstone
Capstone: A Customer Portal in Angular
Design an Angular application for a bank's customer portal: architecture, state, forms, routing and security, performance and testing.
Scenario
A bank is rebuilding its customer portal in Angular. Customers view accounts and transactions, make transfers, download statements and manage cards. Some pages are public (rates, help articles) and must rank in search; the rest require login with multi-factor authentication. Six teams will work on the codebase.
Requirements
- Transactions lists with thousands of rows stay fast; filters and search update instantly.
- Transfers use multi-step forms with validation against limits and the server.
- Public pages are indexable and fast on mobile.
- Accessibility (WCAG 2.2 AA) and strong security are mandatory.
Constraints
- Angular 22, standalone components, zoneless; a REST backend with OAuth 2.0 / OpenID Connect.
- Deployed behind a CDN; strict Content Security Policy.
Deliverables
- Architecture: structure for six teams.
- State and data.
- Forms.
- Routing, auth and security.
- Performance, rendering and testing.
Hints
- Not every route needs the same rendering mode.
- Think about which state is server data and which is UI state.
Draft each deliverable below before revealing the model answer and rubric.
Further reading: Angular style guide · Security
Deliverables
Describe the architecture.
Model answer
- Feature areas (accounts, transfers, cards, statements, public) as lazy-loaded route trees owned by teams; shared UI components and design tokens in a library; core services (auth, HTTP interceptors, error handling) provided at the root.
- Dependency rules enforced with lint boundaries: features don't import each other's internals.
- Standalone components with signal inputs/outputs; OnPush-style signal-driven rendering.
Rubric
Look for lazy feature areas aligned with team ownership, shared libraries and enforced boundaries.
Describe state and data handling.
Model answer
- Server data through
httpResource/services with caching per account and query; signal-based stores (or NgRx SignalStore) for feature state such as filters and transfer drafts. - Transactions: server-side paging and filtering with query params as the source of truth (shareable URLs); virtual scrolling for long lists;
trackby transaction ID. - Optimistic UI only where safe (card freeze), with rollback; transfers always confirmed by the server.
Rubric
Strong answers separate server data from UI state, use paging and virtualization, and avoid optimistic updates for money movement.
Describe the forms approach.
Model answer
- Signal Forms for the transfer wizard: one model across steps, schema rules (required, amount limits, IBAN pattern), cross-field validation (amount within daily limit), async validation of the payee via the API.
submit()maps server errors (insufficient funds, limit exceeded) to fields; a confirmation step with an idempotency key so retries don't duplicate transfers.- Accessible errors: labels,
aria-describedby, focus management on errors.
Rubric
Look for a typed form model with sync, cross-field and async validation, server error mapping, idempotency and accessibility.
Describe routing, authentication and security.
Model answer
- OIDC authorization code flow with PKCE via a backend-for-frontend holding tokens in httpOnly cookies; functional guards redirect to login; step-up MFA guard for transfers.
- Interceptors add CSRF headers and handle 401 (re-auth) and 403; the API enforces all authorization.
- Angular's sanitization and no
bypassSecurityTrust*on user data; strict CSP with nonces (ngCspNonce), Trusted Types; no secrets in the bundle.
Rubric
Strong answers keep tokens out of JavaScript, treat guards as UX, and use Angular's XSS protections with a strict CSP.
Describe performance, rendering and testing.
Model answer
- SSR with prerendering for public pages (rates, help) and client rendering for authenticated areas; hydration with event replay;
@deferfor charts and below-the-fold widgets. - Bundle budgets in CI; lazy routes; image optimization with
NgOptimizedImage. - Tests: component tests with TestBed (signals, forms, defer states), HTTP tests with HttpTestingController, router tests with RouterTestingHarness, end-to-end tests (Playwright) for login and transfers, and automated accessibility checks.
Rubric
Look for per-route rendering choices, deferred loading, budgets, and layered tests including accessibility.
Open in the app to mark lessons complete, take notes and track your progress.