How the project works
A practical overview of the SaaS platform: tenancy, roles, modules, billing, accounting, and background automation.
Architecture
Request flow and tenancy
The platform supports a base public site and per-business tenant sites (subdomain/custom domain). Each request resolves the tenant (if any), then renders the correct theme and content.
Middleware runs first on all web requests:
ResolveTenantFromHost
1) base domain? → no tenant
2) subdomain match → Business.subdomain = {subdomain}
3) fallback host match → Business.subdomain = {full host}
TenantContext::setBusiness($business)
Files: app/Http/Middleware/ResolveTenantFromHost.php, app/Support/TenantContext.php.
Public pages use a theme resolver so each business can have its own look.
Theme::current()
- default: config('themes.default')
- per-tenant: TenantContext::business()->public_theme
- otherwise: system_options['theme']
Views live under resources/views/theme/{theme}/....
Roles & Billing
How access and subscriptions work
The app enforces role-based permissions and ensures a business has an active plan before accessing most operational screens.
Users belong to a business and have a role (e.g. agent, office admin, finance, manager, client). Tenants/landlords have portal-specific access.
Reference: ROLE_ACCESS.md.
If a business has no plan or its status is inactive/expired, users are redirected to select a plan or complete billing.
Middleware: subscription (business subscription checks).
Requests capture route/method/ip/user-agent/request-id which is used across audit logging and security traceability.
Middleware: CaptureAuditContext.
Modules
What the system does
This is the high-level workflow most teams follow.
Inventory setup, vacancy tracking, unit attributes, and public unit listings.
Tenant onboarding, lease lifecycle, renewals, and unit occupancy.
Monthly invoicing, receipts, allocations, credit balances, and statements.
Import bank/M-PESA statements and auto-match to tenants/invoices.
Double-entry ledger posting and core reports (TB, P&L, Balance Sheet, VAT).
Security incidents/occurrence logs with audit traceability.
Background automation runs recurring tasks like subscriptions, invoice generation, M-PESA settlement polling, reconciliation auto-match, and rent reminders.
Want to see it in action?
Create an account and explore the dashboard modules with your team roles.