# aprnna/vouki architecture

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

- Interactive diagram: https://gitdiagram.com/aprnna/vouki
- Repository: https://github.com/aprnna/vouki

## Overview

##### Project type and purpose
- This is a full-stack Laravel web application for managing events, categories, skills, volunteers and reviews.
- It exposes browser-facing views (Blade templates + compiled JS/CSS), a set of HTTP controllers implementing authentication, event CRUD, profile management, and uses Eloquent models to interact with a MySQL (or equivalent) database.
- It also integrates external services: Google OAuth for login, email for verification/notifications, and LeafletJS for map display.

##### File structure
- Top-level “app/Http/Controllers” contains MVC controllers grouped by feature (Auth, Event, Category, Profile, etc.).
- “app/Models” holds Eloquent models representing DB tables: User, Event, Category, Skill, Review, Questions, Answers, VolunteerEvent, UserDetail.
- “resources/views” contains Blade templates organized by feature: auth, events, profile, components, layouts.
- “resources/js” + “resources/css” + Vite: front-end asset pipeline.
- “database/migrations” + “factories” + “seeders”: DB schema, test data.
- “config” directory: store framework, database, mail, queue, filesystem, and leaflet setup.
- “routes/web.php” & “routes/auth.php”: HTTP endpoints.
- “public/index.php” is the front controller for all incoming HTTP.

##### README for additional insights
- Standard Laravel installation, build & serve instructions.

a. Main components
- Client (Browser/Mobile)
- Web Server (Apache/Nginx) → PHP-FPM → Laravel Application
- Route/Controller Layer
- Service/Domain Layer (optional services in Providers)
- Data Access Layer (Eloquent Models + Query Builder)
- MySQL/PostgreSQL Database
- Cache (Redis or file)
- Queue (Redis or database) for background jobs (email, notifications)
- Storage (Local disk or S3) for user uploads
- External Services:
- Google OAuth (Auth API)
- Mailgun/SMTP (Email)
- Leaflet tile servers (Map)
b. Relationships & interactions
- User → HTTP(S) request → Web Server → Laravel Router → Controller
- Controller → invokes FormRequest validation → calls Model/service → returns data → passes to Blade view → rendered HTML → response to user
- Controller → dispatches Jobs to Queue (e.g., send email)
- Queue Worker → picks up Job → interacts with Mail Service API or other external API
- Eloquent Model → reads/writes to DB via database connection
- Views → load compiled JS/CSS from public assets (Vite build manifest)
- resources/js/map.js → calls Leaflet external tile service
- Auth flow → Laravel Socialite/GoogleAuthController → directs user to Google → callback → fetches user info → stores token/session
c. Architectural patterns / design principles
- MVC: Controllers, Models, Views
- Layered architecture: HTTP → Controllers → Services → Models → Database
- Dependency injection via Service Providers
- Event-driven / asynchronous work via Laravel Queues
- Use of FormRequest for validation (Separation of concerns)
- Blade Components for reusable UI pieces
d. Key technologies, frameworks, libraries
- Laravel Framework (MVC, Eloquent ORM, Queue, Events)
- PHP-FPM / Apache or Nginx
- MySQL / PostgreSQL
- Redis (cache & queue back-end) or database queue
- Vite + Laravel Mix or NPM for asset bundling
- Blade templating + Alpine.js (if used)
- LeafletJS for maps
- Socialite for Google OAuth
- PHPUnit / Pest for testing

