# alexis-gss/memoria architecture

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

- Interactive diagram: https://gitdiagram.com/alexis-gss/memoria
- Repository: https://github.com/alexis-gss/memoria

## Overview

##### Main Components
- Frontend (Client Side):
- Back-office (BO) and front-office (FO) user interfaces.
- Blade templates found in resources/views.
- Vue.js components and TypeScript assets in resources/ts.
- SASS stylesheets in resources/sass.
- Backend (Server Side):
- Laravel application structure in the app directory (Controllers, Models, Middleware, Jobs, Services).
- Console commands (app/Console) and artisan commands.
- APIs and web routes segregated in routes/web-bo.php and routes/web-fo.php.
- Database:
- Database migrations, seeders, and factories in the database folder, representing the models (Game, Folder, Picture, Tag, User, etc.).
- External Dependencies/Integrations:
- Third-party libraries (Vue.js, Bootstrap, SASS, etc.) indicated in package.json and composer.json.
- GitHub Actions and workflow files in .github/workflows for CI/CD.
- Configuration files for environment variables, caching, logging, etc. (config folder, .env.example).
- Additional Components:
- Mail functionality with Mails subdirectory.
- Queueing and job processing (app/Jobs) for background processing (e.g., DeleteUnassociatedPictures).
- Custom helpers and traits in app/Lib and app/Traits.
- Testing suites found in tests.

##### Relationships and Interactions
- The Client (browser) interacts with the system through HTTP requests directed at the Laravel application.
- Routing splits requests into either the front-office routes (public pages) or the back-office routes (authenticated administration).
- Controllers handle the business logic by interacting with Models. For example, controllers in app/Http/Controllers manage CRUD operations for games, folders, pictures, etc.
- Middleware (found in app/Http/Middleware) handles cross-cutting concerns (authentication, CSRF protection, localization, etc.).
- Blade templates render the UI, with Vue.js components enhancing interactivity in parts of both BO and FO.
- The Database, represented by migrations, seeders, and models, stores all domain data.
- Background tasks (jobs, mail sending) interact asynchronously with the main flow.
- External integrations such as GitHub workflows and testing scripts ensure quality and continuous delivery.

##### Architectural Patterns and Design Principles
- MVC Pattern is prevalent: Models, Views (Blade templates plus frontend assets), and Controllers reside in separate directories.
- Layered architecture separating concerns: HTTP layer (routes, controllers, middleware), business logic layer (models, services, custom helpers), and data layer (database migrations/seeds).
- Modular organization for back-office (admin functions) and front-office (public view), clearly segregated through naming conventions and routes.
- Usage of external libraries and frameworks (Vue.js, Bootstrap, SASS, Laravel) is integral to how presentation and processing are handled.
- Background Processing for tasks (jobs) and proper dependency injection via Laravel service providers (in the Providers folder).

