<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Musab Khan</title>
    <description>The latest articles on DEV Community by Musab Khan (@musabkhan).</description>
    <link>https://dev.to/musabkhan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4284289%2F2abc9bad-1588-41f2-965a-21d48234a23e.png</url>
      <title>DEV Community: Musab Khan</title>
      <link>https://dev.to/musabkhan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/musabkhan"/>
    <language>en</language>
    <item>
      <title>How We Built a Multi-Property Occupancy Ledger and WhatsApp AI Assistant for Room-Based Housing</title>
      <dc:creator>Musab Khan</dc:creator>
      <pubDate>Sat, 05 Dec 2026 08:34:00 +0000</pubDate>
      <link>https://dev.to/musabkhan/how-we-built-a-multi-property-occupancy-ledger-and-whatsapp-ai-assistant-for-room-based-housing-2n3a</link>
      <guid>https://dev.to/musabkhan/how-we-built-a-multi-property-occupancy-ledger-and-whatsapp-ai-assistant-for-room-based-housing-2n3a</guid>
      <description>&lt;p&gt;Traditional property management software assumes a simple 1:1 relationship: one lease, one apartment, one monthly invoice. &lt;/p&gt;

&lt;p&gt;When we started building &lt;a href="https://yourpulse.io" rel="noopener noreferrer"&gt;PulseHub&lt;/a&gt;, an accommodation management platform for HMOs, student housing, co-living spaces, and hostels, we quickly realized that standard real estate data models fall apart in room-based operations. In a student hall or hostel, a single room has multiple beds, residents move mid-month, shared utilities get split dynamically, and managers run daily operations from their phones rather than a desktop dashboard.&lt;/p&gt;

&lt;p&gt;Here is a look at the core architectural decisions we made to handle bed-level occupancy, audit trails, and conversational workflows.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Modeling Bed-Level Occupancy Without Double-Booking
&lt;/h2&gt;

&lt;p&gt;In multi-bed accommodations, availability is time-bound and hierarchical: &lt;strong&gt;Property → Floor/Unit → Room → Bed&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of storing a simple &lt;code&gt;status: "occupied" | "available"&lt;/code&gt; boolean on a room or bed, we modeled occupancy as date-bounded allocation intervals. A bed's availability for any target window &lt;code&gt;[startDate, endDate)&lt;/code&gt; is computed by checking for overlapping active allocations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;beds&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;room_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; \&lt;span class="nv"&gt;$1&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;bed_allocations&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bed_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
      &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'reserved'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; \&lt;span class="nv"&gt;$3&lt;/span&gt; &lt;span class="c1"&gt;-- requested end_date&lt;/span&gt;
      &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \&lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;-- requested start_date&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Interval Queries Beat Status Flags
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Future Reservations:&lt;/strong&gt; Operators can assign a bed to an incoming student two months before the current resident moves out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mid-Month Room Transfers:&lt;/strong&gt; Moving a resident from Room 102-B to Room 204-A simply closes the first allocation interval and opens a second one on the transfer date, keeping occupancy math accurate to the day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vacancy Leakage Visibility:&lt;/strong&gt; Calculating exact vacant bed-days makes it easy to quantify lost revenue. (If you manage room-based units, we released a free &lt;a href="https://pulse-tools-two.vercel.app/" rel="noopener noreferrer"&gt;Accommodation Occupancy &amp;amp; Revenue Calculator&lt;/a&gt; to model how small vacancy and arrears percentages impact net profit.)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Event-Sourced Resident Timeline
&lt;/h2&gt;

&lt;p&gt;When a tenant disputes a security deposit deduction six months after moving in, reconstructing their history from separate payment tables, maintenance tickets, and chat logs is painful.&lt;/p&gt;

&lt;p&gt;To solve this, every state-changing action in &lt;a href="https://yourpulse.io" rel="noopener noreferrer"&gt;PulseHub's accommodation management software&lt;/a&gt; appends an immutable event to a unified &lt;strong&gt;Resident Timeline&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;TimelineEventType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'ADMISSION_CREATED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'BED_ASSIGNED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'ROOM_CHANGED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'CHARGE_POSTED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'PAYMENT_RECORDED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'DEPOSIT_HELD'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'DEPOSIT_REFUNDED'&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'COMPLAINT_LOGGED'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ResidentTimelineEvent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;residentId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;propertyId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TimelineEventType&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;occurredAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;actorId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;unknown&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separating the &lt;strong&gt;Payments Ledger&lt;/strong&gt; (which tracks cash flow and reconciliation) from the &lt;strong&gt;Resident Timeline&lt;/strong&gt; (which preserves chronological context) gives property teams a complete audit trail without cluttering financial reports.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Building "Ask Pulse": Read/Write Operations Inside WhatsApp
&lt;/h2&gt;

&lt;p&gt;One surprising discovery from talking to hostel and HMO managers was that most of them rarely sit in front of a laptop during the day. They inspect rooms, collect cash or bank transfers on-site, and answer resident messages on WhatsApp.&lt;/p&gt;

&lt;p&gt;Instead of forcing them to open a web dashboard for routine checks, we built &lt;strong&gt;Ask Pulse&lt;/strong&gt;, a conversational AI assistant inside WhatsApp that connects directly to their scoped tenant data via strict tool-calling:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Intent &amp;amp; Guardrail Layer:&lt;/strong&gt; Incoming WhatsApp messages are verified against the sender's registered phone number and role permissions (&lt;code&gt;Owner&lt;/code&gt;, &lt;code&gt;Manager&lt;/code&gt;, &lt;code&gt;Staff&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scoped Read Tools:&lt;/strong&gt; Queries like &lt;em&gt;"Who still owes rent in Building B?"&lt;/em&gt; or &lt;em&gt;"How many beds are free this weekend?"&lt;/em&gt; map to parameterized, read-only database functions filtered strictly by &lt;code&gt;organization_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confirmed Write Actions:&lt;/strong&gt; Actions like &lt;em&gt;"Mark Ali's $450 rent as paid"&lt;/em&gt; or &lt;em&gt;"Send a payment reminder to overdue rooms"&lt;/em&gt; execute deterministic backend mutations—never raw SQL—and log an entry straight to the resident's timeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Payment Custody:&lt;/strong&gt; Because Ask Pulse is an operational assistant rather than a payment gateway, it records and reconciles transactions without ever touching or moving funds.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  4. Open Operational Standards for Scaling Landlords
&lt;/h2&gt;

&lt;p&gt;Software only works if the underlying operational workflow is consistent. Many operators start with paper clipboards before outgrowing spreadsheets at 10+ rooms. &lt;/p&gt;

&lt;p&gt;To help smaller landlords standardize their room turnovers, we also published a free, open-source &lt;a href="https://yourpulse-io.github.io/pulse-free-tools/" rel="noopener noreferrer"&gt;Resident Move-In &amp;amp; Room Turnover Checklist&lt;/a&gt; covering pre-arrival verification, meter readings, and deposit documentation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways for Vertical SaaS Builders
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model time, not just state:&lt;/strong&gt; Anywhere inventory is shared or time-bound, interval overlap queries save months of edge-case bug fixes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meet users where they already work:&lt;/strong&gt; For field-heavy industries like property operations, a well-scoped WhatsApp interface often drives higher daily retention than a complex mobile app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build small, useful micro-tools:&lt;/strong&gt; Standalone calculators and checklists solve immediate problems for your target audience while organically introducing them to your core platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building vertical SaaS or working on multi-tenant booking systems, I would love to hear how you handle time-bound inventory and audit logs in the comments!&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>saas</category>
      <category>softwaredevelopment</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
