# alejandro-m-cruz/home-share architecture

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

- Interactive diagram: https://gitdiagram.com/alejandro-m-cruz/home-share
- Repository: https://github.com/alejandro-m-cruz/home-share

## Overview

##### Main System Components

a. Client Layer:
- React Native Mobile Application
- Web Application (cross-platform support)
- Key frontend modules:
- Authentication flows (/app/(auth))
- Rental listing management
- Integration
- Image handling
- Location services

b. API Layer (Laravel Backend):
- Authentication Controllers
- Rental Listing Management
- Location Services
- Image Processing
- API Middleware
- Resource Controllers

c. Data Layer:
- SQLite Database
- File Storage (for images)
- Cache System

##### Component Relationships

a. Frontend to Backend:
- API Client Services (front-end/services/*)
- Authentication flows
- CRUD operations for rental listings
- Image upload pipeline
- Location services integration

b. Backend to Data:
- Database interactions through Models
- File storage operations
- Cache interactions

##### Specific Implementation Details

Key architectural elements:

a. Frontend Architecture:
- Tab-based navigation structure
- Separation between auth and main app flows
- Shared components and primitives
- Integration points with external services (Maps, Location)

b. Backend Architecture:
- Controller layer
- Resource transformers
- Model layer with relationships
- Authentication middleware
- File handling system

##### Key Integration Points to Highlight

- Google Maps integration
- Location autocomplete services
- Image upload and storage
- Authentication flow
- Real-time listing updates

**[User Interface Layer]**
- ↓
**[Frontend Services Layer]**
- ↓
**[API Gateway Layer]**
- ↓
**[Backend Services Layer]**
- ↓
**[Data Persistence Layer]**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        MobileApp["React Native Mobile App"]
        WebApp["Web Application"]
        
        subgraph FrontendModules["Frontend Modules"]
            direction TB
            AuthUI["Authentication UI"]:::frontend
            RentalUI["Rental Management UI"]:::frontend
            MapUI["Map Interface"]:::frontend
            ImageUI["Image Handling UI"]:::frontend
            LocationUI["Location Services UI"]:::frontend
        end
        
        subgraph SharedComponents["Shared Components"]
            direction TB
            MapComponent["Map Component"]:::frontend
            ImagePicker["Image Picker"]:::frontend
            LocationAuto["Location Autocomplete"]:::frontend
            Primitives["UI Primitives"]:::frontend
        end
    end

    subgraph API["API Layer"]
        direction TB
        AuthController["Auth Controller"]:::api
        RentalController["Rental Controller"]:::api
        LocationController["Location Controller"]:::api
        ImageController["Image Controller"]:::api
        
        subgraph Middleware["API Middleware"]
            direction TB
            AuthMiddleware["Auth Middleware"]:::api
            EmailVerification["Email Verification"]:::api
            RateLimiting["Rate Limiting"]:::api
        end
    end

    subgraph Data["Data Layer"]
        direction TB
        DB[(SQLite Database)]:::data
        FileStorage["File Storage"]:::data
        Cache["Cache System"]:::data
    end

    %% Relationships
    MobileApp & WebApp --> FrontendModules
    FrontendModules --> SharedComponents
    SharedComponents --> API
    API --> Data

    %% External Services
    ExternalServices["External Services"]:::external
    SharedComponents -.-> ExternalServices
    
    %% Click Events
    click AuthUI "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/app/(auth)"
    click RentalUI "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/app/create-rental-listing"
    click MapComponent "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/components/Map"
    click LocationAuto "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/components/LocationAutocomplete"
    click ImagePicker "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/components/ImagePicker"
    click AuthController "https://github.com/Alejandro-M-Cruz/home-share/tree/main/app/Http/Controllers/Auth"
    click RentalController "https://github.com/Alejandro-M-Cruz/home-share/blob/main/app/Http/Controllers/RentalListingController.php"
    click LocationController "https://github.com/Alejandro-M-Cruz/home-share/blob/main/app/Http/Controllers/LocationController.php"
    click EmailVerification "https://github.com/Alejandro-M-Cruz/home-share/blob/main/app/Http/Middleware/EnsureEmailIsVerified.php"
    click AuthMiddleware "https://github.com/Alejandro-M-Cruz/home-share/tree/main/app/Http/Middleware"
    click DB "https://github.com/Alejandro-M-Cruz/home-share/tree/main/database/migrations"
    click FileStorage "https://github.com/Alejandro-M-Cruz/home-share/blob/main/config/filesystems.php"
    click Cache "https://github.com/Alejandro-M-Cruz/home-share/blob/main/config/cache.php"
    click Primitives "https://github.com/Alejandro-M-Cruz/home-share/tree/main/front-end/primitives"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        direction TB
        Frontend["Frontend Component"]:::frontend
        APIComp["API Component"]:::api
        DataComp["Data Storage"]:::data
        ExtComp["External Service"]:::external
    end
```
