How iraed/pm-os works
Purpose and Runtime
PM-OS is a Laravel 11 modular-monolith SaaS for property-management companies, covering property onboarding, leasing, resident management, billing, and maintenance. It uses Vue 3/Inertia for the authenticated UI and PostgreSQL tenant databases. Docker Compose provides the local runtime: Dockerfile, docker-compose.yml, docker/nginx/conf.d/default.conf.
Application Entry Points
HTTP starts at Laravel route layers: central/web routes in routes/web.php and tenant-scoped routes in routes/tenant.php. Module APIs are independently registered, e.g. app/Modules/Foundation/Routes/api.php, app/Modules/PropertyOnboarding/Routes/api.php, and app/Modules/Collection/Routes/api.php. The browser shell and Inertia client begin at resources/views/app.blade.php and resources/js/app.js.
Tenant Isolation and Bootstrap
The system is database-per-tenant, with central plan/tenant records in app/Core/MultiTenancy/Models/Plan.php and app/Core/MultiTenancy/Models/Tenant.php. Tenancy behavior is configured in config/tenancy.php; tenant schema is separated from central migrations in database/migrations/tenant/. app/Core/ModuleServiceProvider.php is the central integration point for modular application bootstrapping.
Foundation Domain
Foundation owns the portfolio graph and authorization boundary: users, owners, properties, and units. Its HTTP controllers validate requests, apply policy checks, and return resource representations around app/Modules/Foundation/Models/Property.php, app/Modules/Foundation/Http/Controllers/PropertyController.php, and app/Modules/Foundation/Policies/PropertyPolicy.php. Other operational modules attach their records to this property/unit base.
Guided Property Onboarding
Onboarding is a workflow layer over Foundation that creates a property, adds units, gathers documents, inspections, and risk information, and emits lifecycle events. Requests enter app/Modules/PropertyOnboarding/Http/Controllers/OnboardingController.php; orchestration belongs in app/Modules/PropertyOnboarding/Services/PropertyOnboardingService.php; completion is signaled through app/Modules/PropertyOnboarding/Events/PropertyOnboarded.php. This separates multi-step workflow control from core property persistence.
Operational Lifecycle Modules
Leasing records tenancy contracts in app/Modules/Leasing/Models/Lease.php; resident identity/lifecycle is represented by app/Modules/TenantManagement/Models/Resident.php. Financial collection centers on invoices, schedules, and payments at app/Modules/Collection/Models/Invoice.php, app/Modules/Collection/Models/PaymentSchedule.php, and app/Modules/Collection/Models/Payment.php. Maintenance tracks reactive and preventive work via app/Modules/Maintenance/Models/WorkOrder.php, app/Modules/Maintenance/Models/PmPlan.php, and app/Modules/Maintenance/Models/Inspection.php.
Automation and AI Boundary
Scheduled/background jobs drive cross-domain exceptions and recurring work: app/Jobs/Tenant/CheckLeaseExpirations.php, app/Jobs/Tenant/CheckOverdueInvoices.php, and app/Jobs/Tenant/TriggerPreventiveMaintenance.php. Redis/Horizon is the intended queue runtime. AI remains provider-abstracted: app/Modules/AIEngine/Contracts/AIProviderInterface.php isolates callers from OpenAI-specific behavior in app/Modules/AIEngine/Providers/OpenAIProvider.php, with reporting orchestration in app/Modules/AIEngine/Services/AIReportGenerator.php. External Saudi integrations (Ejar, ZATCA, Sadad) are stated as readiness targets, not represented by implementation paths here.
Main entry points: Property.php Property portfolio · CheckLeaseExpirations.php Tenant automation jobs · tenancy.php Tenancy configuration · PropertyController.php Property controller
Components 25
Runtime & UI
- Docker Compose · Runs Laravel, Nginx, and supporting services locally.
docker-compose.yml - Central web routes
routes/web.php - Tenant routes
routes/tenant.php - Inertia Vue client
resources/js/app.js - Blade app shell
resources/views/app.blade.php
Tenancy & Bootstrap
- Module service provider · Central integration point for modular application bootstrapping.
app/Core/ModuleServiceProvider.php - Tenancy configuration · Configures database-per-tenant behavior.
config/tenancy.php - Tenant & plans
app/Core/MultiTenancy/Models/Tenant.php - Tenant migrations
- Tenant PostgreSQL DBs
Domain Modules
- Foundation API routes
app/Modules/Foundation/Routes/api.php - Property controller · Validates requests and applies property authorization.
app/Modules/Foundation/Http/Controllers/PropertyController.php - Property policy
app/Modules/Foundation/Policies/PropertyPolicy.php - Property portfolio · Base property and unit graph for operational modules.
app/Modules/Foundation/Models/Property.php - Property onboarding · Creates properties and gathers units, documents, inspections, and risk data.
app/Modules/PropertyOnboarding/Services/PropertyOnboardingService.php - Property onboarded
app/Modules/PropertyOnboarding/Events/PropertyOnboarded.php - Leases
app/Modules/Leasing/Models/Lease.php - Residents
app/Modules/TenantManagement/Models/Resident.php - Billing & collection · Invoices, payment schedules, and payments.
app/Modules/Collection/Models/Invoice.php - Maintenance · Work orders, preventive plans, and inspections.
app/Modules/Maintenance/Models/WorkOrder.php
Automation & AI
- Tenant automation jobs · Checks lease expirations, overdue invoices, and preventive maintenance.
app/Jobs/Tenant/CheckLeaseExpirations.php - Redis / Horizon
- AI report generator
app/Modules/AIEngine/Services/AIReportGenerator.php - AI provider contract
app/Modules/AIEngine/Contracts/AIProviderInterface.php - OpenAI provider
app/Modules/AIEngine/Providers/OpenAIProvider.php
Connections 25
- Docker Compose → Central web routes: serves
- Central web routes → Blade app shell: renders
- Blade app shell → Inertia Vue client: boots
- Inertia Vue client → Tenant routes: requests
- Module service provider → Foundation API routes: registers
- Module service provider → Tenancy configuration: boots with
- Tenancy configuration → Tenant & plans: resolves
- Tenancy configuration → Tenant PostgreSQL DBs: selects
- Tenant migrations → Tenant PostgreSQL DBs: provisions
- Foundation API routes → Property controller: dispatches
- Property controller → Property policy: authorizes via
- Property controller → Property portfolio: manages
- Tenant routes → Property onboarding: starts workflow
- Property onboarding → Property portfolio: creates
- Property onboarding → Property onboarded: emits
- Property portfolio → Leases: anchors
- Property portfolio → Residents: scopes
- Property portfolio → Billing & collection: scopes
- Property portfolio → Maintenance: scopes
- Tenant automation jobs → Redis / Horizon: runs on
- Tenant automation jobs → Leases: checks expirations
- Tenant automation jobs → Billing & collection: checks overdue invoices
- Tenant automation jobs → Maintenance: triggers preventive work
- AI report generator → AI provider contract: uses
- AI provider contract → OpenAI provider: implemented by