##### Essential architectural elements to capture
- MVC layers & folder mappings
- Asset pipeline & public directory
- DB & cache back-ends
- Queue system for background jobs
- External integrations (OAuth, Email, Maps)
- Storage linking (local/S3)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client"
        direction TB
        Browser["Browser"]:::client
    end

    %% Web Server Layer
    subgraph "Web Server"
        direction TB
        WebServer["Nginx/Apache + PHP-FPM"]:::compute
    end

    %% Laravel Application
    subgraph "Laravel Application"
        direction TB

        subgraph "HTTP Layer"
            direction TB
            WebRoutes["routes/web.php"]:::compute
            AuthRoutes["routes/auth.php"]:::compute
            HTTPControllers["HTTP Controllers"]:::compute
            FormRequests["Form Request Validation"]:::compute
        end

        subgraph "Domain & DI"
            direction TB
            ServiceProviders["Service Providers"]:::compute
            Policies["Policies"]:::compute
        end

        subgraph "Persistence Layer"
            direction TB
            EloquentModels["Eloquent Models"]:::compute
        end

        subgraph "Presentation & Assets"
            direction TB
            BladeViews["Blade Views"]:::compute
            BladeComponents["Blade Components"]:::compute
            AssetPipeline["Asset Pipeline"]:::compute
        end

        subgraph "Jobs & Events"
            direction TB
            QueueJobs["Queue & Jobs"]:::compute
        end
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        Database["MySQL/PostgreSQL"]:::datastore
        Cache["Redis (Cache & Queue)"]:::datastore
        StorageDisk["Storage (Local/S3)"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GoogleOAuth["Google OAuth"]:::external
        MailService["SMTP/Mailgun"]:::external
        LeafletTiles["LeafletJS Tile Service"]:::external
    end

    %% Deployment / Setup
    subgraph "Deployment & Setup"
        direction TB
        Migrations["Database Migrations"]:::config
        Seeders["Factories & Seeders"]:::config
        ConfigFiles["Configuration"]:::config
        FrontController["Public Front Controller & Assets"]:::compute
    end

    %% Testing
    subgraph "Testing"
        direction TB
        Tests["Testing Suite"]:::test
    end

    %% Map Integration & Notifications
    MapIntegration["Map Integration"]:::compute
    GoogleIntegration["Google OAuth Integration"]:::compute
    MailNotifications["Mail Notifications"]:::compute

    %% Connections
    Browser -->|"HTTP(S)"| WebServer
    WebServer -->|"forwards to"| WebRoutes
    WebServer --> AuthRoutes
    WebRoutes --> HTTPControllers
    AuthRoutes --> HTTPControllers
    HTTPControllers --> FormRequests
    FormRequests --> ServiceProviders
    HTTPControllers --> ServiceProviders
    ServiceProviders --> Policies
    Policies --> EloquentModels
    HTTPControllers --> EloquentModels
    EloquentModels --> Database
    HTTPControllers --> QueueJobs
    QueueJobs --> Cache
    QueueJobs --> MailService
    HTTPControllers --> StorageDisk
    AssetPipeline --> Browser
    BladeViews --> Browser
    BladeComponents --> BladeViews
    Browser -->|"JS load"| MapIntegration
    MapIntegration --> LeafletTiles
    GoogleIntegration --> GoogleOAuth
    HTTPControllers --> GoogleIntegration
    HTTPControllers --> MailNotifications
    MailNotifications --> MailService
    Migrations --> Database
    Seeders --> Database
    ConfigFiles --> WebServer
    ConfigFiles --> LaravelApplication[Laravel Application]
    FrontController --> WebServer
    Tests --> HTTPControllers
    Tests --> EloquentModels
    Tests --> ServiceProviders

    %% Click Events
    click WebRoutes "https://github.com/aprnna/vouki/blob/main/routes/web.php"
    click AuthRoutes "https://github.com/aprnna/vouki/blob/main/routes/auth.php"
    click HTTPControllers "https://github.com/aprnna/vouki/tree/main/app/Http/Controllers/"
    click FormRequests "https://github.com/aprnna/vouki/tree/main/app/Http/Requests/"
    click ServiceProviders "https://github.com/aprnna/vouki/blob/main/app/Providers/AppServiceProvider.php"
    click Policies "https://github.com/aprnna/vouki/blob/main/app/Policies/EventPolicy.php"
    click EloquentModels "https://github.com/aprnna/vouki/tree/main/app/Models/"
    click BladeViews "https://github.com/aprnna/vouki/tree/main/resources/views/"
    click BladeComponents "https://github.com/aprnna/vouki/tree/main/app/View/Components/"
    click AssetPipeline "https://github.com/aprnna/vouki/tree/main/resources/js/"
    click FrontController "https://github.com/aprnna/vouki/blob/main/public/index.php"
    click ConfigFiles "https://github.com/aprnna/vouki/blob/main/config/app.php"
    click Migrations "https://github.com/aprnna/vouki/tree/main/database/migrations/"
    click Seeders "https://github.com/aprnna/vouki/tree/main/database/seeders/"
    click Tests "https://github.com/aprnna/vouki/tree/main/tests/"
    click MapIntegration "https://github.com/aprnna/vouki/blob/main/resources/js/map.js"
    click GoogleIntegration "https://github.com/aprnna/vouki/blob/main/app/Http/Controllers/Auth/GoogleAuthController.php"
    click MailNotifications "https://github.com/aprnna/vouki/blob/main/config/mail.php"

    %% Styles
    classDef compute fill:#bbdefb,stroke:#1e88e5
    classDef datastore fill:#c8e6c9,stroke:#388e3c
    classDef external fill:#ffe0b2,stroke:#f57c00
    classDef config fill:#f0f4c3,stroke:#afb42b
    classDef test fill:#e1bee7,stroke:#8e24aa
    classDef client fill:#eeeeee,stroke:#9e9e9e
```
