# Foundation & App Shell Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Stand up the shared infrastructure for the TeamWallet frontend rebuild — Angular Material theming, PWA scaffolding, environment config, domain models, auth state/API/guards, HTTP interceptors, a working login screen, and the app shell with bottom navigation — so a user can log in against the real backend and land in a navigable (still mostly stubbed) team area. **Architecture:** Standalone Angular 21 components throughout, no NgModules. App-wide auth state lives in an injectable `AuthStore` built on signals. Guards and HTTP interceptors are plain functions (`CanActivateFn`, `HttpInterceptorFn`). Feature routes are lazy-loaded via `loadComponent`. This plan builds only the shared shell and stub routes; later plans (Auth extras, Team-Select, Overview, Members, Cashbox, More, Public-Team) fill in the real feature screens behind these stubs. **Tech Stack:** Angular 21 (standalone, zoneless, esbuild builder), Angular Material 21 + CDK, `@angular/service-worker` (PWA), native Angular Signals, Reactive Forms, Vitest (`@angular/build:unit-test`). ## Global Constraints - Angular 21, standalone components only — no NgModules, no `standalone: true` flag needed (it's the default). - Angular Material 21 is the UI library; no Bootstrap/PrimeNG. - State management is native Signals in injectable services — no NgRx. - Guards and interceptors are functional (`CanActivateFn`, `HttpInterceptorFn`) — no class-based guards/interceptors. - No i18n layer — German text is hardcoded directly in templates. - PWA is required (`@angular/service-worker`, installable manifest). - Backend base URL pattern: `{environment.apiUrl}/`, e.g. `{apiUrl}auth/email/login`. Dev backend runs at `http://localhost:3999/api/v1/`. - Tests use Vitest via the `@angular/build:unit-test` builder; `describe`/`it`/`expect`/`vi` are globals (see existing `src/app/app.spec.ts` — no test-framework imports needed). - File/class naming follows this repo's existing scaffold convention (confirmed via `ng generate` dry-runs): components live in their own folder as `/.ts` (class `PascalCase`, **no** `Component` suffix), services as `.ts` (class **no** `Service` suffix), guards as `-guard.ts` (const `Guard`), interceptors as `-interceptor.ts` (const `Interceptor`). - This app is zoneless (no `zone.js` dependency) — tests must use `async`/`await` with Promise-returning APIs (e.g. `await router.navigateByUrl(...)`), never `fakeAsync`/`tick`. --- ## File Structure (produced by this plan) ``` src/environments/ environment.ts # prod apiUrl environment.development.ts # dev apiUrl (localhost:3999) src/app/ models/ role.model.ts status.model.ts user.model.ts team-role.model.ts # TeamRole enum + canBook/canInvite core/ auth/ auth-store.ts # signal-based session state auth-api.ts # login/me HTTP calls auth-guard.ts # protects authenticated routes root-redirect-guard.ts # '/' -> /team-select or /auth/login http/ auth-interceptor.ts # attaches Bearer token error-interceptor.ts # 401 -> logout + redirect + snackbar layout/ shell/shell.ts # header + bottom nav, wraps /team/:id/* not-found/not-found.ts features/ auth/login/login.ts team-select/team-select.ts # stub, real impl in a later plan team/ overview/overview.ts # stub members/members.ts # stub cashbox/cashbox.ts # stub more/more.ts # stub app.ts / app.html / app.spec.ts # trimmed to app.config.ts # Material, PWA, HTTP, router providers app.routes.ts app.routes.spec.ts ``` --- ## Task 1: Angular Material Install & Custom Theme **Files:** - Modify: `package.json`, `package-lock.json` (via CLI, not hand-edited) - Modify: `src/styles.scss` - Modify: `src/index.html` **Interfaces:** - Produces: Material component modules available for import throughout the app (`@angular/material/*`); a global M3 theme using `mat.$green-palette` (primary) and `mat.$orange-palette` (tertiary) to match the "frisch/sportlich" direction from the design spec. - [ ] **Step 1: Run the Material schematic** Run in `myteamwallet_frontend_modern/`: ```bash npx ng add @angular/material --skip-confirmation --theme=custom --typography=true --animations=enabledAsync ``` Expected: `package.json`/`package-lock.json` gain `@angular/material` and `@angular/cdk` (^21.2.x); `src/styles.scss` is rewritten with a `@use '@angular/material' as mat;` block and a `mat.theme(...)` include; `src/index.html` gains Roboto + Material Icons font `` tags. - [ ] **Step 2: Swap in the custom palette** Edit `src/styles.scss` — replace the generated `color` block (which defaults to `mat.$azure-palette` / `mat.$blue-palette`) with: ```scss @include mat.theme( ( color: ( primary: mat.$green-palette, tertiary: mat.$orange-palette, ), typography: Roboto, density: 0, ) ); ``` Keep the rest of the generated file (the `body` rule with `--mat-sys-*` variables) as-is. - [ ] **Step 3: Verify the build picks up the theme** Run: `npm run build -- --configuration development` Expected: build succeeds with no Sass errors; `dist/` output contains compiled CSS referencing `--mat-sys-primary` custom properties. - [ ] **Step 4: Commit** ```bash git add package.json package-lock.json src/styles.scss src/index.html git commit -m "chore: add Angular Material with a green/orange M3 theme" ``` --- ## Task 2: PWA Setup **Files:** - Modify: `package.json`, `package-lock.json`, `angular.json`, `src/app/app.config.ts`, `src/index.html` - Create: `ngsw-config.json`, `public/manifest.webmanifest`, `public/icons/*.png` **Interfaces:** - Produces: `provideServiceWorker(...)` registered in `app.config.ts` providers (later tasks append to the same providers array, don't replace it). - [ ] **Step 1: Run the PWA schematic** ```bash npx ng add @angular/pwa --skip-confirmation ``` Expected: `@angular/service-worker` added to `package.json`; `ngsw-config.json` created; `public/manifest.webmanifest` + `public/icons/*.png` created; `angular.json`'s production build configuration gains `"serviceWorker": "ngsw-config.json"`; `src/index.html` gains `` and a `