# TORAZ Backend — Recovery Baseline

**Batch:** Recovery 0 (inventory only)
**Date:** 2026-10-07
**Status:** Awaiting review. No backend code exists. Nothing in this document describes working software.

Companion documents: [`RECOVERY_GAPS.md`](./RECOVERY_GAPS.md) (what is missing) and [`IMPLEMENTATION_PLAN.md`](./IMPLEMENTATION_PLAN.md) (how Recovery 1–12 will run).

---

## 1. Bottom line

1. **No part of the original backend survives.** The workspace contains no backend source file, test, Postman collection, or backend design document. Everything from Recovery 1 onward will be newly written code that conforms to the surviving record. It cannot be file-for-file or route-for-route identical to what was lost, and it must never be described as "recovered source".
2. **The requirements survive well.** The original 48-section master prompt, the seven recovery documents, and the complete frontend source (the contract) are all present and mutually consistent on the points the recovery package says were verified (12 admin KPIs; `firstName`/`city`/`profession` card fields; 30 s resend cooldown vs 5 min OTP validity; 30-day deletion).
3. **The exact route list does not survive, only its count (56).** 29 routes have an explicit method and path in the master prompt. The rest are known only as capabilities. See §8.
4. **Several approved decisions are referenced but not stated.** The package says "preserve the previously established…" for the like-revocation rule, the Super Like initial grant, the report rate limit, message pagination semantics, and the unknown-distance sentinel, but does not say what those were. These are the genuinely unrecoverable items; they are listed in `RECOVERY_GAPS.md` section B.
5. **This workspace cannot currently install packages or run MongoDB.** The npm registry and the MongoDB download host are both refused by the network egress allowlist. Unless that changes, Recovery 1 onward can be written and syntax-checked but not run, which is the same limitation the previous implementation ended with.

---

## 2. How to read this document

### Status labels

| Label | Meaning |
|---|---|
| **[CONFIRMED]** | Stated in a surviving document or present in surviving source. The source is cited. |
| **[RECONSTRUCT]** | Not stated anywhere, but follows from confirmed material. Will be newly written. Any design shown is a proposal. |
| **[UNKNOWN]** | Cannot be derived from anything in the workspace. Needs review before it is built. |

### Source abbreviations

| Tag | Source |
|---|---|
| **MP §n** | Original backend master prompt, section *n* (`7039427a-attachment.txt`) |
| **R01 … R07** | Recovery package files `01_RECOVERY_MASTER_PROMPT.md` … `07_RECOVERY_MANIFEST.json` |
| **FE:`path`** | Frontend source file, relative to `toraz_frontend-master/src/` |

### Precedence when sources disagree

1. Your current instructions in this conversation.
2. The recovery package (R01–R07): later, reviewed decisions.
3. The frontend source: the contract for field names, enum values and response shapes.
4. The master prompt: the original specification, superseded wherever 2 or 3 say otherwise.

Historical Phase 1–14 prompts, if supplied later, rank below the recovery package, per your instruction that they must not override later approved recovery decisions.

---

## 3. What was supplied and inspected

| Item | Size | SHA-256 (first 12) | What it is |
|---|---|---|---|
| `7039427a-attachment.txt` | 57,784 bytes, 2,727 lines | `32d06b306a3e` | Original "TORAZ Backend Development Master Prompt", sections 0–48, phases 0–14 |
| `TORAZ_BACKEND_RECOVERY_PACKAGE.zip` | 14,485 bytes, 7 files | `f33bca275f9d` | Recovery documents R01–R07 |
| `toraz_frontend-master.zip` | 90,637,860 bytes, 178 files | `d25a4431ec74` | Next.js 16 frontend, frontend-only, mock service layer |

All three were read in full where they bear on the backend:

