# felipeafana/ecomerce architecture

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

- Interactive diagram: https://gitdiagram.com/felipeafana/ecomerce
- Repository: https://github.com/felipeafana/ecomerce

## Overview

##### Project type and purpose
- This is a full-stack, monolithic web application built on the Laravel PHP framework.
- It follows the classic MVC pattern: HTTP requests are handled via a front-controller (public/index.php → Kernel), dispatched to routes and controllers, use Eloquent models to interact with a relational database, and render Blade views for the browser.

##### File structure
- Top-level directories:
- app/ (HTTP controllers, models, service providers)
- bootstrap/ (framework bootstrap and cached providers)
- config/ (app-wide configuration files)
- database/ (migrations, factories, seeders)
- public/ (web server entry point, static assets)
- resources/ (Blade views, CSS, JS source)
- routes/ (route definitions: web.php, console.php)
- storage/ (logs, cache, sessions, compiled views, file uploads)
- tests/ (unit/feature tests)
- vite.config.js & package.json (asset compilation pipeline)

##### README for additional insights
- Confirms core Laravel components: routing engine, DI container, ORM, migration system, queueing, broadcasting.

##### Detail without over-splitting
- Every major Laravel subsystem (routing, middleware, DI container, ORM, views, queues).
- Do not break controllers into individual methods; group by layer.
- Configuration files only as annotations (e.g., “config/database.php configures DB connection”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Front-end Layer
    subgraph "Client & Front-End Layer"
        direction TB
        Browser["Browser"]:::frontend
        Vite["Vite Dev Server / Build"]:::frontend
        Assets["CSS/JS Assets"]:::frontend
        Views["Blade Views"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        WebServer["Web Server + PHP-FPM"]:::application
        Entry["Front Controller\n(public/index.php)"]:::application
        Kernel["HTTP Kernel & Middleware\n(bootstrap/app.php)"]:::application
        RouterHTTP["HTTP Router\n(routes/web.php)"]:::application
        RouterConsole["Console Router\n(routes/console.php)"]:::application
        Controllers["Controllers\n(app/Http/Controllers)"]:::application
        ServiceProviders["Service Providers\n(app/Providers)"]:::application
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        Models["Eloquent Models\n(app/Models)"]:::domain
        UserModel["User Model\n(app/Models/User.php)"]:::domain
        ORM["Eloquent ORM"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        DB["Relational Database\n(MySQL/PostgreSQL)"]:::infra
        Migrations["Migrations\n(database/migrations)"]:::infra
        Seeders["Seeders & Factories\n(database/seeders & factories)"]:::infra
        Cache["Cache Store\n(Redis/File)"]:::infra
        Queue["Queue System & Workers"]:::infra
        Filesystem["File Storage\n(storage/app/public)"]:::infra
        Logs["Logging\n(storage/logs)"]:::infra
        Configs["Configuration\n(config/*.php)"]:::infra
        External["External Services\n(Mail, 3rd-party APIs)"]:::infra
    end

    %% Asset Pipeline connections
    Browser -->|"requests assets"| Assets
    Assets -->|"served by Vite"| Vite

    %% Request Flow
    Browser -->|"HTTP Request"| WebServer
    WebServer -->|"> public/index.php"| Entry
    Entry -->|"boot application"| Kernel
    Kernel -->|"handle middleware"| Kernel
    Kernel -->|"dispatch"| RouterHTTP
    Kernel -->|"dispatch"| RouterConsole

    RouterHTTP -->|"invoke"| Controllers
    Controllers -->|"uses"| ServiceProviders
    ServiceProviders -->|"provides bindings"| Controllers
    Controllers -->|"retrieves/saves"| ORM
    ORM -->|"queries"| DB

    Controllers -->|"dispatch job"| Queue
    Queue -->|"process job"| ServiceProviders

    Controllers -->|"render view"| Views
    Views -->|"load assets"| Assets
    Views -->|"blade templates"| Views

    Controllers -->|"access config"| Configs
    Configs -->|"configure"| WebServer

    Controllers -->|"read/write"| Filesystem
    Controllers -->|"cache data"| Cache
    Cache -->|"store sessions/views"| Logs

    Migrations -->|"run migrations"| DB
    Seeders -->|"seed data"| DB

    Controllers -->|"send mail"| External
    External -->|"API calls"| External

    %% Click Events
    click Entry "https://github.com/felipeafana/ecomerce/blob/main/public/index.php"
    click Kernel "https://github.com/felipeafana/ecomerce/blob/main/bootstrap/app.php"
    click RouterHTTP "https://github.com/felipeafana/ecomerce/blob/main/routes/web.php"
    click RouterConsole "https://github.com/felipeafana/ecomerce/blob/main/routes/console.php"
    click Controllers "https://github.com/felipeafana/ecomerce/tree/main/app/Http/Controllers"
    click ServiceProviders "https://github.com/felipeafana/ecomerce/blob/main/app/Providers/AppServiceProvider.php"
    click ServiceProviders "https://github.com/felipeafana/ecomerce/blob/main/bootstrap/providers.php"
    click UserModel "https://github.com/felipeafana/ecomerce/blob/main/app/Models/User.php"
    click Migrations "https://github.com/felipeafana/ecomerce/blob/main/database/migrations/0001_01_01_000000_create_users_table.php"
    click Migrations "https://github.com/felipeafana/ecomerce/blob/main/database/migrations/0001_01_01_000002_create_jobs_table.php"
    click Seeders "https://github.com/felipeafana/ecomerce/blob/main/database/seeders/DatabaseSeeder.php"
    click Seeders "https://github.com/felipeafana/ecomerce/blob/main/database/factories/UserFactory.php"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/database.php"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/cache.php"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/queue.php"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/filesystems.php"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/services.php"
    click Views "https://github.com/felipeafana/ecomerce/blob/main/resources/views/welcome.blade.php"
    click Assets "https://github.com/felipeafana/ecomerce/blob/main/resources/css/app.css"
    click Assets "https://github.com/felipeafana/ecomerce/blob/main/resources/js/app.js"
    click Assets "https://github.com/felipeafana/ecomerce/blob/main/resources/js/bootstrap.js"
    click Vite "https://github.com/felipeafana/ecomerce/blob/main/vite.config.js"
    click Vite "https://github.com/felipeafana/ecomerce/blob/main/package.json"
    click Cache "https://github.com/felipeafana/ecomerce/tree/main/storage/framework/cache"
    click Cache "https://github.com/felipeafana/ecomerce/tree/main/storage/framework/sessions"
    click Cache "https://github.com/felipeafana/ecomerce/tree/main/storage/framework/views"
    click Filesystem "https://github.com/felipeafana/ecomerce/tree/main/storage/app/public"
    click Logs "https://github.com/felipeafana/ecomerce/tree/main/storage/logs"
    click Configs "https://github.com/felipeafana/ecomerce/blob/main/config/logging.php"
    click External "https://github.com/felipeafana/ecomerce/blob/main/config/mail.php"

    %% Styles
    classDef frontend fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef application fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef domain fill:#fff2b3,stroke:#333,stroke-width:1px
    classDef infra fill:#e0e0e0,stroke:#333,stroke-width:1px
```
