Hous [demo]

React 19 • Bun • SQLite • Drizzle ORM • TypeScript

A local-first reservation and property management system engineered for independent commercial hospitality. Runs offline-first with an embedded SQLite database, handling guest intake, reservation lifecycles, and integrated hardware payment processing with zero external cloud dependencies.

Core Philosophy

Actual transactions dictate reality: The system does not enforce an arbitrary "record night rate" against payments. Nightly averages, room subtotals, and taxes are derived dynamically from immutable transaction records, eliminating discrepancies between point-of-sale terminals and back-office folios.

Architecture & Tech Stack

  • Frontend: React 19, TypeScript, TanStack Router, TanStack Query, Tailwind CSS v4, shadcn/ui.
  • Backend Runtime: Bun runtime with native TypeScript execution and low-memory HTTP/WebSocket servers.
  • Database & Storage: SQLite via bun:sqlite with Write-Ahead Logging (WAL) enabled and Drizzle ORM.
  • Document & PDF Engine: Nunjucks HTML templating paired with native Bun.WebView and Chrome DevTools Protocol + pdf-lib for in-process, low-memory PDF rasterization (zero Playwright overhead).
  • Security & Vault: Passkey-based authentication (WebAuthn + PRF). Sensitive secrets (Stripe keys, JWTs) are encrypted at rest in SQLite and decrypted in memory only upon administrative unlock; non-secret boot configuration is stored in hous-config.toml (no plaintext .env files).

Key Subsystems

Reservations & Operational Reports

  • State tracking across pending, confirmed, checked-in, checked-out, and canceled states.
  • Visual room availability matrix and reservation timeline calendar.
  • Guest-facing invoice generation with itemized folio charges, pre-authorizations, security deposits, and legal eviction terms.
  • Front-desk registration cards and automated daily/monthly accounting sheets with multi-page PDF compilation.

Guest Intake & Digital Signature Pad

  • WebSocket-driven signature pad optimized for iPad kiosks at front desks, capturing guest signatures directly onto digital invoices.
  • Low-latency document intake integrating network document scanners and zxing-wasm barcode/license decoding.
  • Dynamic terms QR codes and automatic 30-second session resets upon completion.

Guest-Centric Vehicle Engine

  • Supports attaching multiple vehicles per reservation using a dedicated junction table.
  • Smart Copy-on-Write Logic: Single-stay edits update the existing vehicle record in-place (typo correction), while updates to vehicles linked to historical stays automatically fork a new record, safeguarding audit trails.

Tax Breakdown Engine

  • Top-level lodging tax rates validated against granular component sub-rates (city, county, state).
  • Reporting models preserve mathematical fidelity while rendering transparent line-item tax distributions on guest folios and state reporting sheets.

Payment Audit & Stripe Webhooks

Integrated Stripe Terminal and Webhook architecture ensures resilience against connectivity interruptions:

  • Webhook Processing Pipeline: HTTP ingress verifies HMAC-SHA256 signatures via Vault secrets, pushes events to an in-memory queue with automatic retry policies, and executes atomic ledger state mutations.
  • The 3 Automatic Audit Checks:
    • Refund Allocation Needed: Resolves partial refund distributions when multiple line items exist on a single Stripe intent.
    • Amount Mismatch: Flags any variance between captured Stripe amounts and local SQLite folio records.
    • Unretained Deposit Held: Guarantees captured security deposits are never orphaned—enforcing explicit retention (damage fees) or timely release to the guest.
  • 3-Part Reconciliation Strategy:
    • Daily Sheet Trigger: Batch-syncs active same-day intents prior to compiling daily operational sheets.
    • Monthly Sheet Trigger: Reconciles all transactions across the billing cycle before finalizing monthly tax filings.
    • Weekly 90-Day Background Cron: Executes every Sunday at 3:00 AM (Bun.cron('0 3 * * 0')) to sweep dispute and chargeback windows.