- **Master prompt:** all 2,727 lines.
- **Recovery package:** all seven files (1,292 lines).
- **Frontend:** every file under `services/`, `types/`, `mocks/`, `config/`, `lib/validations/` and `hooks/`; the logic of every screen under `app/(auth)`, `app/(app)` and `app/(admin)`; the form, profile, messaging and verification components; `package.json`, `.env.example`, `README.md`, `next.config.ts`, `.gitignore`. Public marketing pages were searched for stated product rules (retention periods, limits) rather than read line by line. Image assets were listed, not opened.

The frontend consists of 138 TypeScript files (14,552 lines) and 40 other files. It was extracted to a separate read-only directory with a per-file checksum manifest so that non-modification can be proven at any later batch.

**Not inspected:** the computer linked to this session. Two attempts to reach it failed ("not connected"), so nothing on it was read. If a copy of the old backend, its documents, or the old Postman collection exists there, it has not been seen.

---

## 4. What is not in the workspace

| Missing | Evidence it once existed | Consequence |
|---|---|---|
| All backend source code | R01 opening; R05 | Every source file will be new |
| `FRONTEND_BACKEND_FIELD_MAPPING.md`, `API_CONTRACT.md`, `DATABASE_DESIGN.md` | MP §2 required them before any model was written | Model fields, indexes and request/response shapes must be re-derived |
| `API.md`, `ROUTE_INVENTORY.md`, `SECURITY_AUDIT.md`, `DEPLOYMENT.md`, backend `README.md` | R01 §7 | The 56-route list and the audit findings are gone |
| `docs/postman/TORAZ.postman_collection.json` | R06 | The 73 requests, including the 17 negative cases, are gone |
| All tests | R01 Recovery 7 mentions "9 pure verification-provider gate tests" | Only the count survives |
| Backend `package.json`, lockfile, `.env.example` | MP §30 gives a starting `.env.example` only | Dependency set, versions and later-added variable names are unknown |
| Phase history and API verification record in original form | R01 opening lists them as surviving | Only the summaries inside R01 and R02 are present |
| Frontend-side "Master" and "Decisions" documents | Cited in frontend comments (e.g. "Master §66", "Decisions #20") | The reasoning behind some frontend choices cannot be checked |
| `design-reference/` and `TORAZ_SCREEN_MAP.txt` | FE `.gitignore`, FE `README.md` | Git-ignored; not in the archive |

The frontend never called the lost backend. No `real.ts` service exists, `NEXT_PUBLIC_API_BASE_URL` is empty, and there is no `fetch`, Socket.IO client or cookie handling anywhere in `src/`. The frontend therefore carries **no wire-level trace** of the old API: no paths, no headers, no status codes.

---

## 5. Current workspace contents

```text
toraz/
├── _recovery_package/          reference: R01–R07 as supplied
├── _frontend_extract/
│   └── toraz_frontend-master/  reference: frontend as supplied, write-protected
├── .frontend_baseline.sha256   178 per-file checksums of the frontend
└── backend/
    └── docs/
        ├── RECOVERY_BASELINE.md     this file
        ├── RECOVERY_GAPS.md
        └── IMPLEMENTATION_PLAN.md
```

`backend/` is a sibling of the frontend, not a folder inside it, so the frontend tree stays untouched. The master prompt describes the backend as living in the same repository as the frontend (MP "ROLE", MP §3); whether the final home is a `backend/` folder in that repository or a separate repository is your call and does not affect the code.

---

## 6. Confirmed facts

### 6.1 Technology and architecture **[CONFIRMED]**

- Node.js, JavaScript (not TypeScript), Express, MongoDB, Mongoose, REST, Socket.IO, JWT, dotenv, secure uploads, VPS-compatible. (MP §1; R01 §2; R02)
- One module system used consistently; centralized configuration; no `process.env` in business logic. (MP §1; R01 §2)
- Layering: route → middleware → validator → controller → service → model. Thin controllers. Centralized errors. Request/correlation ID. (MP §3)
- Required folders: `config`, `controllers`, `middlewares`, `models`, `routes`, `services`, `validators`, `sockets`, `utils`, `jobs`, `adapters`, plus `tests/`, `uploads/`, `docs/`. Empty folders are not to be created just to match the tree. (R04)
- Third-party adapters (SMS, verification, AI moderation, payment) exist and are safe when disabled. (MP §35; R04)

