# Module: fe-nibe (`nibe_datamanager/nibedatamanager_fe/`)
Purpose: NIBE data-manager SPA (Angular ^21.2, standalone, legacy `@angular-devkit/build-angular:browser` builder) served at Kong `/nibe`; the browser URL is `/nibe/nibe/datamanager`. Owner: Sanjay.
Entry points: `src/main.ts`, `src/app/app.config.ts`, `src/app/app.routes.ts` (`''` → `nibe/datamanager`, guarded by `ssoTokenGuard` from `src/app/core/auth/auth-guard`; `**` → `''`), `src/app/landingpage/`, `src/app/core/` (api, auth, config, services).
Build: `npx ng build --configuration=docker` (Docker/CI; output `dist/datamanager` — no `browser/` subfolder). Other configs: `production`, `development` (swaps in `environment.uat.ts`). `npm run lint` (ESLint), `ng test` (`@angular/build:unit-test`), `ng serve`.
Talks to (via `environment.docker.ts`, root-relative): `apiBaseUrl` `/nibedatamgnr` → its own nibe backend (calls append `/web/sync/...`; Kong strips `/nibedatamgnr/web`); plus `/micro/web`, `/usermg/web`, `/profilemg/web`, `/configmg/web`, `/digitall/web`, `/filemst/api`, `/cengex/web`, `/gmarketapi/web`, `/subscriptnmg/web` (no Kong route — 404s). Sibling SPAs: `b2gAppUrl` `/app/`, `gmarketAppUrl` `/market/`.
Invariants:
- `const KONG = ''` in `src/environments/environment.docker.ts` — never `http://localhost:8000` (CI bundle guard fails the build; don't even write that literal in comments).
- Keep the `docker` configuration in `angular.json` with `baseHref: "/nibe/"`; never pass an absolute `--base-href`.
- Resolve `package.json` + `package-lock.json` together; `npm ci --legacy-peer-deps` is required (`angular-tabler-icons` peer range stops at Angular 19).
- Never commit `dist/` — `nibedatamanager_fe/dist` was once tracked and had to be untracked after shipping a stale bundle.
- This folder is a separate CI service (`fe-nibe`) excluded from the `nibe` backend's paths; changes here do not rebuild the backend and vice versa.
Gotchas:
- SSO entry: b2g hands off via `dataManagementUrl` `/nibe/nibe/datamanager?nibeId=...#token=...`; `ssoTokenGuard` consumes it. The old `/datamg/...` path has no Kong route and falls through to fe-website `/home`.
- "Unexpected token '<' ... is not valid JSON" = the backend returned Yii HTML, usually a Kong `strip_path`/prefix mismatch on `/nibedatamgnr/web`.
- `package.json` `name` is `gmarket` (copied from gMarket) — cosmetic, but don't use it to identify the app.
- The image does not use `spa-entrypoint.sh`, so the committed `src/assets/env.js` (`microfeHost = "/filems"`) ships as-is to ECS (verify intended); locally `docker/fe-env/env.docker.js` is bind-mounted.
- Local compose (port 4205) bind-mounts host-built `dist/datamanager` — rebuild on the host after changes.
Prod debugging: CloudWatch `/ecs/b2g-prod/fe-nibe` (demo: `/ecs/b2g-demo/fe-nibe`); health on :80 (`/healthz`); ECS service `fe-nibe`, task family `b2g-fe-nibe` / `b2g-demo-fe-nibe`; browser devtools network tab for 4xx/CORS. Runbooks: `docs/runbooks/`.
