TESWA — REAL ESTATE EXPANSION · TECHNICAL BLUEPRINT

What changes, where, and how hard

Grounded in the deep scan (9 subsystem readers + a critic pass over the whole codebase). Written assuming the recommended decisions; if the board lands differently, this page updates.

Data model — the ad document

Heavy
  • Every ad gets category: "cars" | "realestate" — one backfill stamps all existing ads as cars. This is THE Phase 1 change.
  • Property fields (type, purpose, size, rooms, baths, floor, furnished, buildingAge) join the ad shape; car fields stay untouched.
  • The ad is created in 3 parallel paths today (client publish, server create-on-payment, relist) — all three learn category + property validation together, or nothing ships.
  • Firestore composite indexes: property filter combos get their own index entries; car ones stay as-is.
  • Locked by the board: محافظة+منطقة required with قطعة optional (I1/I2) · صيغة الإيجار on rent ads (I3) · price required (I4) · المعلن optional, shown when picked (I5) · التصنيف on أرض/عمارة/تجاري (I12) · one unit per ad (I6) · rentals close terminal like cars (I7) · photos optional with a type-artwork placeholder (D5).

Search & browse

Heavy
  • A second Algolia index (listings_re) with property ranking + facets; the sync job runs one loop, routes records by category.
  • A property FilterQuery (type/purpose/area/size/rooms…) with its own URL params; the car one is frozen for app parity.
  • The Firestore-vs-Algolia cost split gets its own eligibility table for property.
  • Saved searches gain a category stamp; old saved docs decode as cars forever.
  • The property world gets a Zillow/Airbnb-style MAP BROWSE surface — ads auto-place from منطقة/قطعة, approximate circles, zero seller effort (your I2); it gets its own «أفكار» design rounds.

Server jobs (38 functions)

Medium effort
  • Money/lifecycle/photo machinery works as-is — the work is category FILTERS, not rewrites.
  • Every cap count (free limit, tier live-cap, 400 inventory, expiry parking) gains a category filter — Phase 1 does them all at once with tests.
  • Dealer stock records (aggregates) grow a property section (type tallies) for office directory rows.
  • Saved-search alert matching learns the property filter mapping.

Vocabulary (lookups)

Heavy
  • The dictionary is rebuilt as a NESTED per-category structure (your B4) — the seeder, the readers, the security rules and 4 server files get restructured, and the car vocabulary migrates into the new shape with proof nothing changed.
  • Shared lists stay shared: areas (المناطق), report reasons, user types.
  • The admin lookups editor gets a cars | عقارات tab so the rail stays clean.
  • Label resolution (ids → Arabic names) gets a per-category field map — same mechanism, new table.

Money

Medium effort
  • The payment rail (orders, Tap simulator, settle, refunds, reconciliation) needs zero category work — orders just gain a category stamp for clean reporting.
  • Property packages = separate catalogue docs (car docs untouched); admin gets property package screens (your A3/A4 decisions).
  • Office subscriptions = own tier catalogue + a subscription per business; the sub engine parameterizes on the catalogue.
  • Free property ads via a simple limit at launch (recommended F1) — the coin wallet stays cars-only, zero risk to the live economy.
  • Locked by the board: the bump economy clones to property as-is with its own prices (I8) · free property ads expire after N days with one-tap free renew (I9) · welcome gifts per category (F4).

Accounts & business identity

Medium effort
  • A business belongs to one category (E1) — that part is the model. SUPERSEDED 2026-07-29: the second half of E1 said the same phone could open a second business profile. It cannot. One phone number = one account, and a business account is approved for ONE world, forever. There is no second profile and no account switching.
  • Buyer tools (favorites/saved/history) scope per category — they store bare ad ids already, so this is filtering + a switcher in the confirmed tools box.
  • The /showrooms directory query gains a category filter BEFORE any office is approved (so offices never leak into the car directory).
  • The business cockpit re-labels per category; the shell, tabs and stats design stay.

Admin dashboard

Medium effort
  • A category switcher scopes: lookups editor, listings moderation, packages config, stats.
  • Money desks stay ledgered and category-stamped; revenue reports show per-category + total.
  • Office approval reuses the showroom approval screen with a category filter.
  • The «السيارات الجديدة» CMS section stays car-only.
  • Locked by the board: property ads publish instantly, reports handled by hand (I10/I11) · Kuwait-only permanently (I14) · offers only, no «مطلوب» ads (I13).

Public URLs, SEO & share cards

Medium effort
  • Property landing tree: /realestate, /realestate-in/[area], /realestate-type/[type] — the landing machinery is already parameterized; this is cloning with property copy.
  • /listings/TW-#### stays the one ad URL; the page renders per category (recommended B3).
  • Sitemap: append the property tree; ad entries need nothing once category exists.
  • Share cards: property version with English labels (Apartment · Salmiya) — same proven approach as car cards.
  • Structured data for Google: property pages emit RealEstateListing instead of Car.

The copy sweep

Medium effort
  • «سيارة» appears ~470 times across 96 files — Phase 8 sweeps them systematically: every string becomes category-aware, category-neutral, or provably car-world-only.
  • The brand line changes per your H5 pick — it is the site description AND the fallback share card.

Done automatically — not on the board

  • Category stamp on every order, stat event, analytics event and daily-stat bucket from day one (mixed history can never be un-mixed).
  • Security rules: property fields validated server-side like car fields; storage rules unchanged (the photo pipeline is category-free).
  • Lead records (calls/WhatsApp clicks) carry the category via their ad.
  • The playground decision board itself saves through the same admin-gated server write the dashboard editors use.

Flags on the table (not blockers)

  • The site has no push channel at all — «ننبهك بالجديد» reaches only the old app today, for cars too. Board question H2 decides when we fix it.
  • The mobile app is OUT OF SCOPE by your ruling (2026-07-28): no compatibility work, no mirrors — the site is the product, and the app gets fully redone later. If migrations break the old app along the way, that is accepted.
  • test.teswa.net shares the production database — the build runs behind category guards on production (board question H3).
🔧🧪