# inferna15/personel-bilgi-sistemi architecture

> Architecture diagram of the GitHub repository inferna15/personel-bilgi-sistemi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inferna15/personel-bilgi-sistemi
- Repository: https://github.com/inferna15/personel-bilgi-sistemi

## Overview

##### Project Type and Purpose
- This is a full-stack web application built on the Laravel PHP framework, using Inertia.js and Vue.js for the frontend.
- Purpose: an internal staff and management portal for handling announcements, units, cars, cards, leave requests, salaries, and user management with role-based access control.

##### Core Architectural Layers
a. Client Layer (Browser)
- Vue.js SPA (resources/js/) built with Vite and Tailwind CSS.
- Uses Inertia.js to bridge Laravel controllers and Vue pages.

b. Web Server / Entry Point
- Apache/Nginx serves public/index.php.
- Laravel’s HTTP kernel handles routing (routes/web.php, routes/auth.php).

c. Application Layer (Laravel MVC + Services)
- Controllers
- Auth controllers (app/Http/Controllers/Auth)
- Management controllers (app/Http/Controllers/Management)
- Staff controllers (app/Http/Controllers/Staff)
- Middleware
- HandleInertiaRequests, ChechAdminRoleMiddleware
- Requests (Validation) – app/Http/Requests
- Resources (Transformers) – app/Http/Resources
- Services (Business logic) – app/Services
- Policies (Authorization) – app/Policies

d. Domain / Data Layer
- Eloquent Models (app/Models) with Enums (app/Enum)
- Database (MySQL/PostgreSQL)
- Migrations & Seeders (database/migrations, database/seeders)
- Factories (database/factories) for testing

e. Infrastructure & Support Services
- Cache, Session, Queue (config/queue.php, config/cache.php)
- Mail (config/mail.php)
- File Storage (config/filesystems.php)
- External services: SMTP server, storage (S3 or local)
- Background jobs (Queue workers)
- Logging (storage/logs)

##### Interactions and Data Flow
1. User → Browser → Vue Components
2. Browser issues HTTP requests → Web Server → public/index.php
3. Laravel Router matches route → Middleware → Controller
4. Controller may:
- Validate via FormRequest
- Authorize via Policy
- Delegate business logic to Service
- Interact with Model (Eloquent) → Database
- Dispatch Events/Jobs → Queue
- Return Inertia response → Vue Page
5. Frontend re-renders or redirects based on response
6. Background jobs → Mail, Notifications, Cache, External APIs

##### Architectural Patterns & Design Principles
- MVC (Controller → View/Resource → Model)
- Service Layer for business logic separation (app/Services)
- FormRequest for single-purpose validation
- Policy pattern for authorization
- Inertia.js for seamless SPA behavior without a separate API
- Eloquent ORM for database abstraction
- Migration & Seeding for reproducible schema

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer" 
        direction TB
        Browser["Browser (Vue.js SPA)"]:::frontend
        Browser -->|"HTTP (Inertia.js)"| WebServer
    end
    click Browser "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/resources/js/"

    %% Web Server / Entry Point
    subgraph "Web Server / Entry Point"
        direction TB
        WebServer["public/index.php\nApache/Nginx"]:::backend
        Router["Laravel HTTP Kernel\nroutes/web.php, auth.php"]:::backend
    end
    WebServer -->|"Bootstrap"| Router
    click WebServer "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/public/index.php"
    click Router "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/routes/web.php"
    click Router "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/routes/auth.php"

    %% Application Layer
    subgraph "Application Layer" 
        direction TB
        MiddlewareInertia["HandleInertiaRequests Middleware"]:::backend
        MiddlewareAdmin["ChechAdminRoleMiddleware"]:::backend
        Controllers["Controllers"]:::backend
        subgraph "Controllers"
            direction TB
            AuthController["Auth Controllers"]:::backend
            MgmtController["Management Controllers"]:::backend
            StaffController["Staff Controllers"]:::backend
        end
        Requests["Form Requests"]:::backend
        Policies["Authorization Policies"]:::backend
        Services["Service Layer"]:::backend
        Resources["API/Response Transformers"]:::backend
    end

    Router -->|"runs through"| MiddlewareInertia
    Router -->|"runs through"| MiddlewareAdmin
    MiddlewareInertia --> Controllers
    MiddlewareAdmin --> Controllers

    Controllers -->|"validate"| Requests
    Controllers -->|"authorize"| Policies
    Controllers -->|"delegate"| Services
    Controllers -->|"transform"| Resources

    click MiddlewareInertia "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/app/Http/Middleware/HandleInertiaRequests.php"
    click MiddlewareAdmin "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/app/Http/Middleware/ChechAdminRoleMiddleware.php"
    click AuthController "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Controllers/Auth/"
    click MgmtController "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Controllers/Management/"
    click StaffController "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Controllers/Staff/"
    click Requests "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Requests/"
    click Policies "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Policies/"
    click Services "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Services/"
    click Resources "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Http/Resources/"

    %% Domain / Data Layer
    subgraph "Domain / Data Layer"
        direction TB
        Models["Eloquent Models"]:::datastore
        Enums["Domain Enums"]:::datastore
        Migrations["Database Migrations"]:::datastore
        Seeders["Database Seeders"]:::datastore
        Factories["Model Factories"]:::datastore
        DB["MySQL/PostgreSQL Database"]:::datastore
    end

    Services --> Models
    Models --> DB
    Migrations --> DB
    Seeders --> DB
    Factories --> Models

    click Models "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Models/"
    click Enums "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/app/Enum/"
    click Migrations "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/database/migrations/"
    click Seeders "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/database/seeders/"
    click Factories "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/database/factories/"

    %% Infrastructure & External Services
    subgraph "Infrastructure & External Services"
        direction TB
        Cache["Cache & Session"]:::external
        Queue["Queue (config/queue.php)"]:::external
        Mail["Mail Service"]:::external
        Files["File Storage"]:::external
        Storage["Storage (public & logs)"]:::external
        Bootstrap["Application Bootstrap"]:::backend
        SMTP["External SMTP Server"]:::external
        S3["External S3 Storage"]:::external
        Workers["Queue Workers"]:::external
    end

    click Cache "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/config/cache.php"
    click Queue "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/config/queue.php"
    click Mail "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/config/mail.php"
    click Files "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/config/filesystems.php"
    click Storage "https://github.com/inferna15/personel-bilgi-sistemi/tree/master/storage/app/public/"
    click Bootstrap "https://github.com/inferna15/personel-bilgi-sistemi/blob/master/bootstrap/app.php"

    Services -->|"dispatch events/jobs"| Queue
    Queue --> Workers
    Workers --> Mail
    Workers --> S3
    Services -->|"use"| Cache
    Controllers -->|"use"| Files
    Controllers -->|"use"| Session
    Services -->|"log to"| Storage

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,color:#1B2631;
    classDef backend fill:#ABEBC6,stroke:#196F3D,color:#0B5345;
    classDef datastore fill:#F9E79F,stroke:#B9770E,color:#7D6608;
    classDef external fill:#E8DAEF,stroke:#6C3483,color:#4A235A;
```
