๐ Technical Overview
This section is for developers who want to understand Monitron SaaS's internals, extend it, or contribute.
๐๏ธ Tech Stackโ
| Component | Technology |
|---|---|
| Framework | Laravel 12 |
| Admin Panel | Filament 3 (TALL Stack) |
| PHP Version | 8.2+ |
| Frontend | Livewire 3 + Alpine.js + Tailwind CSS |
| Database | MySQL 8+, PostgreSQL 13+, or SQLite |
| Queue | Laravel Queue (database, Redis, or SQS) |
| Scheduler | Laravel Console Scheduler |
๐ Directory Structureโ
app/
โโโ Console/Commands/ # Artisan commands (AI reports, predictions)
โโโ DTOs/ # Data Transfer Objects
โ โโโ MonitorCheckResult.php # Check result DTO
โโโ Enums/ # PHP 8.1 enums
โ โโโ CheckInterval.php # 10s to 1h intervals
โ โโโ IncidentSeverity.php # Info, Warning, Critical, Emergency
โ โโโ IncidentStatus.php # Investigating โ Resolved
โ โโโ MonitorStatus.php # Up, Down, Degraded, Paused, Pending, Maintenance
โ โโโ MonitorType.php # 24 monitor types
โ โโโ NotificationChannel.php # 19 channels
โโโ Filament/ # Filament admin panel
โ โโโ Pages/ # Settings, AI Settings, AI Assistant
โ โโโ Resources/ # Monitor, Incident, Contact, StatusPage, NotificationLog
โ โโโ Widgets/ # Dashboard widgets
โโโ Http/
โ โโโ Controllers/
โ โ โโโ Api/V1/ # Heartbeat + Agent API controllers
โ โ โโโ Install/ # Installation wizard
โ โ โโโ StatusPage/ # Public status pages
โ โโโ Middleware/ # Installation guard middleware
โโโ Jobs/ # Queue jobs
โ โโโ ProcessMonitorCheck.php # Core check processor
โ โโโ SendAlertNotifications.php # Notification dispatcher
โโโ Models/ # 20 Eloquent models
โโโ Monitors/ # Monitor handler implementations
โ โโโ Contracts/MonitorHandler.php # Handler interface
โ โโโ HttpMonitor.php
โ โโโ PingMonitor.php
โ โโโ TcpMonitor.php
โ โโโ ... (8 handlers)
โโโ Providers/ # Service providers
โ โโโ MonitorServiceProvider.php # Registers all services
โโโ Services/ # Business logic
โโโ AI/ # 11 AI services
โโโ MonitorRegistry.php # Handler registry
โโโ NotificationDispatcher.php # 19 channel implementations
๐ง Key Design Patternsโ
1. Handler Pattern (Monitors)โ
Each monitor type has a handler implementing MonitorHandler:
interface MonitorHandler {
public function check(Monitor $monitor): MonitorCheckResult;
public function type(): MonitorType;
}
The MonitorRegistry maps type strings to handler classes.
2. Service Pattern (Notifications)โ
NotificationDispatcher contains methods for each of the 19 channels, dispatched via the SendAlertNotifications job.
3. Provider-Agnostic AIโ
AiService abstracts four AI providers behind a single chat() / json() interface. Feature services (RootCauseAnalyzer, etc.) use AiService without knowing which provider is configured.
4. Multi-Tenancy via team_idโ
All resource models are scoped by team_id. Filament resources filter by the current user's team.
๐ Check Processing Flowโ
Scheduler (every 10s)
โ
โผ
For each active monitor โ shouldCheck()?
โ
Yes โ ProcessMonitorCheck::dispatch()
โ
โผ (Queue Worker)
MonitorRegistry::resolve(type)
โ
โผ
Handler::check(monitor) โ MonitorCheckResult
โ
โผ
Store check, update monitor status
โ
โผ
Status transition? (UPโDOWN or DOWNโUP)
โ
โผ
Create/resolve Incident โ SendAlertNotifications::dispatch()
โ
โผ
NotificationDispatcher โ each channel