##### Relevant Technologies & Frameworks
- Laravel (PHP framework) forms the backbone for the business logic and RESTful routing.
- Vue.js enhances UI responsiveness and component-based design on the client-side.
- TypeScript is used in frontend scripting to ensure type safety.
- SASS and Bootstrap provide styling and responsive layout.
- MySQL (or another RDBMS) is implied as the database engine given Laravel’s standard configuration.
- GitHub Actions and other CI/CD integrations support automated testing and deployment.
- PHPUnit and other tools (PHPStan, PHPCS) support a robust testing and quality assurance pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    A["Client Browser"]:::client

    %% Frontend (User Interface) Layer
    subgraph "Frontend (UI)"
        FOViews["Front-office Views"]:::frontend
        FOComponents["Front-office Components"]:::frontend
        FOVue["Vue.js FO & TS Assets"]:::frontend
        FOSASS["SASS FO Styles"]:::frontend

        BOViews["Back-office Views"]:::frontend
        BOComponents["Back-office Components"]:::frontend
        BOVue["Vue.js BO & TS Assets"]:::frontend
        BOSASS["SASS BO Styles"]:::frontend

        Blade["Blade Templates"]:::frontend
    end

    %% Backend (Laravel) Layer
    subgraph "Backend (Laravel)"
        WebRoutesFO["Web Routes FO (routes/web-fo.php)"]:::backend
        WebRoutesBO["Web Routes BO (routes/web-bo.php)"]:::backend
        FoControllers["FO Controllers (app/Http/Controllers/Fo)"]:::backend
        BoControllers["BO Controllers (app/Http/Controllers/Bo)"]:::backend
        Middleware["Middleware (app/Http/Middleware)"]:::backend
        Models["Models (app/Models)"]:::backend
        ConsoleCmd["Console Commands (app/Console/Commands)"]:::backend
        Jobs["Background Jobs (app/Jobs)"]:::backend
        Mails["Mail Functionality (app/Mails)"]:::backend
        Helpers["Custom Helpers (app/Lib)"]:::backend
        Traits["Traits (app/Traits)"]:::backend
    end

    %% Database Layer
    Database["Database Migrations & Seeders (database)"]:::database

    %% External Services Layer
    External["External Dependencies & CI/CD (package.json, composer.json, .github/workflows)"]:::external
    Testing["Testing Suites (tests)"]:::external

    %% Data Flow Connections
    A -->|"HTTP_Request"| FOViews
    A -->|"HTTP_Request"| BOViews

    FOViews -->|"Rendered_via"| Blade
    BOViews -->|"Rendered_via"| Blade

    Blade -->|"Enhanced_by"| FOVue
    Blade -->|"Enhanced_by"| BOVue

    FOComponents -->|"Integrated_in"| FOViews
    BOComponents -->|"Integrated_in"| BOViews

    FOVue -->|"Styled_with"| FOSASS
    BOVue -->|"Styled_with"| BOSASS

    FOViews -->|"Routes_to"| WebRoutesFO
    BOViews -->|"Routes_to"| WebRoutesBO

    WebRoutesFO --> FoControllers
    WebRoutesBO --> BoControllers

    FoControllers -->|"Handles_DB"| Models
    BoControllers -->|"Handles_DB"| Models

    FoControllers --> Middleware
    BoControllers --> Middleware

    ConsoleCmd --> Models
    Jobs --> Models
    Mails --> Models

    Middleware --> Models
    Helpers --> Models
    Traits --> Models

    FoControllers -->|"Query_DB"| Database
    BoControllers -->|"Query_DB"| Database
    Jobs -->|"Process_Async"| Database

    WebRoutesFO -->|"CI/CD_Test"| External
    WebRoutesBO -->|"CI/CD_Test"| External

    FoControllers -->|"Returns_Response"| FOViews
    BoControllers -->|"Returns_Response"| BOViews

    External --> Testing

    %% Click Events
    click FOViews "https://github.com/alexis-gss/memoria/tree/master/resources/views/front"
    click FOComponents "https://github.com/alexis-gss/memoria/tree/master/resources/views/components/front"
    click BOViews "https://github.com/alexis-gss/memoria/tree/master/resources/views/back"
    click BOComponents "https://github.com/alexis-gss/memoria/tree/master/resources/views/components/back"
    click Blade "https://github.com/alexis-gss/memoria/tree/master/resources/views"
    click FOVue "https://github.com/alexis-gss/memoria/tree/master/resources/ts/fo"
    click FOVue "https://github.com/alexis-gss/memoria/blob/master/resources/ts/fo/front.ts"
    click BOVue "https://github.com/alexis-gss/memoria/tree/master/resources/ts/bo"
    click BOVue "https://github.com/alexis-gss/memoria/blob/master/resources/ts/bo/back.ts"
    click FOSASS "https://github.com/alexis-gss/memoria/tree/master/resources/sass/fo"
    click BOSASS "https://github.com/alexis-gss/memoria/tree/master/resources/sass/bo"
    click BoControllers "https://github.com/alexis-gss/memoria/tree/master/app/Http/Controllers/Bo"
    click FoControllers "https://github.com/alexis-gss/memoria/tree/master/app/Http/Controllers/Fo"
    click Models "https://github.com/alexis-gss/memoria/tree/master/app/Models"
    click Middleware "https://github.com/alexis-gss/memoria/tree/master/app/Http/Middleware"
    click ConsoleCmd "https://github.com/alexis-gss/memoria/tree/master/app/Console/Commands"
    click WebRoutesFO "https://github.com/alexis-gss/memoria/blob/master/routes/web-fo.php"
    click WebRoutesBO "https://github.com/alexis-gss/memoria/blob/master/routes/web-bo.php"
    click Database "https://github.com/alexis-gss/memoria/tree/master/database/migrations"
    click Database "https://github.com/alexis-gss/memoria/tree/master/database/seeders"
    click Jobs "https://github.com/alexis-gss/memoria/tree/master/app/Jobs"
    click Mails "https://github.com/alexis-gss/memoria/tree/master/app/Mails"
    click Helpers "https://github.com/alexis-gss/memoria/tree/master/app/Lib"
    click Traits "https://github.com/alexis-gss/memoria/tree/master/app/Traits"
    click External "https://github.com/alexis-gss/memoria/blob/master/package.json"
    click External "https://github.com/alexis-gss/memoria/blob/master/composer.json"
    click External "https://github.com/alexis-gss/memoria/tree/master/.github/workflows"
    click Testing "https://github.com/alexis-gss/memoria/tree/master/tests"

    %% Styles
    classDef client fill:#f4f142,stroke:#000,stroke-width:2px;
    classDef frontend fill:#b3e5fc,stroke:#000,stroke-width:2px;
    classDef backend fill:#ffcc80,stroke:#000,stroke-width:2px;
    classDef database fill:#c8e6c9,stroke:#000,stroke-width:2px;
    classDef external fill:#d1c4e9,stroke:#000,stroke-width:2px;
    class A client
    class FOViews,FOComponents,FOVue,FOSASS,BOViews,BOComponents,BOVue,BOSASS,Blade frontend
    class WebRoutesFO,WebRoutesBO,FoControllers,BoControllers,Middleware,Models,ConsoleCmd,Jobs,Mails,Helpers,Traits backend
    class Database database
    class External,Testing external
```