### 6.2 API conventions **[CONFIRMED]**

- Success envelope `{ success: true, message, data }`; paginated responses add `pagination`; errors are `{ success: false, message, errors }`. (MP §29; R01 §5)
- Access token: `Authorization: Bearer <token>`, returned in the verify-OTP response body. Refresh token: HttpOnly cookie, never a JSON field. (MP §9; R06 "Authentication")
- OTP flow is keyed by a request ID (FE:`services/auth/types.ts` `requestId`; R06 variable `otpRequestId`).
- Photo upload is multipart with field name `photo` ("previously `photo` where verified", R06).
- `GET /api/health` exposes minimal status only. (MP §3)

### 6.3 The frontend contract that survives **[CONFIRMED]**

Ten service interfaces with 41 methods define what the UI expects:

| Service | Methods | File |
|---|---|---|
| auth | `requestOtp`, `verifyOtp`, `resendOtp` | FE:`services/auth/types.ts` |
| profile | `registerProfile`, `saveDraft`, `getCurrentProfile`, `updateProfile` | FE:`services/profile/types.ts` |
| discovery | `getRecommended`, `getFeatured`, `search`, `getById` | FE:`services/discovery/mock.ts` |
| matching | `getMatches`, `getLikedYou`, `like`, `superLike`, `pass` | FE:`services/matching/mock.ts` |
| messages | `getConversations`, `getMessages`, `sendMessage` | FE:`services/messages/mock.ts` |
| verification | `getStatus`, `startDigilocker`, `simulateLiveness`, `retry` | FE:`services/verification/types.ts` |
| premium | `getEntitlement`, `purchaseSuperLikePack`, `activateBoost`, `subscribe` | FE:`services/premium/types.ts` |
| settings | `getSettings`, `updatePrivacy`, `updateNotifications`, `logOutSession`, `pauseProfile`, `requestDeletion`, `requestDataExport` | FE:`services/settings/types.ts` |
| admin | `getDashboard` | FE:`services/admin/types.ts` |
| admin/users | `listUsers`, `getVerificationQueue`, `suspendUser`, `reinstateUser`, `approveVerification`, `rejectVerification` | FE:`services/admin/users/types.ts` |

Things the backend scope includes that the frontend has **no service method for**: token refresh, logout, current user, mark-read, block, unblock, list blocked, create report, photo upload/delete/set-primary/serve, admin user detail, admin reports, admin audit logs. In the UI, "Block" and "Submit Report" only show a toast (FE:`app/(app)/profile/[id]/PublicProfileScreen.tsx`), and every "Log out" button only shows a toast and navigates.

Things the frontend shows that need **no backend route**: the member Dashboard's stat tiles, "82% Profile Complete" and recent-activity list are hard-coded; notifications are "coming soon"; voice and video calls are "coming in a future update".

**Registration and profile schema.** One Zod schema, `registrationSchema`, backs both Registration and Edit Profile (FE:`lib/validations/registration.ts`). It has 49 top-level fields:

