# Backend Rust Migration Master Plan ## Goal Re-implement backend services in Rust while preserving architecture, service boundaries, data flow, and runtime behavior. ## Current-to-Target Mapping - NestJS gateway -> Rust gateway - NestJS users -> Rust users - NestJS companies -> Rust companies - NestJS customers -> Rust customers - NestJS professionals -> Rust professionals - NestJS jobseekers -> Rust jobseekers ## Hard Constraints 1. Same microservice boundaries. 2. Same role/runtime-config flow. 3. Same onboarding state transitions and schema lookup behavior. 4. Same auth/session behavior at gateway boundary. 5. No contract-breaking change unless explicitly versioned. ## Stage Sequence 1. Freeze contracts and DB assumptions. 2. Implement Rust shared crates (`config`, `errors`, `db`, `auth`, `observability`, `contracts`). 3. Implement Rust gateway with parity adapters to existing services. 4. Migrate `users` service to Rust and switch gateway client to Rust users. 5. Migrate `companies` service to Rust. 6. Migrate `customers` service to Rust. 7. Migrate `professionals` service to Rust. 8. Migrate `jobseekers` service to Rust. 9. Remove legacy Nest services after full parity signoff. ## Phase Exit Checklist (Apply Every Stage) - Build passes. - Contract tests pass. - Runtime-config and onboarding smoke tests pass. - No P0/P1 behavior regressions. - Rollback path validated.