HostQ System Documentation
Complete technical specifications for developers and system administrators.
1. Platform Overview
HostQ is a comprehensive, all-in-one property management SaaS designed specifically for the Kenyan short-stay and hospitality market. It streamlines operations for property owners, co-hosts, agents, and cleaning staff.
Core Capabilities:
- Multi-role Dashboards: Custom views for Super Admins, Hosts, Agents, and Staff.
- Channel Management: Centralized calendar that prevents double-bookings across Airbnb and direct bookings.
- M-Pesa Integration: Automated STK Push payment collection.
- Dynamic Reference Data: Super Admins can instantly add new Amenities, House Rules, and Locations without touching the code.
- Drag-and-Drop Ordering: All setup tables (Property Types, Amenities, etc.) support drag-and-drop reordering.
2. System Architecture
The platform uses a lightweight, highly optimized "Headless PHP + Vanilla JS" stack. This ensures blazing-fast load times on mobile devices, even on slower Kenyan 3G/4G networks.
3. User Roles (RBAC)
HostQ uses strict Role-Based Access Control. The system dynamically checks the user's role in the database and routes them to the appropriate dashboard.
| Role | System ID | Access Scope | Permissions |
|---|---|---|---|
| Super Admin | super_admin | Global Platform | Manage all users, setup reference data, view all financials. |
| Host (Owner) | host | Own Properties | Full CRUD on listings, bookings, expenses, and payouts. |
| Co-Host / Manager | manager | Assigned Properties | Manage bookings & guests. Blocked from financial payouts. |
| Agent | agent | Own Bookings | Create bookings, view own commissions. Blocked from expenses. |
| Cleaner / Staff | cleaner | Assigned Tasks | View and complete housekeeping tasks. No financial/guest access. |
4. API Engine
Instead of writing dozens of repetitive PHP files, HostQ uses a centralized dynamic API for reference data at /admin/api/setup/setup.php.
The API accepts a ?table= parameter. It dynamically builds the SQL query based on the JSON payload sent by the frontend.
| HTTP Method | Endpoint Example | Action Performed |
|---|---|---|
| GET | setup.php?table=amenities |
Fetches all amenities ordered by order_index. |
| POST | setup.php?table=house_rules |
Validates for duplicates and inserts a new record. |
| PUT | setup.php?table=checkin_times |
Updates a record (or handles drag-and-drop reordering). |
| DELETE | setup.php?table=property_types&id=5 |
Deletes a specific record by ID. |
Security Measures
- Table Whitelisting: The API rejects any
?table=request that isn't explicitly in the$allowed_tablesarray (prevents SQL injection via table names). - PDO Prepared Statements: All data inputs are bound safely to prevent SQL injection.
- Auto-Slugging: The API automatically generates URL-friendly slugs for new records.
5. Database Schema Overview
The platform relies on several core tables. Every reference table (except location hierarchy) shares the same structure:
Key Tables:
admin_users: Stores hashed credentials for super admins.property_types,room_types: Basic listing classifications.amenities: Features offered (grouped by category).house_rules,cancellation_policies: Host-defined terms.checkin_times: Time slots (must handle Name + Type uniqueness).counties,locations,centres: Hierarchical geographical data for Kenya.
6. Brand Color Palette
The HostQ UI avoids generic "tech blue" and instead uses a warm, premium color scheme that conveys trust and hospitality.
7. Core UI Components
HostQ uses a strict set of re-usable UI components across the platform to ensure consistency.
| Component | Description / Behavior |
|---|---|
| Custom Modals | All browser alert() and confirm() dialogs have been replaced with custom HTML/CSS modals. Errors fade in with a red/amber icon and a "Got it" button. |
| Drag & Drop Lists | Utilizing SortableJS. The drag handle is usually the fa-grip-vertical icon. On drop, an AJAX request is sent to save the order_index of the list. |
| Status Pills | Small badges used in tables to show state (Active = Green, Inactive = Red, Popular = Gold). |
| Icon Previews | When typing a FontAwesome class into an input, a live preview renders instantly next to the field. |