| Section | Fields |
|---|---|
| Account | `phoneVerified`, `countryCode`, `phoneNumber` |
| About you | `fullName`, `dob{day,month,year}`, `gender`, `genderSelfDescribe`, `sexualOrientation`, `showOrientationOnProfile`, `pronouns`, `pronounsCustom` |
| Location | `country`, `state`, `city`, `hometown` |
| Intentions | `datingIntention`, `otherPreferences[]` |
| Preferences and family | `interestedIn`, `relationshipStatus`, `haveChildren`, `wantChildren`, `openToPartnerWithKids` |
| Appearance and lifestyle | `heightCm`, `bodyType`, `activityLevel`, `starSign`, `diet[]`, `drinking`, `smoking`, `pets[]`, `languages[]` |
| Work and education | `profession`, `company`, `educationLevel`, `university`, `workCities` |
| Beliefs | `religion`, `showReligionOnProfile`, `politicalViews`, `showPoliticalOnProfile` |
| Interests and vibe | `interests[]`, `vibeTags[]` |
| About me | `bio`, `promptQuestion`, `promptAnswer` |
| Privacy | `privacy{visibleInDiscovery, showOnlineStatus, showExactAge, showApproxDistance}` |
| Consent | `safetyPledgeAccepted`, `termsAccepted`, `privacyAcknowledged` |

Required by the schema: `phoneVerified` (must be `true`), `phoneNumber` (10 digits), `fullName` (2–80), `dob` (valid date, age 18–99), `gender`, `state`, `city`, `datingIntention`, `interestedIn`, `relationshipStatus`, `languages` (≥1), `interests` (3–10), `bio` (20–500), the three consent flags, and at least one photo (checked separately). `vibeTags` is capped at 3; `heightCm` is 120–230.

Enumerations enforced by the schema: `gender` (`man`, `woman`, `non_binary`, `self_describe`, `prefer_not_to_say`), `datingIntention` (`marriage`, `long_term`, `short_term`, `open_to_exploring`, `new_friends`), `interestedIn` (`women`, `men`, `everyone`). All other choice fields are typed as plain strings in the schema, with their option lists in FE:`config/registration-options.ts`.

`workCities` is in the schema and in the seeded profile but no form section renders an input for it.

**Other contract types present in full:** `MemberCard` (18 fields, 3 optional) and `RelationshipState` (`none`, `liked`, `super_liked`, `matched`, `liked_you`, `pending`); `Conversation`, `ChatMessage`, `MessageStatus`, `ModerationStatus` (`clear`, `pending_review`, `blocked`), `OnlineState`; `VerificationState` (10 values) and `VerificationStatus`; `PremiumEntitlement`, the pack/boost/plan catalogs; `PrivacySettings` (5 toggles), `NotificationSettings` (8 toggles), `DeviceSession`, `AccountSummary`; `AdminDashboardSnapshot`, `AdminKpi`, `AuditLogEntry`, `AdminUserRecord`, `VerificationQueueItem`, `AdminUserFilters`.

**Discovery filters** (FE:`services/discovery/mock.ts`): `ageMin`, `ageMax`, `distanceKm`, `onlineOnly`, `datingIntention`, `query`. The UI wires only `onlineOnly` and `query`; the mock matches `query` against `firstName`, `city` and `profession`. No other filter exists in the frontend, and MP §46 forbids inventing more.

**Location.** The frontend collects `country`, `state`, `city` and `hometown` as text. It collects no coordinates; "Use Current Location" is a stub. `MemberCard.distanceKm` is nevertheless a required number.

### 6.4 Confirmed numbers and names

