# agrojuradoit/sfm-agroger architecture

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

- Interactive diagram: https://gitdiagram.com/agrojuradoit/sfm-agroger
- Repository: https://github.com/agrojuradoit/sfm-agroger

## Overview

##### Project type and purpose
- This is a full-stack, single-page application (SPA) for managing agricultural data.
- The front-end is a React app (bootstrapped with Create React App) under **src/** and **public/**.
- The back-end is a Laravel API with an integrated Filament admin panel under **apis/**.

##### File structure
- Top-level directories:
- **src/** – React components, pages, services, styles, utils.
- **public/** – React’s static assets and index.html.
- **apis/** – Laravel project:
– **app/Http/Controllers/** – API controllers
– **app/Models/** – Eloquent models
– **app/Filament/Resources/** – Filament admin CRUD resources
– **config/**, **routes/**, **database/**, **storage/**, **tests/**, etc.
- Build tools & configs: **package.json**, **vite.config.js** (CRA), **composer.json**, **phpunit.xml**, **.env.example**.

##### README for additional insights
- The README is standard Create React App documentation, confirming the front-end framework.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    subgraph "Client Tier" 
        direction TB
        Browser["User Browser"]:::client
        ReactSPA["React SPA<br>(React, CRA, Vite)"]:::client
        Services["Service Layer<br>(API, Auth, Finca)"]:::client
        Utils["Utilities<br>(calculosPolinizacion)"]:::client
        Assets["Static Assets<br>(public)"]:::client
    end

    %% API Tier
    subgraph "API Tier"
        direction TB
        APIGateway["Web Server<br>(Nginx/Apache + PHP-FPM)"]:::backend
        APIEntry["index.php<br>(API Entry)"]:::backend
        APIRoutes["api.php<br>(API Routes)"]:::backend
        Middleware["TipoRolMiddleware"]:::backend
        subgraph "Controllers"
            direction TB
            Controllers["CRUD & Auth Controllers"]:::backend
        end
        subgraph "Models"
            direction TB
            Models["Eloquent Models"]:::backend
        end
        subgraph "Filament Admin UI"
            direction TB
            Filament["Filament Resources"]:::backend
        end
    end

    %% Data Tier
    subgraph "Data & Services Tier"
        direction TB
        Database["Database<br>(MySQL/Postgres)"]:::storage
        Cache["Cache/Queue<br>(Redis or DB)"]:::storage
        FileStorage["File Storage<br>(Local/Cloud)"]:::storage
        External["Mail & 3rd-party APIs"]:::external
    end

    %% Connections
    Browser -->|"UI Events / Routing"| ReactSPA
    ReactSPA -->|"HTTP(S) JSON"| APIGateway
    ReactSPA -->|"API Calls"| Services
    ReactSPA -->|Uses| Utils
    ReactSPA -->|Loads| Assets

    APIGateway -->|Bootstrap| APIEntry
    APIEntry -->|Loads Routes| APIRoutes
    APIRoutes -->|Pass through| Middleware
    Middleware -->|Invoke| Controllers
    Controllers -->|CRUD via ORM| Models
    Models -->|Read/Write| Database
    Controllers -->|Cache & Queue| Cache
    Controllers -->|Handle Uploads| FileStorage
    Controllers -->|External Calls| External
    Filament -->|Use Controllers & Models| Controllers
    Filament -->|Use Controllers & Models| Models

    %% Click Events
    click ReactSPA "https://github.com/agrojuradoit/sfm-agroger/tree/master/src/"
    click Assets "https://github.com/agrojuradoit/sfm-agroger/tree/master/public/"
    click Services "https://github.com/agrojuradoit/sfm-agroger/blob/master/src/services/api.js"
    click Services "https://github.com/agrojuradoit/sfm-agroger/blob/master/src/services/authService.js"
    click Services "https://github.com/agrojuradoit/sfm-agroger/blob/master/src/services/fincaService.js"
    click Utils "https://github.com/agrojuradoit/sfm-agroger/blob/master/src/utils/calculosPolinizacion.js"
    click APIEntry "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/public/index.php"
    click APIRoutes "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/routes/api.php"
    click Controllers "https://github.com/agrojuradoit/sfm-agroger/tree/master/apis/app/Http/Controllers/"
    click Models "https://github.com/agrojuradoit/sfm-agroger/tree/master/apis/app/Models/"
    click Filament "https://github.com/agrojuradoit/sfm-agroger/tree/master/apis/app/Filament/Resources/"
    click Middleware "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/app/Http/Middleware/TipoRolMiddleware.php"
    click Database "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/config/database.php"
    click Cache "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/config/cache.php"
    click FileStorage "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/config/filesystems.php"
    click External "https://github.com/agrojuradoit/sfm-agroger/blob/master/apis/config/services.php"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#DFFFE0,stroke:#2a7f2a,color:#2a7f2a
    classDef storage fill:#FFE4B3,stroke:#d18b00,color:#d18b00
    classDef external fill:#E0E0E0,stroke:#606060,color:#606060
```
