# juancarsp7/devstagram architecture

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

- Interactive diagram: https://gitdiagram.com/juancarsp7/devstagram
- Repository: https://github.com/juancarsp7/devstagram

## Overview

##### Project type and purpose
- This is a full-stack, monolithic Laravel web application implementing a simple social network. Users can register, authenticate, create posts and code snippets (“codigos”), comment, like, follow/unfollow, upload images, and receive email notifications.
- Key use cases: user registration/login, CRUD on posts/“codigos”/comments, real-time or AJAX-driven likes (via Livewire), follower relationships, email notifications, file uploads, a scheduling/queue system for background jobs.

##### File structure
- Top-level directories:
- app/: contains MVC code (Controllers, Models, Middleware, Mail, Notifications, Livewire components, Policies, Console commands, Providers)
- config/: application configuration (database, mail, cache, queues, broadcasting, services)
- database/: migrations, model factories, seeders
- resources/: frontend assets (CSS/JS via Vite), Blade view templates, localization files
- public/: web root (index.php, assets, uploads)
- routes/: routing definitions (web.php, api.php, console.php, channels.php)
- storage/: runtime files (logs, cache, sessions, uploaded files)
- bootstrap/: framework bootstrap and cached configs
- tests/: Unit and Feature tests
- Framework conventions: service providers, Facades, Eloquent ORM, Blade + Livewire for dynamic UI, queued Mail & Notifications, Scheduler (app/Console/Kernel.php).

##### README for additional insights
- It’s the standard Laravel README describing framework features. No custom architecture docs are present.

##### Details
- Every essential flow: HTTP, AJAX (Livewire), file upload, email dispatch, scheduled tasks.
- Configuration boundaries (config/*.php) feeding into service providers.
- Queue driver and cache driver selections.
- Avoid over-splitting; modularize by function (web requests, tasks, data).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client["Client (Browser/Mobile)"]:::client

    %% Network Layer
    LB["Load Balancer"]:::infra
    WebServer["Web Server\n(Nginx/Apache)"]:::infra

    %% Application Layer
    subgraph "Laravel Application" 
        direction TB
        PHPFPM["PHP-FPM"]:::compute
        subgraph "Framework Core"
            direction TB
            RoutingWeb["routes/web.php"]:::config
            RoutingAPI["routes/api.php"]:::config
            RoutingCh["routes/channels.php"]:::config
            RoutingCon["routes/console.php"]:::config
            Controllers["HTTP Controllers"]:::component
            Middleware["HTTP Middleware"]:::component
            LivewireComp["Livewire Components"]:::component
            LivewireViews["Livewire Livewire Views"]:::component
            Models["Eloquent Models"]:::component
            Views["Blade Views"]:::component
            Providers["Service Providers"]:::component
            QueueWorker["Queue Worker\n(artisan queue:work)"]:::compute
            Scheduler["Scheduler\n(app/Console/Kernel.php)"]:::compute
        end
    end

    %% Infrastructure
    subgraph "Infrastructure"
        direction TB
        DB[(Database)]:::database
        Cache[(Cache/Queue Store)]:::database
        Storage[(File Storage)]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        SMTP["Mail Service\n(SMTP/Mailgun/SES)"]:::cloud
        S3["S3 Storage"]:::cloud
        Pusher["Broadcasting Service\n(Pusher/WebSockets)"]:::cloud
    end

    %% Flows
    Client -->|HTTP request| LB --> WebServer --> PHPFPM
    PHPFPM -->|handle| RoutingWeb
    RoutingWeb --> Controllers
    RoutingAPI --> Controllers
    RoutingCh --> Controllers
    RoutingCon --> Scheduler
    Controllers --> Middleware --> Controllers
    Controllers --> LivewireComp
    LivewireComp --> LivewireViews
    Controllers --> Models
    Controllers --> Views
    Controllers -->|dispatch job| QueueWorker
    Controllers -->|schedule tasks| Scheduler
    Controllers -->|store files| Storage
    Models --> DB
    Models --> Cache
    QueueWorker --> SMTP
    QueueWorker --> Pusher
    Scheduler --> DB
    Scheduler -->|dispatch| QueueWorker

    %% Storage interactions
    Storage --> S3
    Storage -->|local disk| Storage

    %% Click Events
    click RoutingWeb "https://github.com/juancarsp7/devstagram/blob/main/routes/web.php"
    click RoutingAPI "https://github.com/juancarsp7/devstagram/blob/main/routes/api.php"
    click RoutingCh "https://github.com/juancarsp7/devstagram/blob/main/routes/channels.php"
    click RoutingCon "https://github.com/juancarsp7/devstagram/blob/main/routes/console.php"
    click Controllers "https://github.com/juancarsp7/devstagram/tree/main/app/Http/Controllers/"
    click Middleware "https://github.com/juancarsp7/devstagram/tree/main/app/Http/Middleware/"
    click LivewireComp "https://github.com/juancarsp7/devstagram/tree/main/app/Http/Livewire/"
    click LivewireViews "https://github.com/juancarsp7/devstagram/tree/main/resources/views/livewire/"
    click Models "https://github.com/juancarsp7/devstagram/tree/main/app/Models/"
    click Views "https://github.com/juancarsp7/devstagram/tree/main/resources/views/"
    click Providers "https://github.com/juancarsp7/devstagram/tree/main/app/Providers/"
    click QueueWorker "https://github.com/juancarsp7/devstagram/tree/main/artisan"
    click Scheduler "https://github.com/juancarsp7/devstagram/blob/main/app/Console/Kernel.php"
    click Storage "https://github.com/juancarsp7/devstagram/blob/main/config/filesystems.php"
    click Storage "https://github.com/juancarsp7/devstagram/tree/main/storage/app/public/"
    click SMTP "https://github.com/juancarsp7/devstagram/blob/main/config/mail.php"
    click SMTP "https://github.com/juancarsp7/devstagram/tree/main/app/Mail/"
    click SMTP "https://github.com/juancarsp7/devstagram/tree/main/resources/views/emails/"
    click Notifications "https://github.com/juancarsp7/devstagram/tree/main/app/Notifications/"
    click Pusher "https://github.com/juancarsp7/devstagram/blob/main/config/broadcasting.php"
    click Pusher "https://github.com/juancarsp7/devstagram/blob/main/app/Providers/BroadcastServiceProvider.php"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef infra fill:#bbf,stroke:#333,stroke-width:1px
    classDef compute fill:#fbf,stroke:#333,stroke-width:1px
    classDef component fill:#bfb,stroke:#333,stroke-width:1px
    classDef database fill:#ffb,stroke:#333,stroke-width:1px
    classDef cloud fill:#fcf,stroke:#333,stroke-width:1px
    classDef config fill:#eef,stroke:#333,stroke-width:1px
```
