# keikey/audit architecture

> Architecture diagram of the GitHub repository keikey/audit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keikey/audit
- Repository: https://github.com/keikey/audit

## Overview

Audit is a Laravel API for user authentication and role assignment, user lookup, and inspection-listing management. The main workflow is an API request routed to a controller, validated, handled through listing services and Eloquent models, then serialized as a JSON response; listing assignment changes also trigger user notifications. The README additionally documents Swagger API documentation and deployment options, but those are not runtime domain stages. Route declarations and several subsystems were not sampled, so their internal wiring is shown only where supported by the tree or sampled source.

Main entry points: [`src/app/Http/Controllers/Api/PassportAuthController.php`](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/PassportAuthController.php) (Auth API), [`src/app/Http/Controllers/Api/V1/ListingController.php`](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/ListingController.php) (Listing API), [`src/routes/api.php`](https://github.com/keikey/audit/blob/master/src/routes/api.php) (API routes), [`src/app/Http/Controllers/Api/V1/UserController.php`](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/UserController.php) (User API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_entry["HTTP entry<br/>[index.php]"]
  node_kernel["HTTP kernel<br/>[Kernel.php]"]
  node_route_provider["Route provider"]
  node_api_routes["API routes<br/>[api.php]"]
  node_response["JSON response<br/>[BaseController.php]"]
end

subgraph group_identity["Identity"]
  node_user_controller["User API<br/>[UserController.php]"]
  node_auth_controller["Auth API"]
  node_login_request["Login validation<br/>[LoginRequest.php]"]
  node_register_request["Registration validation"]
  node_user_resource["User response<br/>[UserResource.php]"]
  node_passport["Passport tokens<br/>[composer.json]"]
end

subgraph group_listings["Listings"]
  node_listing_controller["Listing API"]
  node_listing_requests["Listing validation"]
  node_update_request["Update validation"]
  node_listing_service["Listing service<br/>[ListingService.php]"]
  node_listing_resource["Listing response"]
  node_notifications["Listing notifications"]
end

subgraph group_persistence["Persistence"]
  node_listing_model["Listing model<br/>[Listing.php]"]
  node_user_model["User model<br/>[User.php]"]
  node_database[("MySQL database<br/>[database.php]")]
end

node_caller(("API client"))

node_caller -->|"sends request"| node_entry
node_entry -->|"handles request"| node_kernel
node_kernel -->|"boots routing"| node_route_provider
node_route_provider -->|"loads routes"| node_api_routes
node_api_routes -->|"dispatches"| node_listing_controller
node_api_routes -->|"dispatches"| node_user_controller
node_api_routes -->|"dispatches"| node_auth_controller
node_listing_controller -->|"validates create"| node_listing_requests
node_listing_controller -->|"validates update"| node_update_request
node_listing_controller -->|"calls service"| node_listing_service
node_listing_controller -->|"queries listings"| node_listing_model
node_listing_controller -->|"serializes listings"| node_listing_resource
node_listing_service -->|"creates and updates"| node_listing_model
node_listing_service -->|"looks up inspector"| node_user_model
node_listing_service -->|"dispatches notices"| node_notifications
node_user_controller -->|"queries users"| node_user_model
node_user_controller -->|"serializes users"| node_user_resource
node_auth_controller -->|"validates login"| node_login_request
node_auth_controller -->|"validates registration"| node_register_request
node_auth_controller -->|"creates user"| node_user_model
node_auth_controller -->|"serializes user"| node_user_resource
node_auth_controller -->|"creates access token"| node_passport
node_listing_model -->|"reads and writes"| node_database
node_user_model -->|"reads and writes"| node_database
node_listing_controller -->|"builds response"| node_response
node_user_controller -->|"builds response"| node_response
node_auth_controller -->|"builds response"| node_response
node_response -->|"returns JSON"| node_caller

click node_entry "https://github.com/keikey/audit/blob/master/src/public/index.php"
click node_kernel "https://github.com/keikey/audit/blob/master/src/app/Http/Kernel.php"
click node_route_provider "https://github.com/keikey/audit/blob/master/src/app/Providers/RouteServiceProvider.php"
click node_api_routes "https://github.com/keikey/audit/blob/master/src/routes/api.php"
click node_listing_controller "https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/ListingController.php"
click node_user_controller "https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/UserController.php"
click node_auth_controller "https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/PassportAuthController.php"
click node_listing_requests "https://github.com/keikey/audit/blob/master/src/app/Http/Requests/CreateListingRequest.php"
click node_update_request "https://github.com/keikey/audit/blob/master/src/app/Http/Requests/UpdateListingRequest.php"
click node_login_request "https://github.com/keikey/audit/blob/master/src/app/Http/Requests/LoginRequest.php"
click node_register_request "https://github.com/keikey/audit/blob/master/src/app/Http/Requests/RegisterRequest.php"
click node_listing_service "https://github.com/keikey/audit/blob/master/src/app/Services/ListingService.php"
click node_listing_resource "https://github.com/keikey/audit/blob/master/src/app/Http/Resources/ListingResource.php"
click node_user_resource "https://github.com/keikey/audit/blob/master/src/app/Http/Resources/UserResource.php"
click node_listing_model "https://github.com/keikey/audit/blob/master/src/app/Models/Listing/Listing.php"
click node_user_model "https://github.com/keikey/audit/blob/master/src/app/Models/User/User.php"
click node_database "https://github.com/keikey/audit/blob/master/src/config/database.php"
click node_notifications "https://github.com/keikey/audit/blob/master/src/app/Notifications/ListingAssigned.php"
click node_passport "https://github.com/keikey/audit/blob/master/src/composer.json"
click node_response "https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/BaseController.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_entry,node_kernel,node_route_provider,node_api_routes,node_response,node_caller toneBlue
class node_user_controller,node_auth_controller,node_login_request,node_register_request,node_user_resource,node_passport toneAmber
class node_listing_controller,node_listing_requests,node_update_request,node_listing_service,node_listing_resource,node_notifications toneMint
class node_listing_model,node_user_model,node_database toneRose
```

## Components

### HTTP API

- [HTTP entry](https://github.com/keikey/audit/blob/master/src/public/index.php): `src/public/index.php`
- [HTTP kernel](https://github.com/keikey/audit/blob/master/src/app/Http/Kernel.php): `src/app/Http/Kernel.php`
- [Route provider](https://github.com/keikey/audit/blob/master/src/app/Providers/RouteServiceProvider.php): `src/app/Providers/RouteServiceProvider.php`
- [API routes](https://github.com/keikey/audit/blob/master/src/routes/api.php): `src/routes/api.php`
- [JSON response](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/BaseController.php): `src/app/Http/Controllers/Api/V1/BaseController.php`

### Identity

- [User API](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/UserController.php): `src/app/Http/Controllers/Api/V1/UserController.php`
- [Auth API](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/PassportAuthController.php): `src/app/Http/Controllers/Api/PassportAuthController.php`
- [Login validation](https://github.com/keikey/audit/blob/master/src/app/Http/Requests/LoginRequest.php): `src/app/Http/Requests/LoginRequest.php`
- [Registration validation](https://github.com/keikey/audit/blob/master/src/app/Http/Requests/RegisterRequest.php): `src/app/Http/Requests/RegisterRequest.php`
- [User response](https://github.com/keikey/audit/blob/master/src/app/Http/Resources/UserResource.php): `src/app/Http/Resources/UserResource.php`
- [Passport tokens](https://github.com/keikey/audit/blob/master/src/composer.json): `src/composer.json`

### Listings

- [Listing API](https://github.com/keikey/audit/blob/master/src/app/Http/Controllers/Api/V1/ListingController.php): `src/app/Http/Controllers/Api/V1/ListingController.php`
- [Listing validation](https://github.com/keikey/audit/blob/master/src/app/Http/Requests/CreateListingRequest.php): `src/app/Http/Requests/CreateListingRequest.php`
- [Update validation](https://github.com/keikey/audit/blob/master/src/app/Http/Requests/UpdateListingRequest.php): `src/app/Http/Requests/UpdateListingRequest.php`
- [Listing service](https://github.com/keikey/audit/blob/master/src/app/Services/ListingService.php): `src/app/Services/ListingService.php`
- [Listing response](https://github.com/keikey/audit/blob/master/src/app/Http/Resources/ListingResource.php): `src/app/Http/Resources/ListingResource.php`
- [Listing notifications](https://github.com/keikey/audit/blob/master/src/app/Notifications/ListingAssigned.php): `src/app/Notifications/ListingAssigned.php`

### Persistence

- [Listing model](https://github.com/keikey/audit/blob/master/src/app/Models/Listing/Listing.php): `src/app/Models/Listing/Listing.php`
- [User model](https://github.com/keikey/audit/blob/master/src/app/Models/User/User.php): `src/app/Models/User/User.php`
- [MySQL database](https://github.com/keikey/audit/blob/master/src/config/database.php): `src/config/database.php`

### Other components

- **API client**

## Connections

- API client → HTTP entry: sends request
- HTTP entry → HTTP kernel: handles request
- HTTP kernel → Route provider: boots routing
- Route provider → API routes: loads routes
- API routes → Listing API: dispatches
- API routes → User API: dispatches
- API routes → Auth API: dispatches
- Listing API → Listing validation: validates create
- Listing API → Update validation: validates update
- Listing API → Listing service: calls service
- Listing API → Listing model: queries listings
- Listing API → Listing response: serializes listings
- Listing service → Listing model: creates and updates
- Listing service → User model: looks up inspector
- Listing service → Listing notifications: dispatches notices
- User API → User model: queries users
- User API → User response: serializes users
- Auth API → Login validation: validates login
- Auth API → Registration validation: validates registration
- Auth API → User model: creates user
- Auth API → User response: serializes user
- Auth API → Passport tokens: creates access token
- Listing model → MySQL database: reads and writes
- User model → MySQL database: reads and writes
- Listing API → JSON response: builds response
- User API → JSON response: builds response
- Auth API → JSON response: builds response
- JSON response → API client: returns JSON
