# Module: profilemgmt (`b2g_profilemgmt/`)
Purpose: member-company profile (company details, sustainability statements/goals, accomplishments, market, business sources) and BGI Bridge profile sync. Owner: Sanjay.
Entry points: `modules/apipm/controllers/` (`CompanydetailsController`, `SustainabilityController`, `TaskinsertController`, `ProfileController`, `AccomplishmentController`, `BridgesyncController`); `modules/BizSource/`; `common/components/BridgeApiClient.php` (~2.8k lines) and `common/components/Common.php`. Web only (no `api/` dir). Kong: `/profilemg/web`.
Data: default `db` = `bgi_b2g_reg_*` — key tables: `membercompanymst_tbl`, `memcompsectordtls_tbl`, `memcompsusstmtdtls_tbl`, `memcompacomplishdtls_tbl`, `memcompbussrcdtls_tbl`, `memcompesgfactorsdtls_tbl`. Second connection `dbGmarket` = `bgi_b2g_gmarket_*`, used only for `memcompbussrcdtls_tbl` writes during Bridge sync (`models/MemcompbussrcdtlsGmarketTbl.php`).
Calls: micro (`MICRO_BASE_URL` → `masterServiceUrl`, `filemstApiUrl`, `microserviceUrls`), mail (`MAIL_BASE_URL`), usermgmt (`USERMGMT_BASE_URL` → `accomplishFileSyncUrl`), gmarketapi/filemst via `microserviceUrls`; external BGI Bridge (`BRIDGE_BASE_URL`, `BRIDGE_PROJECT_ID[_INT]`).
Env selection: `APP_ENV` first, else `HTTP_HOST` (demo/prod domains, else local) — see `config/web.php` (also loads `db-gmarket-{env}.php`).
Invariants:
- `jwtSecret` must match sibling backends (`HttpBearerAuth` + `JwtHelper`).
- Master data comes from micro over HTTP; gmarket writes go only through `dbGmarket`, never a cross-schema SQL statement on `db`.
Gotchas:
- `db-gmarket-{env}.php` holds literal, non-env-driven credentials for a separate RDS instance — never copy them; rotate via the file/Secrets Manager plan (verify).
- `apipm/bridgesync/pull-member-company` is deliberately unauthenticated and can run up to 600s (`set_time_limit`) — far past the 15s Service Connect window.
- `BridgeApiClient.php` uses curl timeouts up to 60s and `common/components/Common.php` is on the curl-timeout baseline.
- Log mirroring is still `FileTarget` → `/proc/self/fd/2`; confirm StderrLogTarget fix status (verify).
- `vendor/` not committed; Dockerfile installs it.
Prod debugging: CloudWatch `/ecs/b2g-prod/profilemgmt` (demo: `/ecs/b2g-demo/profilemgmt`); health `GET /healthz` on :80; ECS service `profilemgmt`, task family `b2g-profilemgmt` / `b2g-demo-profilemgmt`. Runbooks: `docs/runbooks/`.
