# matthewpageuk/mjp-web architecture

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

- Interactive diagram: https://gitdiagram.com/matthewpageuk/mjp-web
- Repository: https://github.com/matthewpageuk/mjp-web

## Overview

##### Main Components
- Frontend User Interface:
- Blade views located in resources/views, plus assets like CSS (resources/css/app.css), JavaScript (resources/js/app.js), and other public assets.
- Livewire components found in app/Livewire which serve the dynamic, interactive UI including components for Github integrations, journals, posts, projects, and skills.
- Admin Panel:
- Filament admin resources present in app/Filament (includes resources, widgets, traits). This reflects the admin/dashboard functionality.
- Backend (Business Logic and Controllers):
- HTTP Controllers within app/Http/Controllers that handle user requests, authentication, profile management, and other public-facing functionality.
- Console commands in app/Console/Commands that support setup operations (mjwp:setup and demosetup).
- Domain/Models and Services:
- Models in app/Models represent entities like User, Project, Skill, Experience, CV, etc.
- Custom services in app/Services and app/Services/Ui encapsulate business logic and support operations such as the “PageService” or “SkillStatsService”.
- Database:
- Migrations and seeders under database/migrations and database/seeders define all persistent data structures.
- Configuration & External Integrations:
- Config files in the config directory (including config/github.php and session/auth configs) specify application settings along with environment variables in .env.
- Integration with external services like Github (referenced by GITHUB_TOKEN) and possibly email features (app/Mail).

##### Relationships and Data Flow
- The “front door” for web requests is through routes (routes/web.php, routes/api.php, etc.) that direct traffic to appropriate controllers.
- Controllers coordinate between the views, business logic in services, and data storage via models.
- Livewire components and Filament resources encapsulate both frontend logic and immediate server communication for real-time updates.
- Console commands and scheduled tasks act as supportive mechanisms for maintenance and setup.

##### Architectural Patterns and Design Principles
- MVC: Clear separation between models, views, and controllers.
- Service Layer: Encapsulation of business logic in the Services directory, which helps keep controllers thin.
- Component-Based UI: Livewire components for the reactive parts of the UI and Blade layouts in resources/views.
- Dependency Injection & Contract Interfaces: Usage of contracts in app/Contracts and traits in models and services to ensure reusability.
- Modular & Extensible Design: The segregation into Filament resources for admin and a separate namespace for public UI components indicates a well-modularized codebase.

##### Detailed Capturing of Essential Architectural Elements
- Components from both user interactions (public website / UI dashboard) and administrative functions.
- Integration between the various directories (e.g., how console commands support the application's initial setup).
- Separation of concerns and modular design, such as contracts for abstraction, traits for shared functionality, and services for encapsulated business logic.

## Diagram (Mermaid)

```mermaid
graph TB
    %% User Interaction
    User["User Request"]:::presentation

    %% Presentation Layer
    subgraph "Presentation Layer"
        BladeViews["Blade Views"]:::presentation
        CSS["CSS Assets"]:::presentation
        JS["JS Assets"]:::presentation
        Livewire["Livewire Components"]:::presentation
        Filament["Admin Panel (Filament Resources)"]:::presentation
    end

    %% Application / Business Logic Layer
    subgraph "Business Logic Layer"
        Controllers["HTTP Controllers"]:::backend
        Commands["Console Commands"]:::backend
        Services["Business & Custom Services"]:::backend
        Models["Domain Models"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        Migrations["Database: Migrations"]:::database
        Seeders["Database: Seeders"]:::database
    end

    %% Configuration & External Integrations Layer
    subgraph "Configuration & External Integrations"
        ConfigFiles["Config Files"]:::config
        Env["Environment Variables"]:::config
    end

    %% Connections from User to Presentation Layer
    User -->|"accesses"| BladeViews
    User -->|"accesses"| Livewire
    User -->|"accesses"| Filament

    %% From Presentation Layer to Business Logic
    BladeViews -->|"renders"| Controllers
    Livewire -->|"communicates"| Controllers
    Filament -->|"interfaces via"| Controllers

    %% Business Logic interactions
    Controllers -->|"invokes"| Services
    Controllers -->|"triggers"| Commands
    Services -->|"processes data for"| Models

    %% Data Layer interactions
    Models -->|"persists to"| Migrations
    Models -->|"populates"| Seeders

    %% Configuration influence
    ConfigFiles -->|"configures"| Controllers
    ConfigFiles -->|"configures"| Services
    Env -->|"supplies"| ConfigFiles

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef database fill:#FFFFE0,stroke:#000,stroke-width:1px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px;

    %% Click Events
    click BladeViews "https://github.com/matthewpageuk/mjp-web/tree/main/resources/views"
    click CSS "https://github.com/matthewpageuk/mjp-web/blob/main/resources/css/app.css"
    click JS "https://github.com/matthewpageuk/mjp-web/blob/main/resources/js/app.js"
    click Livewire "https://github.com/matthewpageuk/mjp-web/tree/main/app/Livewire"
    click Filament "https://github.com/matthewpageuk/mjp-web/tree/main/app/Filament"
    click Controllers "https://github.com/matthewpageuk/mjp-web/tree/main/app/Http/Controllers"
    click Commands "https://github.com/matthewpageuk/mjp-web/tree/main/app/Console/Commands"
    click Models "https://github.com/matthewpageuk/mjp-web/tree/main/app/Models"
    click Services "https://github.com/matthewpageuk/mjp-web/tree/main/app/Services"
    click Services "https://github.com/matthewpageuk/mjp-web/tree/main/app/Services/Ui"
    click Migrations "https://github.com/matthewpageuk/mjp-web/tree/main/database/migrations"
    click Seeders "https://github.com/matthewpageuk/mjp-web/tree/main/database/seeders"
    click ConfigFiles "https://github.com/matthewpageuk/mjp-web/tree/main/config"
    click Env "https://github.com/matthewpageuk/mjp-web/blob/main/.env.example"
```
