# mattsplat/logger-app architecture

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

- Interactive diagram: https://gitdiagram.com/mattsplat/logger-app
- Repository: https://github.com/mattsplat/logger-app

## Overview

##### Project Type and Purpose
- This is a full‐stack desktop logging app ("Desktop Logger App") built on a NativePHP (Laravel) backend with a Vue + TailwindCSS frontend.
- It wraps the Opcodes Log Viewer library to scan and display Laravel log files from any local project folder, without requiring those projects to install extra dependencies.

##### Main Architectural Components
a. User (Developer)
b. Frontend
– Vue.js SPA (resources/js, components in .vue files)
– TailwindCSS styling (resources/css/app.css, tailwind.config.js)
– Vite.js build pipeline (vite.config.js)
c. HTTP Server / Native App Host
– NativePHP’s embedded HTTP server (artisan native:serve)
– Public folder serving entry point (public/index.php)
d. Laravel Application
– Routing layer (routes/web.php, routes/api.php)
– Middleware stack (app/Http/Middleware)
– Controllers (DashboardController, ProjectController)
– Service Providers (NativeAppServiceProvider, AppServiceProvider, etc.)
– Composer dependencies (composer.json)
e. Log Viewer Service
– Opcodes Log Viewer library integration (invoked by controllers)
f. Storage Layer
– Local file system scanning (config/filesystems.php, storage/app or any user‐selected log folder)
g. Optional Data Stores
– Default Laravel database (config/database.php) for any internal persistence (not central to log viewing)
h. Development Tooling
– Node/npm (package.json)
– PHPUnit tests (tests/)
– Artisan CLI scripts

##### Component Interactions and Data Flow
1) User opens the desktop app in a browser window.
2) Vue SPA loads static assets from public/ via the NativePHP server.
3) SPA makes HTTP requests (API calls) to endpoints (e.g., /api/projects, /api/logs) through routes defined in routes/api.php or routes/web.php.
4) Requests pass through Laravel middleware (authentication, CSRF protection, etc.).
5) Controllers call into the Opcodes Log Viewer service to scan the selected log directory on disk.
6) The service reads log files via the file system.
7) JSON responses containing log entries or project lists return to the SPA.
8) SPA renders the logs in interactive tables and modals (ProjectTable.vue, ProjectFormModal.vue).

##### Architectural Patterns and Principles
- MVC pattern within Laravel (Models are minimal here—Project model may simply represent a log directory).
- Layered architecture: Presentation (Vue), Application/API (Controllers & Routes), Service (Opcodes Log Viewer), Infrastructure (File System).
- Dependency injection and service providers for extensibility (NativeAppServiceProvider registers the embedded server).
- Single‐Page Application on the frontend with RESTful API backend.