| Fact | Value | Source |
|---|---|---|
| OTP resend cooldown | 30 seconds | R02; FE:`services/auth/mock.ts` |
| OTP validity | 5 minutes | R02; FE mock (300 s) |
| OTP length, phone format | 6 digits; 10 digits, `+91` only | FE:`lib/validations/auth.ts`, FE:`components/Forms/PhoneInput.tsx` |
| Verify attempts, resends (frontend mock) | 5 and 5 | FE mock. Not restated by the recovery package |
| Accepted image types | JPEG, PNG, WEBP | R01 §5; FE:`components/Forms/PhotoUploader.tsx` |
| Photos per profile (frontend) | 5 | FE `PhotoUploader` default |
| Account deletion window | 30 days | R01 §5; FE:`app/(app)/settings/SettingsScreen.tsx` |
| Verification when provider unavailable | HTTP 503 | R01 §5 |
| Verification provider modes | `real`, `dev_simulation`, `unavailable` | R01 §5; R02 |
| Verification gate tests | 9 pure tests | R01 Recovery 7 |
| Admin dashboard KPIs | 12, in three groups of 4 | R01 §5; FE:`services/admin/mock.ts` |
| KPIs derivable | `verification_backlog`, `open_safety_reports`, `moderation_alerts`, `total_members`, `new_today`, `active_users` (recent-login proxy), `online_now`, `messages_sent` (24 h), `super_likes` (24 h ledger) | R01 §5 |
| KPIs not tracked | `gateway_retries`, `boost_triggers`, `mod_queue_sla` | R01 §5 |
| Route count | 56 (a historical 57 was corrected) | R01 §5; R07 |
| Postman | v2.1; 56 positive + 17 negative = 73 | R06; R07 |
| Model names | `User`, `OtpRequest`, `Session`, `Profile`, `Photo`, `Like`, `Match`, `SuperLikeLedgerEntry`, `Conversation`, `Message`, `Block`, `Report`, `ModerationEvent`, `Verification`, premium/entitlement model(s), `UserSettings`, `AccountDeletionRequest`, `AdminAuditLog` | R04; R02 |
| Postman variables | `baseUrl`, `accessToken`, `userId`, `targetUserId`, `profileId`, `photoId`, `conversationId`, `messageId`, `sessionId`, `reportId`, `otpRequestId`, `socketIoNote` | R06 |

### 6.5 Approved decisions carried forward **[CONFIRMED]**

R01 §5 and R02 are the authoritative text; this is an index, not a replacement.

- **Profile.** Separate from User. No placeholder `Profile.status`. Completion is derived. Photos are never written as arbitrary URLs.
- **Photos.** Memory upload, magic-byte check, dimension check, Sharp re-encode, UUID filenames, no unrestricted static serving, ownership from the JWT, careful primary-photo handling.
- **Discovery.** Backend eligibility pipeline: exclude self, active accounts only, compatibility from stored fields, blocks in both directions, privacy respected, no GPS exposure, safe "unknown" distance, user regex input escaped.
- **Matching.** Unique outbound like per pair, canonical pair ordering, one Match per mutual like, transaction-safe where supported, blocks enforced.
- **Super Likes.** Ledger model; balance derived from the ledger; concurrent consumption protected.
- **Messaging.** Only authorized participants; sender from authentication; persist before broadcast; Socket.IO uses the same identity and authorizes room joins; block state rechecked on send; mark-read idempotent; cursor pagination.
- **Safety.** One central blocking policy used by discovery, profiles, likes, Super Likes, matches, messaging and sockets. Reports access-controlled and rate-limited. Non-clear moderation outcomes create moderation events.
- **Verification.** Three provider modes. A disabled provider never auto-verifies. Simulation needs an explicit flag and is hard-blocked in production. No unnecessary raw identity or biometric payloads. Provider references are internal.
- **Premium.** Server-authoritative entitlements. Disabled payment grants nothing. Any payment simulation is explicitly gated and impossible in production. Boost expiry decided server-side. Messaging premium state derived server-side.
- **Settings and deletion.** Settings privacy and profile privacy are distinct. Sessions are server-authoritative. 30-day scheduled purge with requested time, scheduled time, status and purge metadata. Purge is idempotent: photos removed from database and disk, verification document deleted, messages tombstoned in place, other records retained. Purge is triggered by an external scheduler, not an in-process timer.
- **Admin.** Active-admin authorization on every admin route. Suspend/reinstate, verification management, reports, audit logs. No fabricated KPIs or activity.

---

## 7. What can be reconstructed

"Confidence" is how closely new code can be expected to match the lost behaviour, given only what is in the workspace.

