WorkStay Extraction Prep Map
Purpose
This document records the current extraction-preparation truth for the future accommodation-worker platform that may later become a standalone WorkStay-style runtime.
It does not claim that a unified WorkStay backend already exists.
It distinguishes between:
- current accommodation domain truth
- current vacancy / worker domain truth
- future combined platform intent
- compatibility residue that still blocks clean extraction
Labels used here:
VERIFIEDINFERREDUNVERIFIEDREALMIXEDUI-FIRSTSHELLMISSING
1. Current accommodation-owned surface
| Surface | Current location | Classification | Ownership | Notes |
| --- | --- | --- | --- | --- |
| Accommodation listing write model | services/svc-tenders/src/accommodation/commandHandlers.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | Durable create / update / publish / unpublish flow over accommodation_listings. |
| Accommodation public listing/detail read model | services/svc-tenders/src/accommodation/readModel.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | Active route-time public reads use projection-backed listing/detail views. |
| Accommodation owner listing reads | services/svc-tenders/src/accommodation/ownerReadRepository.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | Owner listing reads are real but intentionally asymmetric from public reads. |
| Accommodation booking / reservation write model | services/svc-tenders/src/accommodation/commandHandlers.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | Booking request / confirm / reject / cancel are durable domain writes. |
| Accommodation booking / reservation reads | services/svc-tenders/src/accommodation/readModel.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | my-accommodation-bookings and owner reservation reads are active preferred reads, not compatibility stubs. |
| Accommodation public compatibility catalog | services/svc-tenders/src/accommodation/compatibilityReadRepository.ts | VERIFIED MIXED | legacy compatibility residue inside future WorkStay candidate surface | Reads legacy accommodations table for older root-repository consumers. |
| Accommodation route module | services/svc-tenders/src/routes/registerAccommodationRoutes.ts | VERIFIED REAL | accommodation-owned, temporary-hosted-in-svc-tenders | Active HTTP registration already uses dedicated command/read repositories instead of root repository methods. |
| Accommodation route support | services/svc-tenders/src/routes/support/accommodationRouteSupport.ts | VERIFIED REAL | accommodation-owned with shared shell ingress | Local mutation mapping + public payload shaping live here; auth/parser ingress still comes from shell. |
2. Current vacancy / worker-owned surface
| Surface | Current location | Classification | Ownership | Notes |
| --- | --- | --- | --- | --- |
| Vacancy posting write model | services/svc-tenders/src/vacancy/commandHandlers.ts | VERIFIED REAL | vacancy/worker-owned, temporary-hosted-in-svc-tenders | Durable posting draft / update / publish / close / reopen writes over vacancy_postings. |
| Vacancy application write model | services/svc-tenders/src/vacancy/commandHandlers.ts | VERIFIED REAL | vacancy/worker-owned, temporary-hosted-in-svc-tenders | Durable submit / shortlist / reject / accept / withdraw flow over vacancy_applications. |
| Vacancy preferred read model | services/svc-tenders/src/vacancy/readRepository.ts | VERIFIED MIXED | vacancy/worker-owned, temporary-hosted-in-svc-tenders | Active route-time reads are here, but public discovery still unions projection-backed rows with legacy vacancies fallback. |
| Vacancy application compatibility reads | services/svc-tenders/src/vacancy/compatibilityApplicationRepository.ts | VERIFIED MIXED | legacy compatibility residue | Thin wrapper around preferred vacancy reads for older root-repository surfaces. |
| Vacancy public / owner compatibility reads | services/svc-tenders/src/vacancy/compatibilityReadRepository.ts | VERIFIED MIXED | legacy compatibility residue | Compatibility hosting still exists, but active route-time reads do not depend on it. |
| Vacancy route module | services/svc-tenders/src/routes/registerVacancyRoutes.ts | VERIFIED REAL | vacancy/worker-owned, temporary-hosted-in-svc-tenders | Active HTTP registration already depends on dedicated command handlers and preferred read repository. |
| Vacancy route support | services/svc-tenders/src/routes/support/vacancyRouteSupport.ts | VERIFIED REAL | vacancy/worker-owned with shared shell ingress | Capability checks and mutation-error mapping are local; auth/parser ingress remains shell-shared. |
3. Current booking / reservation / application truth
| Surface | Classification | Ownership | Notes |
| --- | --- | --- | --- |
| Accommodation booking writes | VERIFIED REAL | accommodation-owned | Durable and active through AccommodationCommandHandlers. |
| Accommodation booking reads | VERIFIED REAL | accommodation-owned | Uses AccommodationReadRepository, not fake placeholder arrays anymore. |
| Vacancy applications | VERIFIED REAL | vacancy/worker-owned | Durable applicant + owner review flow. |
| Unified stay-work recommendation / assignment backend | VERIFIED MISSING | future WorkStay-candidate-owned | No durable backend boundary found that combines bookings and worker placement into one service contract. |
4. Current nearby / workstay coupling truth
| Surface | Current location | Classification | Ownership | Notes |
| --- | --- | --- | --- | --- |
| Accommodation catalog nearby vacancy previews | apps/web/src/features/domains/accommodationCatalog.ts | VERIFIED UI-FIRST | future WorkStay-candidate-owned, currently UI-first | Nearby vacancy previews are assembled in frontend catalog helpers, not from backend WorkStay contracts. |
| Vacancy catalog accommodation and transport options | apps/web/src/features/domains/vacancyCatalog.ts | VERIFIED UI-FIRST | future WorkStay-candidate-owned, currently UI-first | Catalog includes accommodation/transport options and policy text, but this is frontend fallback/catalog composition. |
| Workforce portal | apps/web/src/app/[locale]/(portal)/workforce/page.tsx | VERIFIED UI-FIRST | ambiguous future WorkStay-candidate-owned | Page is explicitly backed by frontend mock data and presented as read-only structural input. |
| Map layers for vacancies / accommodations / workforce | apps/web/src/features/map/layers/vacanciesLayer.ts, apps/web/src/features/map/layers/accommodationsLayer.ts, apps/web/src/features/map/layers/workforceLayer.ts | VERIFIED UI-FIRST | future WorkStay-candidate-owned, currently UI-first | All three layers point at frontend mock datasets, not backend spatial APIs. |
| Transport-nearby linkage | apps/web/src/app/[locale]/(portal)/transport/page.tsx | VERIFIED MISSING for WorkStay backend | shared-Kvary / future logistics, not current WorkStay backend | Current transport page is auction/logistics oriented, not accommodation-worker backend logic. |
| Sabre-style travel expansion | no real code found in inspected backend surfaces | VERIFIED MISSING | future platform intent only | No present backend contract or module should be treated as current travel ownership. |
5. Temporary hosting points inside svc-tenders
| Hosting point | Classification | Notes |
| --- | --- | --- |
| services/svc-tenders/src/server.ts route composition | VERIFIED SHELL | Vacancy/accommodation route modules are injected from the mixed service shell. |
| services/svc-tenders/src/repository.ts compatibility hosting | VERIFIED MIXED | Root repository still hosts compatibility residue for vacancy/accommodation reads. |
| shared shell auth ingress passed through route support | VERIFIED SHELL | requireServiceAuth, requireActivePrincipal, and parser helpers are still shell-owned. |
| local projection event log in outbox_events | VERIFIED MIXED | Real for vacancy/accommodation, but still hosted inside svc-tenders runtime assumptions and not yet a clean standalone event boundary. |
6. Shared Kvary backbone dependencies
These dependencies look acceptable to remain shared even after future WorkStay extraction:
- shared auth / identity principal resolution
- gateway proxy façade in
services/api - DB pool and runtime config patterns
- generic shell ingress helpers such as bearer extraction and JWT verification
These do not justify keeping accommodation/vacancy permanently inside svc-tenders.
7. Likely future combined WorkStay-owned surface
The following combined platform surface is strategically plausible, but not yet unified in code:
| Future combined surface | Current truth | Notes | | --- | --- | --- | | accommodation discovery + owner listing management | partly ready | Real backend exists, but public compatibility residue and gateway asymmetry remain. | | vacancy discovery + posting/application lifecycle | partly ready | Real backend exists, but public vacancy discovery still has dual truth. | | booking + application operator flows | mostly ready | Both are durable and route-backed today, though still separate domain modules. | | nearby stay ↔ nearby work intelligence | not ready | Mostly frontend catalog/mock composition today. | | workforce discovery / supply register | not ready | Current page is mock-backed and lacks backend ownership. | | travel integration seam | not ready | No current backend contract or implementation found in inspected surfaces. |
8. Minimum credible extraction-prep package
The smallest credible extraction-prep package is not yet a single runtime. It is a candidate package made of real modules plus explicit “stay for now” residue.
Move-first candidates
services/svc-tenders/src/vacancy/readRepository.tsservices/svc-tenders/src/vacancy/commandHandlers.tsservices/svc-tenders/src/vacancy/projections.tsservices/svc-tenders/src/vacancy/validation.tsservices/svc-tenders/src/accommodation/readModel.tsservices/svc-tenders/src/accommodation/ownerReadRepository.tsservices/svc-tenders/src/accommodation/commandHandlers.tsservices/svc-tenders/src/accommodation/projections.tsservices/svc-tenders/src/accommodation/validation.tsservices/svc-tenders/src/routes/registerVacancyRoutes.tsservices/svc-tenders/src/routes/registerAccommodationRoutes.tsservices/svc-tenders/src/routes/support/vacancyRouteSupport.tsservices/svc-tenders/src/routes/support/accommodationRouteSupport.ts
Keep temporarily during prep
- root compatibility residue in
services/svc-tenders/src/repository.ts services/svc-tenders/src/vacancy/compatibilityReadRepository.tsservices/svc-tenders/src/vacancy/compatibilityApplicationRepository.tsservices/svc-tenders/src/accommodation/compatibilityReadRepository.ts- service-shell auth/principal ingress in
services/svc-tenders/src/server.ts
Move later, only after backend truth exists
- workforce portal/backend
- nearby stay-work intelligence contracts
- travel / Sabre-style contract boundary
- transport-adjacent logic not currently backed by WorkStay backend routes
9. Top blockers before actual extraction
| Blocker | Severity | Type | Why it blocks extraction | Next reduction step |
| --- | --- | --- | --- | --- |
| Dual public vacancy truth (vacancy_postings_view + vacancies fallback) | HIGH | code+infra | Public discovery is still mixed, so extracted vacancy service would inherit legacy fallback decisions immediately. | Decide whether to converge public vacancy reads onto projections or explicitly preserve legacy fallback behind a named compatibility seam. |
| Accommodation compatibility residue in root repository | MEDIUM | code-only | Active routes are cleaner than root hosting, but legacy catalog reads still keep the ownership story mixed. | Move accommodation contracts away from root compatibility hosting or retire old consumers. |
| Incomplete accommodation gateway seam | HIGH | code+infra | Public reads and owner reads can target ACCOMMODATIONS_SERVICE_URL, but booking/listing mutations and my-accommodation-bookings still proxy only to TENDERS_SERVICE_URL. | Give accommodation mutation and booking routes the same explicit env seam as public/owner reads. |
| No unified WorkStay contracts | MEDIUM | code-only | Vacancy and accommodation are still separate route/repository contracts with no combined package boundary. | Extract domain-local contracts or package boundaries for accommodation and vacancy first. |
| UI-first nearby stay/work and workforce surfaces | MEDIUM | code-only | Future WorkStay intelligence surface does not yet have backend ownership. | Decide whether those features are deferred or need a first backend contract before extraction. |
| Root repository compatibility dependence | MEDIUM | code-only | Older callers still reach vacancy/accommodation through TendersRepository. | Inventory and reduce remaining root compatibility callers before extraction execution. |
| Local outbox_events usage without clear external event contract | MEDIUM | code+infra | Projection/event flow is real but service-local, not yet a clean shared event seam. | Decide whether WorkStay keeps this as local projection infrastructure or exposes explicit integration events later. |
| Web/service fallback type duplication | LOW | code-only | The web app keeps fallback domain catalogs and corresponding view types beside backend contracts. | Document which frontend types are UI fallback only versus future shared domain contracts. |
10. Recommended extraction direction
Recommended next direction is:
- treat vacancy and accommodation as two real backend subdomains inside one future WorkStay candidate boundary
- do not pretend workforce / nearby intelligence / travel are already backend-owned
- harden code boundaries and contracts for vacancy + accommodation first
- reduce compatibility residue and gateway asymmetry second
- only then define a true combined WorkStay runtime package
That sequence is safer than inventing a unified platform abstraction before current code truth is stable.