##### Elements
- Version of key frameworks/libraries (Laravel/NativePHP, Vue, TelerikCSS).
- Data stores like the local file system and optional DB.
- Build tools (Node/npm, Vite) as a side cluster.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        Browser["Browser"]:::frontend
        VueSPA["Vue.js SPA"]:::frontend
        Tailwind["TailwindCSS Styling"]:::frontend
        Vite["Vite Build Pipeline"]:::frontend
    end

    subgraph "Backend Layer"
        NativeServer["NativePHP HTTP Server"]:::backend
        subgraph "Laravel Application"
            Routes["Routing Layer"]:::backend
            Middleware["Middleware Stack"]:::backend
            Controllers["Controllers"]:::backend
            ServiceProviders["Service Providers"]:::backend
            OpcLog["Opcodes Log Viewer Service"]:::backend
        end
        FS["Local File System"]:::infra
        DB["Optional Database"]:::db
        ArtisanCLI["Artisan CLI Scripts"]:::backend
    end

    subgraph "Development Tooling"
        Npm["Node/npm"]:::tool
        PHPUnit["PHPUnit Tests"]:::tool
    end

    Browser -->|"loads SPA"| VueSPA
    VueSPA -->|"build assets via Vite"| Vite
    Vite -->|"bundles JS/CSS"| VueSPA
    VueSPA -->|"uses styles"| Tailwind

    VueSPA -->|"HTTP GET/POST JSON"| NativeServer
    NativeServer -->|"routes to"| Routes
    Routes -->|"pass through"| Middleware
    Middleware -->|"invoke"| Controllers
    Controllers -->|"call"| OpcLog
    OpcLog -->|"reads logs"| FS
    FS -->|"log data"| OpcLog
    OpcLog -->|"returns JSON"| Controllers
    Controllers -->|"respond"| NativeServer
    NativeServer -->|"HTTP response"| VueSPA
    VueSPA -->|"renders data"| Browser

    Npm -->|"builds"| Vite
    PHPUnit -->|"tests"| Controllers

    click VueSPA "https://github.com/mattsplat/logger-app/blob/main/resources/js/app.js"
    click VueSPA "https://github.com/mattsplat/logger-app/blob/main/resources/js/bootstrap.js"
    click VueSPA "https://github.com/mattsplat/logger-app/tree/main/resources/js/components"
    click Tailwind "https://github.com/mattsplat/logger-app/blob/main/resources/css/app.css"
    click Tailwind "https://github.com/mattsplat/logger-app/blob/main/tailwind.config.js"
    click Tailwind "https://github.com/mattsplat/logger-app/blob/main/postcss.config.js"
    click Vite "https://github.com/mattsplat/logger-app/blob/main/vite.config.js"
    click NativeServer "https://github.com/mattsplat/logger-app/blob/main/app/Providers/NativeAppServiceProvider.php"
    click NativeServer "https://github.com/mattsplat/logger-app/blob/main/config/nativephp.php"
    click NativeServer "https://github.com/mattsplat/logger-app/blob/main/public/index.php"
    click Routes "https://github.com/mattsplat/logger-app/blob/main/routes/web.php"
    click Routes "https://github.com/mattsplat/logger-app/blob/main/routes/api.php"
    click Middleware "https://github.com/mattsplat/logger-app/tree/main/app/Http/Middleware"
    click Controllers "https://github.com/mattsplat/logger-app/blob/main/app/Http/Controllers/DashboardController.php"
    click Controllers "https://github.com/mattsplat/logger-app/blob/main/app/Http/Controllers/ProjectController.php"
    click ServiceProviders "https://github.com/mattsplat/logger-app/tree/main/app/Providers"
    click OpcLog "https://github.com/mattsplat/logger-app/blob/main/config/log-viewer.php"
    click FS "https://github.com/mattsplat/logger-app/blob/main/config/filesystems.php"
    click FS "https://github.com/mattsplat/logger-app/tree/main/storage/app"
    click FS "https://github.com/mattsplat/logger-app/tree/main/storage/logs"
    click DB "https://github.com/mattsplat/logger-app/blob/main/config/database.php"
    click ArtisanCLI "https://github.com/mattsplat/logger-app/tree/main/artisan"
    click ArtisanCLI "https://github.com/mattsplat/logger-app/blob/main/app/Console/Kernel.php"
    click Npm "https://github.com/mattsplat/logger-app/blob/main/package.json"
    click Npm "https://github.com/mattsplat/logger-app/blob/main/package-lock.json"
    click PHPUnit "https://github.com/mattsplat/logger-app/blob/main/phpunit.xml"
    click PHPUnit "https://github.com/mattsplat/logger-app/tree/main/tests/Feature"
    click PHPUnit "https://github.com/mattsplat/logger-app/tree/main/tests/Unit"

    classDef frontend fill:#E0F7FA,stroke:#00796B;
    classDef backend fill:#E8F5E9,stroke:#388E3C;
    classDef infra fill:#FFF3E0,stroke:#F57C00;
    classDef db fill:#ECEFF1,stroke:#546E7A;
    classDef tool fill:#F3E5F5,stroke:#8E24AA;
```