| Module | Confidence | Basis | Main open items (IDs in `RECOVERY_GAPS.md`) |
|---|---|---|---|
| Foundation: config, DB, security middleware, envelope, errors, health | High | MP §3, §26–§31; R01 §5 | D23, E1 |
| Auth: OTP, JWT, refresh sessions | High for flow, medium for limits | MP §8–§10; FE auth service; R02 | C5, C6, D7 |
| Profile and registration | High | Full Zod schema and option lists survive | C9, D4, D5 |
| Photos | High for the pipeline, medium for limits and serving | R01 §5; FE `PhotoUploader` | C2, D6 |
| Discovery | Medium | Filters and card shape confirmed | B6, B7, D19 |
| Likes, Super Likes, matches | Medium | State machine in FE matching mock; R01 §5 | B2, B3 |
| Messaging over REST | Medium | Four explicit routes; FE types | B5, B12, D3, D8, D10 |
| Socket.IO | Low to medium | Concepts only (MP §18); no client exists | D11 |
| Blocking, reporting, moderation events | Medium to high | Explicit routes; R01 §5 | B4, D9, D18 |
| Verification | High for provider gating, medium for the state machine | R01 §5 is detailed | B10, C1, D21 |
| Premium and payment-disabled architecture | Medium | FE entitlement type and catalogs | B13, D22 |
| Settings, sessions, deletion, purge job | Medium | FE settings types; R01 §5 | B8, C8, D12, D15, D16, D17 |
| Admin | Medium to high | KPI decisions are detailed; seven explicit routes | B11, B14, C7, D13, D14 |
| Tests | New work | Nothing survives | B10 |
| Postman, route inventory, API and deployment docs | Reconstructable after code | R06 process is explicit | B1, B9 |

---

## 8. Route reconciliation

The package gives the historical count (56) but not the list. The table below is every routable capability evidenced by at least one surviving source. It is an **evidence inventory, not a recovered route list**.

"Explicit" means the master prompt gives a method and path. MP §11–§16 calls several of these "examples" that may be adjusted to the frontend.

