# radenadri/whatsnew architecture

> Architecture diagram of the GitHub repository radenadri/whatsnew, 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/radenadri/whatsnew
- Repository: https://github.com/radenadri/whatsnew

## Overview

##### Main Components
- Backend (Laravel):
– Core MVC structure under the “app” directory that includes Controllers (for HTTP routes, authentication, settings, etc.), Models (e.g., Post, User), Middleware, Providers, and Requests.
– Routes are defined separately in the “routes” directory (files like web.php, auth.php, settings.php) to direct incoming HTTP requests to the proper controllers.
– Configuration files under “config”, migration and seeder files in the “database” folder, and testing suites in “tests”.
– Bootstrapping components in the “bootstrap” folder (including server-side rendering assets under bootstrap/ssr).

- Frontend (Vue):
– Vue components, layouts, and pages are located in the “resources/js” folder. This includes UI components (buttons, modals, navigation), layout files (AppLayout.vue, AuthLayout.vue), and pages (Home.vue, PostDetail.vue, etc.).
– TypeScript files and composables for reusability and state management.
– Styling is managed in “resources/css” (with Tailwind CSS and additional monospace styles).

- Infrastructure and Build:
– Vite (vite.config.ts) is used for fast compilation and bundling.
– Node package configuration (package.json) and Composer for PHP dependencies.
– Public folder for static assets and entry point (index.php) that routes front-end requests.
– GitHub Actions (under .github/workflows) provide CI/CD for linting and testing.

##### Relationships and Interactions
- Inertia Integration:
– Illustrate the flow where the browser sends HTTP requests to Laravel’s public index, which delegates requests (via routes) to appropriate controllers (often the Inertia controller) that then render and pass data to the Vue-based views.
– Represent how data flows from the Laravel backend (e.g., via Controllers and Models) to the Vue components via Inertia, establishing a single-page application experience.

- MVC and Modular Separation:
– Show the backend’s separation into controllers handling authentication, front-end requests, admin settings, etc.
– Illustrate the frontend’s layered architecture, where layouts wrap pages and pages further include many smaller UI components.

- Build and Dependency Management:
– Connect how Vite and Node modules compile the Vue assets, while Composer manages backend dependencies.
– Indicate the integration between SSR assets (in bootstrap/ssr) and the overall rendering approach.

##### Architectural Patterns and Design Principles
- MVC Architecture on the backend with clear separation between routes, controllers, models, and middleware.
- Component-Based Architecture on the frontend, where Vue components are organized by purpose (e.g., ui components, pages, layouts).
- The integration pattern via Inertia that bridges server-driven routing with client-side rendering.
- Emphasis on modularity and reusability (helper functions, composables, shared UI components).

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser("Browser"):::browser
    PublicIdx("Public Index"):::inertia

    subgraph "Laravel Backend"
        Routes("Routes"):::backend
        Controllers("Controllers"):::backend
        InertiaHandler("Inertia Handler"):::backend
        Middleware("Middleware"):::backend
        Models("Models"):::backend
        Requests("Requests"):::backend
        ConfigDB("Config & Database"):::backend
        Bootstrap("Bootstrapping & SSR"):::backend
        Testing("Testing"):::backend
    end

    subgraph "Vue Frontend"
        VueComp("Components, Layouts & Pages"):::frontend
        Styling("Styling"):::frontend
    end

    subgraph "Build & Infrastructure"
        Vite("Vite"):::build
        Package("package.json"):::build
        Composer("composer.json"):::build
        GitHub("GitHub Actions"):::build
    end

    %% Data flow from Browser to Backend and Frontend
    Browser -->|"HTTPRequest"| PublicIdx
    PublicIdx -->|"RoutesRequest"| Routes
    Routes -->|"DirectsTo"| Controllers
    Controllers -->|"UsesModels"| Models
    Controllers -->|"ValidatesVia"| Requests
    Controllers -->|"DelegatesTo"| InertiaHandler
    Controllers -->|"ReadsConfig"| ConfigDB
    InertiaHandler -->|"BridgesData"| VueComp
    Middleware -->|"ProcessesRequests"| Controllers
    Bootstrap -->|"ProvidesSSRAssets"| PublicIdx
    Testing -->|"VerifiesLogic"| Controllers
    VueComp -->|"RendersUI"| Browser

    %% Build and dependency flow 
    Vite -->|"CompilesAssets"| VueComp
    Package -->|"ManagesFrontendDeps"| VueComp
    Composer -->|"ManagesBackendDeps"| Controllers
    GitHub -->|"RunsCI/CD"| Testing

    %% Click Events for Laravel Backend
    click Controllers "https://github.com/radenadri/whatsnew/tree/main/app/Http/Controllers"
    click Models "https://github.com/radenadri/whatsnew/tree/main/app/Models"
    click Middleware "https://github.com/radenadri/whatsnew/tree/main/app/Http/Middleware"
    click Requests "https://github.com/radenadri/whatsnew/tree/main/app/Http/Requests"
    click Routes "https://github.com/radenadri/whatsnew/tree/main/routes"
    click ConfigDB "https://github.com/radenadri/whatsnew/tree/main/config"
    click Bootstrap "https://github.com/radenadri/whatsnew/tree/main/bootstrap"
    click Testing "https://github.com/radenadri/whatsnew/tree/main/tests"
    
    %% Click Events for Inertia Integration
    click InertiaHandler "https://github.com/radenadri/whatsnew/blob/main/app/Http/Middleware/HandleInertiaRequests.php"
    click PublicIdx "https://github.com/radenadri/whatsnew/blob/main/public/index.php"
    
    %% Click Events for Vue Frontend
    click VueComp "https://github.com/radenadri/whatsnew/tree/main/resources/js"
    click Styling "https://github.com/radenadri/whatsnew/tree/main/resources/css"
    
    %% Click Events for Build & Infrastructure
    click Vite "https://github.com/radenadri/whatsnew/blob/main/vite.config.ts"
    click Package "https://github.com/radenadri/whatsnew/blob/main/package.json"
    click Composer "https://github.com/radenadri/whatsnew/blob/main/composer.json"
    click GitHub "https://github.com/radenadri/whatsnew/tree/main/.github/workflows"

    %% Styles
    classDef browser fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef inertia fill:#fcf3cf,stroke:#333,stroke-width:2px;
    classDef backend fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef frontend fill:#a9dfbf,stroke:#333,stroke-width:2px;
    classDef build fill:#f5b7b1,stroke:#333,stroke-width:2px;
```
