Appearance
Legacy User And Auth Inventory
This inventory was taken from the legacy NestJS API under /Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api and cross-checked against the Go platform audit docs before changing the Go microservice runtime.
Legacy Framework And Module Shape
- The legacy backend is a NestJS API using Prisma/PostgreSQL.
- Auth HTTP routes live in
node-platform/apps/api/src/modules/auth/auth.controller.ts. - Login/register/refresh/logout/profile flows live in
node-platform/apps/api/src/modules/auth/auth.service.ts. - The legacy code has a class named
AuthService; it is not a deployable microservice boundary. The Go platform boundary isiam-service. - JWT guards read Bearer tokens or the
hoctapaz.accessTokencookie; tenant guards readX-Organization-Idor queryorganizationId.
Contract-Critical Auth Routes
These routes remain public compatibility contracts through the API Gateway:
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/refreshPOST /api/auth/logoutGET /api/auth/mePATCH /api/auth/me/profilePATCH /api/auth/me/teacher-profilePATCH /api/auth/me/student-profilePATCH /api/auth/me/parent-profilePOST /api/auth/me/passwordPOST /api/auth/forgot-passwordPOST /api/auth/reset-passwordPOST /api/auth/googleGET /api/auth/google/config
Native iam-service route rehearsal now covers the session endpoints, password change/reset endpoints, Google Auth endpoints, and admin Google settings. Profile route-table rehearsal covers the native profile and KYC carve-outs; the remaining blocker for default public routing is gateway response-shape coverage, browser/runtime evidence, and rollback notes for each promoted route.
Naming note: /api/auth and /v1/auth are compatibility HTTP route namespaces. The runtime service, service task pack, OpenAPI service contract, deployment manifest, and agent dispatch row are all iam-service.
Legacy Data Ownership
The legacy Prisma User model mixes identity, profile, tenant, and product relations. The Go split keeps credentials and permissions out of profile data.
IAM-owned legacy inputs:
User.accountCode,email,phone,passwordHash,role,statusRefreshTokenAuthProviderSettingUserAuthProvider- access-token and refresh-token minting
- organization membership data used for access control
- login/security audit events
Profile-owned legacy inputs:
User.fullName,avatarUrl, public account metadataTeacherProfileTeacherKycschema/read-redaction foundationStudentProfileParentProfileParentStudent- staff-facing display/profile metadata when implemented
Not IAM/Profile-owned:
- organization metadata and units belong to
school-service - classroom roster and classroom membership belong to
classroom-service - wallet/payment/subscription/quota data belongs to wallet/payment/billing/usage services
- learning progress, attempts, course progress, and analytics stay outside IAM
Legacy Token Behavior To Preserve
Legacy access tokens include user identity and frontend compatibility claims:
subtype=accessroleaccountCodefullNameemailisGuestguestSourceLinkIddefaultOrganizationId- optional impersonation fields
Legacy refresh tokens include sub, type=refresh, and jti, expire after seven days, and are persisted by RefreshToken. Native IAM stores refresh-token material hashed at rest and preserves consume-once rotation semantics.
Native Mapping Status
iam-servicealready owns native auth identity/session foundations, password change/reset flows, Google provider linking/settings, directory/invite tables, JWT-compatible session payloads, and focused tests.profile-servicealready owns native profile snapshot/read/update foundations, role-profile tables, and focused tests.- Default
/api/auth/*traffic stays conservative until each carve-out has route-table rehearsal, response adapter coverage, browser evidence, and rollback notes. - There is no deployable
auth-service,services/auth-service, orauth-servicetask pack ingo-platform. Remainingauth-servicementions are negative guardrails or migration rationale that point identity work toiam-service; legacyAuthServicereferences in audit docs intentionally describe source-code classes. - IAM Postgres integration coverage is opt-in through
IAM_SERVICE_POSTGRES_TEST_DATABASE_URLand now includes invite workflow plus directory role/permission/organization-membership parity.
Follow-Up Gaps
- Finish IAM as canonical organization-membership owner or document the synchronized read-model contract with
school-service. - Expose profile KYC and profile-owned parent-student read-model APIs only after privacy/audit and gateway response compatibility are explicit.
- Backfill legacy users into service-owned IAM/Profile databases with validation reports before default route cutover.
- Run the opt-in IAM/Profile Postgres integration suites against clean service databases before default public route promotion.