# ahtesham-clcbws/laravel-schema-sentinel architecture

> Architecture diagram of the GitHub repository ahtesham-clcbws/laravel-schema-sentinel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahtesham-clcbws/laravel-schema-sentinel
- Repository: https://github.com/ahtesham-clcbws/laravel-schema-sentinel

## Overview

Laravel Schema Sentinel is a Laravel package for schema integrity and database governance. Its main workflow compares a live database schema with an ideal schema produced by shadow-migration simulation or loaded from a snapshot, reports drift, and can generate a corrective migration. Separate capabilities cover index standardization, cross-environment data drift, legacy-schema reverse engineering, migration linting, environment checks, and a Livewire health dashboard. Several command and support implementations were not excerpted, so those capability links rely on README documentation; unsampled internal call paths are not asserted.

Main entry points: [`src/Console/Commands`](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/Console/Commands) (Artisan commands), [`src/Console/Commands/DriftCommand.php`](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DriftCommand.php) (Drift audit), [`src/Sentinel.php`](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Sentinel.php) (Sentinel API), [`src/DTOs`](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/DTOs) (Schema and diff DTOs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_artisan["Artisan commands"]
  node_api["Sentinel API<br/>[Sentinel.php]"]
  node_facade["Sentinel facade<br/>[Sentinel.php]"]
  node_health["Health dashboard<br/>[DatabaseHealth.php]"]
  node_healthview["Dashboard view"]
end

subgraph group_audit["Schema auditing"]
  node_driftcmd["Drift audit<br/>[DriftCommand.php]"]
  node_shadow["Shadow migration simulation"]
  node_snapshots["Schema snapshots"]
  node_parser["Schema parser<br/>[SchemaParser.php]"]
  node_diff["Drift comparison<br/>[DiffEngine.php]"]
  node_migrationgen["Fix migration generator"]
end

subgraph group_model["Schema model"]
  node_dtos["Schema and diff DTOs"]
end

subgraph group_governance["Governance tools"]
  node_indexes["Index standardization"]
  node_datadrift["Data drift audit"]
  node_lint["Migration linter<br/>[LintCommand.php]"]
  node_doctor["Environment doctor<br/>[DoctorCommand.php]"]
  node_notifications["Drift notifications"]
end

subgraph group_reverse["Reverse engineering"]
  node_reversecmd["Reverse command<br/>[ReverseCommand.php]"]
  node_reverse["Schema reverse engineer"]
end

node_operator(("Laravel operator"))

node_operator -->|"runs commands"| node_artisan
node_operator -->|"calls API"| node_api
node_operator -->|"opens dashboard"| node_health
node_artisan -->|"dispatches drift"| node_driftcmd
node_driftcmd -->|"simulates migrations"| node_shadow
node_driftcmd -->|"loads snapshot"| node_snapshots
node_driftcmd -.->|"parses schemas"| node_parser
node_driftcmd -->|"compares schemas"| node_diff
node_driftcmd -->|"generates fix"| node_migrationgen
node_driftcmd -.->|"sends alerts"| node_notifications
node_parser -->|"builds definitions"| node_dtos
node_diff -->|"returns diff"| node_dtos
node_migrationgen -->|"uses diff"| node_dtos
node_api -.->|"runs simulation"| node_shadow
node_api -.->|"parses schema"| node_parser
node_api -.->|"checks drift"| node_diff
node_api -.->|"starts reversing"| node_reverse
node_facade -->|"resolves API"| node_api
node_health -->|"checks drift"| node_facade
node_health -->|"renders view"| node_healthview
node_artisan -->|"dispatches indexes"| node_indexes
node_artisan -->|"dispatches data audit"| node_datadrift
node_artisan -->|"dispatches lint"| node_lint
node_artisan -->|"dispatches doctor"| node_doctor
node_artisan -->|"dispatches reverse"| node_reversecmd
node_reversecmd -.->|"requests generation"| node_reverse
node_reverse -->|"reads table definitions"| node_dtos
node_datadrift -->|"reports comparison"| node_operator
node_lint -->|"reports findings"| node_operator
node_doctor -->|"reports health"| node_operator
node_indexes -->|"reports indexes"| node_operator

click node_artisan "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/Console/Commands"
click node_api "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Sentinel.php"
click node_facade "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Facades/Sentinel.php"
click node_health "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Support/Livewire/DatabaseHealth.php"
click node_healthview "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/resources/views/livewire/database-health.blade.php"
click node_driftcmd "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DriftCommand.php"
click node_shadow "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/ShadowMigrationRunner.php"
click node_snapshots "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/SnapshotManager.php"
click node_parser "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/SchemaParser.php"
click node_diff "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/DiffEngine.php"
click node_migrationgen "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/MigrationGenerator.php"
click node_dtos "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/DTOs"
click node_indexes "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/StandardizeIndexesCommand.php"
click node_datadrift "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DataDriftCommand.php"
click node_lint "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/LintCommand.php"
click node_doctor "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DoctorCommand.php"
click node_reversecmd "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/ReverseCommand.php"
click node_reverse "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/ReverseEngineer.php"
click node_notifications "https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Support/NotificationManager.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_artisan,node_api,node_facade,node_health,node_healthview toneBlue
class node_driftcmd,node_shadow,node_snapshots,node_parser,node_diff,node_migrationgen toneAmber
class node_dtos toneMint
class node_indexes,node_datadrift,node_lint,node_doctor,node_notifications toneRose
class node_reversecmd,node_reverse,node_operator toneIndigo
```

## Components

### User interfaces

- [Artisan commands](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/Console/Commands): `src/Console/Commands`
- [Sentinel API](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Sentinel.php): `src/Sentinel.php`
- [Sentinel facade](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Facades/Sentinel.php): `src/Facades/Sentinel.php`
- [Health dashboard](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Support/Livewire/DatabaseHealth.php): `src/Support/Livewire/DatabaseHealth.php`
- [Dashboard view](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/resources/views/livewire/database-health.blade.php): `resources/views/livewire/database-health.blade.php`

### Schema auditing

- [Drift audit](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DriftCommand.php): `src/Console/Commands/DriftCommand.php`
- [Shadow migration simulation](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/ShadowMigrationRunner.php): `src/Core/ShadowMigrationRunner.php`
- [Schema snapshots](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/SnapshotManager.php): `src/Core/SnapshotManager.php`
- [Schema parser](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/SchemaParser.php): `src/Core/SchemaParser.php`
- [Drift comparison](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/DiffEngine.php): `src/Core/DiffEngine.php`
- [Fix migration generator](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/MigrationGenerator.php): `src/Core/MigrationGenerator.php`

### Schema model

- [Schema and diff DTOs](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/tree/main/src/DTOs): `src/DTOs`

### Governance tools

- [Index standardization](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/StandardizeIndexesCommand.php): `src/Console/Commands/StandardizeIndexesCommand.php`
- [Data drift audit](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DataDriftCommand.php): `src/Console/Commands/DataDriftCommand.php`
- [Migration linter](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/LintCommand.php): `src/Console/Commands/LintCommand.php`
- [Environment doctor](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/DoctorCommand.php): `src/Console/Commands/DoctorCommand.php`
- [Drift notifications](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Support/NotificationManager.php): `src/Support/NotificationManager.php`

### Reverse engineering

- [Reverse command](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Console/Commands/ReverseCommand.php): `src/Console/Commands/ReverseCommand.php`
- [Schema reverse engineer](https://github.com/ahtesham-clcbws/laravel-schema-sentinel/blob/main/src/Core/ReverseEngineer.php): `src/Core/ReverseEngineer.php`

### Other components

- **Laravel operator**

## Connections

- Laravel operator → Artisan commands: runs commands (evidence: `README.md`)
- Laravel operator → Sentinel API: calls API (evidence: `README.md`)
- Laravel operator → Health dashboard: opens dashboard (evidence: `README.md`)
- Artisan commands → Drift audit: dispatches drift (evidence: `src/SentinelServiceProvider.php`)
- Drift audit → Shadow migration simulation: simulates migrations (evidence: `src/Console/Commands/DriftCommand.php`)
- Drift audit → Schema snapshots: loads snapshot (evidence: `src/Console/Commands/DriftCommand.php`)
- Drift audit → Schema parser: parses schemas (evidence: `src/Console/Commands/DriftCommand.php`)
- Drift audit → Drift comparison: compares schemas (evidence: `src/Console/Commands/DriftCommand.php`)
- Drift audit → Fix migration generator: generates fix (evidence: `src/Console/Commands/DriftCommand.php`)
- Drift audit → Drift notifications: sends alerts (evidence: `src/Console/Commands/DriftCommand.php`)
- Schema parser → Schema and diff DTOs: builds definitions (evidence: `src/Core/SchemaParser.php`)
- Drift comparison → Schema and diff DTOs: returns diff (evidence: `src/Core/DiffEngine.php`)
- Fix migration generator → Schema and diff DTOs: uses diff (evidence: `src/Core/MigrationGenerator.php`)
- Sentinel API → Shadow migration simulation: runs simulation (evidence: `src/Sentinel.php`)
- Sentinel API → Schema parser: parses schema (evidence: `src/Sentinel.php`)
- Sentinel API → Drift comparison: checks drift (evidence: `src/Sentinel.php`)
- Sentinel API → Schema reverse engineer: starts reversing (evidence: `src/Sentinel.php`)
- Sentinel facade → Sentinel API: resolves API (evidence: `src/Facades/Sentinel.php`)
- Health dashboard → Sentinel facade: checks drift (evidence: `src/Support/Livewire/DatabaseHealth.php`)
- Health dashboard → Dashboard view: renders view (evidence: `src/Support/Livewire/DatabaseHealth.php`)
- Artisan commands → Index standardization: dispatches indexes (evidence: `src/SentinelServiceProvider.php`)
- Artisan commands → Data drift audit: dispatches data audit (evidence: `src/SentinelServiceProvider.php`)
- Artisan commands → Migration linter: dispatches lint (evidence: `src/SentinelServiceProvider.php`)
- Artisan commands → Environment doctor: dispatches doctor (evidence: `src/SentinelServiceProvider.php`)
- Artisan commands → Reverse command: dispatches reverse (evidence: `src/SentinelServiceProvider.php`)
- Reverse command → Schema reverse engineer: requests generation
- Schema reverse engineer → Schema and diff DTOs: reads table definitions (evidence: `src/Core/ReverseEngineer.php`)
- Data drift audit → Laravel operator: reports comparison (evidence: `README.md`)
- Migration linter → Laravel operator: reports findings (evidence: `README.md`)
- Environment doctor → Laravel operator: reports health (evidence: `README.md`)
- Index standardization → Laravel operator: reports indexes (evidence: `README.md`)