| # | Module | Capability | Method and path | Evidence |
|---|---|---|---|---|
| 1 | Health | Status | `GET /api/health` — explicit | MP §3 |
| 2 | Auth | Request OTP | `POST /api/auth/request-otp` — explicit | MP §8; FE `requestOtp` |
| 3 | Auth | Verify OTP | `POST /api/auth/verify-otp` — explicit | MP §8; FE `verifyOtp` |
| 4 | Auth | Resend OTP | `POST /api/auth/resend-otp` — explicit | MP §8; FE `resendOtp` |
| 5 | Auth | Refresh | `POST /api/auth/refresh` — explicit | MP §8 |
| 6 | Auth | Logout | `POST /api/auth/logout` — explicit | MP §8 |
| 7 | Auth | Current user | `GET /api/auth/me` — explicit | MP §8 |
| 8 | Profile | Get own profile | path unknown | MP §40; FE `getCurrentProfile` |
| 9 | Profile | Update profile | path unknown | MP §40; FE `updateProfile` |
| 10 | Profile | Register profile | path unknown | MP §40; FE `registerProfile` |
| 11 | Profile | Save draft | path unknown | FE `saveDraft` only |
| 12 | Photos | Upload | `POST /api/profile/me/photos` — explicit | MP §11 |
| 13 | Photos | Delete | `DELETE /api/profile/me/photos/:photoId` — explicit | MP §11 |
| 14 | Photos | Update / set primary | `PATCH /api/profile/me/photos/:photoId` — explicit | MP §11 |
| 15 | Photos | Serve image | path unknown | R01 §5 "secure serving" |
| 16 | Discovery | Search with filters | `GET /api/discovery` — explicit | MP §12; FE `search` |
| 17 | Discovery | Recommended | path unknown | FE `getRecommended` |
| 18 | Discovery | Featured | path unknown | FE `getFeatured` |
| 19 | Discovery | Member by ID (public profile) | path unknown | FE `getById` |
| 20 | Matching | Like | `POST /api/matching/:userId/like` — explicit | MP §14; FE `like` |
| 21 | Matching | Super Like | `POST /api/matching/:userId/super-like` — explicit | MP §15; FE `superLike` |
| 22 | Matching | Matches | `GET /api/matching/matches` — explicit | MP §16; FE `getMatches` |
| 23 | Matching | Incoming likes | path unknown | MP §40; FE `getLikedYou` |
| 24 | Matching | Pass | path unknown | FE `pass` |
| 25 | Matching | Revoke outbound like | path unknown; may be the same route as 24 | R01 §5 |
| 26 | Messages | Conversations | `GET /api/messages/conversations` — explicit | MP §17 |
| 27 | Messages | Conversation messages | `GET /api/messages/conversations/:conversationId` — explicit | MP §17 |
| 28 | Messages | Send message | `POST /api/messages/conversations/:conversationId/messages` — explicit | MP §17 |
| 29 | Messages | Mark read | `PATCH /api/messages/:messageId/read` — explicit | MP §17 |
| 30 | Blocking | Block | `POST /api/users/:userId/block` — explicit | MP §20 |
| 31 | Blocking | Unblock | `DELETE /api/users/:userId/block` — explicit | MP §20 |
| 32 | Blocking | Blocked users | `GET /api/users/blocked` — explicit | MP §20 |
| 33 | Reports | Create report | `POST /api/reports` — explicit | MP §21 |
| 34 | Verification | Status | path unknown | MP §40; FE `getStatus` |
| 35 | Verification | Start | path unknown | MP §40; FE `startDigilocker` |
| 36 | Verification | Submit / liveness | path unknown | MP §40; FE `simulateLiveness` |
| 37 | Verification | Retry | path unknown | FE `retry` |
| 38 | Verification | Provider callback | path unknown; "if needed" | MP §40 |
| 39 | Premium | Entitlement | path unknown | MP §40; FE `getEntitlement` |
| 40 | Premium | Super Like balance | path unknown; may be part of 39 | MP §40 |
| 41 | Premium | Boost state | path unknown; may be part of 39 | MP §40 |
| 42 | Premium | Purchase Super Like pack | path unknown | FE `purchaseSuperLikePack` |
| 43 | Premium | Activate Boost | path unknown | FE `activateBoost` |
| 44 | Premium | Subscribe | path unknown | FE `subscribe` |
| 45 | Settings | Get settings | path unknown | MP §40; FE `getSettings` |
| 46 | Settings | Update privacy | path unknown | FE `updatePrivacy` |
| 47 | Settings | Update notifications | path unknown | FE `updateNotifications` |
| 48 | Settings | List sessions | path unknown; may be part of 45 | MP §40 |
| 49 | Settings | Log out a session | path unknown | MP §40; FE `logOutSession` |
| 50 | Settings | Pause profile | path unknown | FE `pauseProfile` |
| 51 | Settings | Request deletion | path unknown | MP §40; FE `requestDeletion` |
| 52 | Settings | Request data export | path unknown | FE `requestDataExport` only |
| 53 | Admin | Dashboard | `GET /api/admin/dashboard` — explicit | MP §25 |
| 54 | Admin | Users | `GET /api/admin/users` — explicit | MP §25 |
| 55 | Admin | User detail | `GET /api/admin/users/:id` — explicit | MP §25 |
| 56 | Admin | Suspend / reinstate | `PATCH /api/admin/users/:id/status` — explicit | MP §25 |
| 57 | Admin | Verification decision | `PATCH /api/admin/users/:id/verification` — explicit | MP §25 |
| 58 | Admin | Reports | `GET /api/admin/reports` — explicit | MP §25 |
| 59 | Admin | Audit logs | `GET /api/admin/audit-logs` — explicit | MP §25 |
| 60 | Admin | Verification queue | path unknown | FE `getVerificationQueue` |
| 61 | Admin | Manage a report | path unknown | R01 §5; MP §21; R06 `reportId` |

**Tally.** 61 evidenced capabilities: 29 with an explicit method and path, 32 known by capability only.

