# krystalmood/prestago architecture

> Architecture diagram of the GitHub repository krystalmood/prestago, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krystalmood/prestago
- Repository: https://github.com/krystalmood/prestago

## Overview

##### Project type and purpose
- This is PrestaGo, a full-stack Laravel web application for recording and managing student achievements.
- It supports three user roles (Admin, Dosen, Mahasiswa) with multi-role authentication, achievement management, competitions, dashboards, reports, and recommendations.

##### File structure
- Top-level “app” folder follows Laravel’s MVC—Controllers, Models, Middleware, Actions, Events, Listeners, Services.
- “routes” defines HTTP and API entrypoints.
- “resources/views” contains Blade templates organized by role (admin, Dosen, Mahasiswa) and shared components.
- “public” hosts index.php, static assets, and images.
- “config” and “bootstrap” for framework and environment configuration.
- “database” holds migrations, seeders, and factories—MySQL schema and test data.
- “docs/system-architecture.md” likely has reference details.
- Frontend assets built by Vite: CSS (Tailwind) and JS.

##### README for additional insights
- Tech stack: Laravel 10, PHP 8.1+, MySQL/MariaDB, Tailwind CSS, Laravel Sanctum.
- Features include event/listener flows (e.g., UserLoggedIn), Actions layer (LoginUserAction, RegisterUserAction), and Services (AuthService).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser(["Browser<br/>(Admin, Dosen, Mahasiswa)"]):::frontend
        Views(["Blade Templates"]):::frontend
        JSApp(["JS App"]):::frontend
        CSSApp(["CSS App"]):::frontend
        ViteConfig(["Vite Config"]):::frontend
    end

    %% Web Layer
    subgraph "Web Layer"
        direction TB
        Index(["public/index.php"]):::backend
        BootstrapApp(["bootstrap/app.php"]):::backend
        HTTKernel(["app/Http/Kernel.php"]):::backend
        WebRoutes(["routes/web.php"]):::backend
    end

    %% Auth & API Layer
    subgraph "Authentication & API Entrypoints"
        direction TB
        APIRoutes(["routes/api.php"]):::backend
        AuthController(["AuthController"]):::backend
        SanctumConfig(["Sanctum Config"]):::backend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        subgraph "Controllers"
            direction TB
            AdminControllers(["app/Http/Controllers/"]):::backend
            AchievementCtrl(["AchievementVerificationController"]):::backend
            CompetitionCtrl(["CompetitionController"]):::backend
            PeriodCtrl(["PeriodController"]):::backend
            RecommendationCtrl(["RecommendationController"]):::backend
            ReportCtrl(["ReportController"]):::backend
            StudyProgramCtrl(["StudyProgramController"]):::backend
            UserCtrl(["UserController"]):::backend
        end
        subgraph "Actions"
            direction TB
            LoginAction(["LoginUserAction"]):::backend
            RegisterAction(["RegisterUserAction"]):::backend
        end
        subgraph "Services"
            direction TB
            AuthService(["AuthService"]):::backend
        end
        subgraph "Events & Listeners"
            direction TB
            UserLoggedIn(["UserLoggedIn Event"]):::backend
            LogSuccessfulLogin(["LogSuccessfulLogin Listener"]):::backend
            UpdateLastLogin(["UpdateLastLoginTimestamp Listener"]):::backend
            EventServiceProvider(["EventServiceProvider"]):::backend
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Models(["app/Models"]):::persistence
        Database((Database)):::persistence
        Migrations(["database/migrations/"]):::persistence
        Seeders(["database/seeders/"]):::persistence
        Factories(["database/factories/"]):::persistence
        Storage((Storage)):::persistence
    end

    %% External Integration
    subgraph "External Services"
        direction TB
        MailConfig(["Mail Config"]):::external
        QueueConfig(["Queue Config"]):::external
    end

    %% Connections
    Browser -->|HTTP Request| Index
    Index --> BootstrapApp
    BootstrapApp --> HTTKernel
    HTTKernel --> WebRoutes
    HTTKernel --> APIRoutes
    WebRoutes --> AdminControllers
    APIRoutes --> AuthController
    AuthController --> LoginAction
    AuthController --> RegisterAction
    LoginAction --> AuthService
    RegisterAction --> AuthService
    AuthService --> Models
    Models --> Database
    AdminControllers -->|calls| LoginAction
    AdminControllers -->|calls| RegisterAction
    AdminControllers -->|uses| AchievementCtrl
    AdminControllers -->|uses| CompetitionCtrl
    AdminControllers -->|uses| PeriodCtrl
    AdminControllers -->|uses| RecommendationCtrl
    AdminControllers -->|uses| ReportCtrl
    AdminControllers -->|uses| StudyProgramCtrl
    AdminControllers -->|uses| UserCtrl
    AchievementCtrl --> AuthService
    CompetitionCtrl --> AuthService
    PeriodCtrl --> AuthService
    RecommendationCtrl --> AuthService
    ReportCtrl --> AuthService
    StudyProgramCtrl --> AuthService
    UserCtrl --> AuthService
    AdminControllers --> Views
    Views --> Browser
    AdminControllers --> Storage
    Storage --> Database
    AuthService -->|triggers| UserLoggedIn
    UserLoggedIn --> LogSuccessfulLogin
    UserLoggedIn --> UpdateLastLogin
    EventServiceProvider --> UserLoggedIn
    AuthController --> SanctumConfig
    APIRoutes --> SanctumConfig
    Database --> Migrations
    Database --> Seeders
    Database --> Factories
    AdminControllers -->|sends email| MailConfig
    QueueConfig -->|queues jobs| LogSuccessfulLogin

    %% Click Events
    click Views "https://github.com/krystalmood/prestago/tree/main/resources/views/"
    click JSApp "https://github.com/krystalmood/prestago/blob/main/resources/js/app.js"
    click CSSApp "https://github.com/krystalmood/prestago/blob/main/resources/css/app.css"
    click ViteConfig "https://github.com/krystalmood/prestago/blob/main/vite.config.js"
    click Index "https://github.com/krystalmood/prestago/blob/main/public/index.php"
    click BootstrapApp "https://github.com/krystalmood/prestago/blob/main/bootstrap/app.php"
    click HTTKernel "https://github.com/krystalmood/prestago/blob/main/app/Http/Kernel.php"
    click WebRoutes "https://github.com/krystalmood/prestago/blob/main/routes/web.php"
    click APIRoutes "https://github.com/krystalmood/prestago/blob/main/routes/api.php"
    click AuthController "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/AuthController.php"
    click SanctumConfig "https://github.com/krystalmood/prestago/blob/main/config/sanctum.php"
    click AdminControllers "https://github.com/krystalmood/prestago/tree/main/app/Http/Controllers/"
    click AchievementCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/AchievementVerificationController.php"
    click CompetitionCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/CompetitionController.php"
    click PeriodCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/PeriodController.php"
    click RecommendationCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/RecommendationController.php"
    click ReportCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/ReportController.php"
    click StudyProgramCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/StudyProgramController.php"
    click UserCtrl "https://github.com/krystalmood/prestago/blob/main/app/Http/Controllers/Admin/UserController.php"
    click LoginAction "https://github.com/krystalmood/prestago/blob/main/app/Actions/Auth/LoginUserAction.php"
    click RegisterAction "https://github.com/krystalmood/prestago/blob/main/app/Actions/Auth/RegisterUserAction.php"
    click AuthService "https://github.com/krystalmood/prestago/blob/main/app/Services/AuthService.php"
    click UserLoggedIn "https://github.com/krystalmood/prestago/blob/main/app/Events/UserLoggedIn.php"
    click LogSuccessfulLogin "https://github.com/krystalmood/prestago/blob/main/app/Listeners/LogSuccessfulLogin.php"
    click UpdateLastLogin "https://github.com/krystalmood/prestago/blob/main/app/Listeners/UpdateLastLoginTimestamp.php"
    click EventServiceProvider "https://github.com/krystalmood/prestago/blob/main/app/Providers/EventServiceProvider.php"
    click Models "https://github.com/krystalmood/prestago/tree/main/app/Models/"
    click Migrations "https://github.com/krystalmood/prestago/tree/main/database/migrations/"
    click Seeders "https://github.com/krystalmood/prestago/tree/main/database/seeders/"
    click Factories "https://github.com/krystalmood/prestago/tree/main/database/factories/"
    click Storage "https://github.com/krystalmood/prestago/tree/main/storage/app/public"
    click MailConfig "https://github.com/krystalmood/prestago/blob/main/config/mail.php"
    click QueueConfig "https://github.com/krystalmood/prestago/blob/main/config/queue.php"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#036,stroke-width:1px
    classDef backend fill:#C8F7C5,stroke:#2E7D32,stroke-width:1px
    classDef persistence fill:#FFD59E,stroke:#E65100,stroke-width:1px
    classDef external fill:#E1BEE7,stroke:#6A1B9A,stroke-width:1px
```