**Against the historical 56.** Five of the 61 are marked as possibly folded into another route or built only "if needed" (25, 38, 40, 41, 48). Removing those five gives 56, so the historical count is consistent with this inventory. That is a plausibility check only: other combinations also reach 56, and nothing in the workspace says which routes actually existed. Per R01 §5 and R06, the final count will be generated mechanically from the reconstructed route files, and 56 will be treated as a cross-check, not a target.

---

## 9. Master prompt items superseded by later decisions

These are settled by precedence and are not open questions.

| Master prompt says | Later decision | Source |
|---|---|---|
| Phase 12: replace frontend mock services with real API calls (MP §36, §45) | No frontend work of any kind | R01 §10; your instruction |
| `VERIFICATION_PROVIDER_ENABLED=false` as the only switch (MP §22) | Three explicit provider modes; disabled returns 503; no auto-verify | R01 §5 |
| Phases 0–14 | Recovery batches 0–12 | R03 |
| `User.mobile` (MP §5) | The frontend names are `countryCode` and `phoneNumber` | FE auth types; MP §0 rule 2 |
| Photo "reorder/set-primary if required" (MP §11) | The frontend has set-primary only, no reorder | FE `PhotoUploader` |
| Possible filters: city, gender, interests, vibe, verification (MP §12) | Only the six filters in `DiscoveryFilters` exist | FE discovery mock; MP §46 |
| `Notification` model "if required" (MP §4) | Not required: notifications are "coming soon" | FE `TopHeader` |
| 57 routes | 56, and never hard-coded | R01 §5 |

---

## 10. Environment findings

Checked on 2026-10-07 in this cloud workspace. These are observations from commands actually run, not assumptions.

| Check | Result |
|---|---|
| Node.js / npm | v22.22.0 / 10.9.4 |
| OS | Ubuntu 24.04.5 LTS, x86_64 |
| `npm view express version` (and mongoose, socket.io, sharp, mongodb-memory-server) | **HTTP 403.** Response: `x-deny-reason: host_not_allowed` — "Host not in allowlist: registry.npmjs.org. Add this host to your network egress settings to allow access." |
| MongoDB server binary (`mongod`, `mongosh`) | Not installed |
| `fastdl.mongodb.org` (source for a local test MongoDB) | **Refused by egress policy (403)** |
| Docker | CLI present, no daemon running |
| Globally pre-installed Node packages | `sharp`, `typescript`, `tsx` and unrelated document and browser tooling. No Express, Mongoose, Socket.IO, or test libraries |
| git | 2.43.0 |
| Linked computer | Unreachable on two attempts |

**What this means.** As configured today, this workspace can write files and run `node --check` and dependency-free `node:test` tests. It cannot run `npm install`, start the Express app, connect to MongoDB, or run HTTP, Socket.IO or concurrency tests. R02 records that the previous implementation ended in exactly this position ("package-install/network problems and lack of live MongoDB/HTTP/Socket runtime validation").

**This workspace is also temporary.** It is reclaimed after inactivity, which is how the previous source tree was lost. Until a durable home is agreed, the only copies of the recovery work are the files sent to you at the end of each batch.

---

## 11. Readiness for Recovery 1

**On requirements: yes.** Recovery 1 (foundation) depends on nothing in `RECOVERY_GAPS.md` sections B, C or D except three technical choices the record leaves open (module system, validation library, test runner: gap D23), for which `IMPLEMENTATION_PLAN.md` §2 proposes defaults.

**On verifiability: not yet.** Without access to the npm registry, Recovery 1 would produce a foundation that has never been started. Two things should be settled first:

1. Allow `registry.npmjs.org` (and ideally `fastdl.mongodb.org`) in this environment's network egress settings, or decide that runtime validation will happen somewhere else.
2. Decide where the work is kept so it cannot be lost again (gap E4).

Neither blocks writing code. Both decide whether Recovery 1 can end with real test results instead of "not executed".
