# annerh3/fernandarentals-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/annerh3/fernandarentals-frontend
- Repository: https://github.com/annerh3/fernandarentals-frontend

## Overview

##### Project type and purpose
- This is a single-page front-end application (“Fernanda Rentals”) built with React, Vite, Tailwind CSS and JavaScript.
- It provides a public website for browsing/renting event products, a PayPal-based payment flow, and an administration dashboard to manage categories, products, events and users.

##### File structure
- Top-level “FernandaRentals-Frontend” contains:
- public, index.html, package.json, Vite/Tailwind configs
- src/App.jsx and main entry src/main.jsx
- src/features split by domain: Website, administration, security
- src/shared for cross-cutting actions, components, utils
- src/config/api for WebApi and PayPal API client code
- There are custom hooks, forms, pages, routes, and store modules under each feature – indicating a feature-based modular architecture.
- Shared/actions suggests a Redux-style action layer; store files under features indicate per-feature Zustand or Redux Toolkit slices.

##### README
- The README only states the project’s name (“Fernanda Rentals | UNAH COPAN”) and doesn’t include an architectural overview or dependencies. All architecture details come from the file tree.

##### Main components
a. User / Browser:
- End user interacts via modern browser.
b. Front-End SPA:
- UI Layer – pages and components (Website pages, Administration pages, Security pages)
- Routing Layer – AppRouter, WebRouter, AdministrationRouter, SecurityRouter
- State Management – shared actions + per-feature store/hooks
- API Client Layer – WebApi.jsx for backend calls; PaypalSandBoxApi.js & paypayCheckout/refundPayment modules
c. External Services:
- Backend REST API (not in this repo) for authentication, categories, products, events, clients, finances, notes
- PayPal Sandbox for payment processing
d. Build & Deployment:
- Vite build, PostCSS/Tailwind CSS pipeline, static hosting

##### Relationships & Interactions
- User → Browser → React SPA
- Routing layer resolves URL → renders component/page
- Component dispatches actions or invokes store hooks → updates store → UI re-renders
- UI or store invokes API Client → HTTP request to REST API → response flows back → store update
- For payments: component or hook calls PayPal client → redirect to PayPal → callback returns status → refund/payment modules handle interactions
- Shared utils and constants support formatting, validation, roles

##### Architectural patterns & design principles
- Feature-based modularization (separate folders for Website, Administration, Security)
- Component hierarchy: shared vs feature-specific
- Unidirectional data flow: actions → store → components
- API abstraction layer: isolate HTTP details in config/api modules
- Custom hooks to encapsulate data fetching and local state

1. Top: “User/Browser”
2. Next: “React SPA” subdivided into:
- Routing
- Pages & Components (group by Website, Administration, Security)
- State Management (shared actions + feature stores/hooks)
- API Client (Web API & PayPal)
3. Bottom: “External Services” with two nodes:
- Backend REST API
- PayPal Sandbox
- Browser → SPA
- SPA Routing → Components → Store → API Client → External Services
- External Services → API Client → Store → Components
- Blue rectangles for UI layers
- Green for state management
- Orange for API clients
- Labels:
- Name each component (e.g., “Website Page: HomePage.jsx”) or group them (e.g., “Website Pages”)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["End User\n(Browser)"]:::user

    %% React SPA Layer
    subgraph "React SPA" 
        direction TB

        %% Routing Layer
        subgraph "Routing Layer"
            direction TB
            AppRouter["AppRouter"]:::routing
            WebRouter["Website Router"]:::routing
            AdminRouter["Administration Router"]:::routing
            SecurityRouter["Security Router"]:::routing
        end

        %% UI Layer
        subgraph "UI Layer"
            direction TB
            WebsitePages["Website Pages"]:::ui
            WebsiteComps["Website Components"]:::ui
            AdminPages["Administration Pages"]:::ui
            AdminComps["Administration Components"]:::ui
            SecurityPages["Security Pages"]:::ui
            SecurityComps["Security Components"]:::ui
            SharedComps["Shared Components"]:::ui
        end

        %% State Management Layer
        subgraph "State Management" 
            direction TB
            SharedActions["Shared Actions"]:::state
            WebsiteStore["Website Store/Hooks"]:::state
            AdminStore["Administration Store/Hooks"]:::state
            SecurityStore["Security Store/Hooks"]:::state
        end

        %% API Client Layer
        subgraph "API Client" 
            direction TB
            WebApi["WebApi"]:::api
            PayPalSandbox["PayPal Sandbox API"]:::api
            PayPalCheckout["PayPal Checkout"]:::api
            PayPalRefund["PayPal Refund"]:::api
        end
    end

    %% External Services Layer
    subgraph "External Services"
        direction TB
        BackendAPI["Backend REST API"]:::external
        PayPalService["PayPal Sandbox"]:::external
    end

    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        direction TB
        ViteConfig["Vite Config"]:::build
        TailwindConfig["Tailwind Config"]:::build
        PostCSSConfig["PostCSS Config"]:::build
    end

    %% Connections
    User -->|"loads SPA"| AppRouter
    AppRouter -->|"routes to Website"| WebRouter
    AppRouter -->|"routes to Admin"| AdminRouter
    AppRouter -->|"routes to Security"| SecurityRouter

    WebRouter -->|"renders"| WebsitePages
    WebsitePages -->|"uses"| WebsiteComps
    AdminRouter -->|"renders"| AdminPages
    AdminPages -->|"uses"| AdminComps
    SecurityRouter -->|"renders"| SecurityPages
    SecurityPages -->|"uses"| SecurityComps

    WebsiteComps -->|"dispatch actions"| WebsiteStore
    AdminComps -->|"dispatch actions"| AdminStore
    SecurityComps -->|"dispatch actions"| SecurityStore
    WebsiteStore -->|"uses"| SharedActions
    AdminStore -->|"uses"| SharedActions
    SecurityStore -->|"uses"| SharedActions

    WebsiteStore -->|"calls"| WebApi
    AdminStore -->|"calls"| WebApi
    SecurityStore -->|"calls"| WebApi
    WebsiteComps -->|"calls"| PayPalSandbox
    WebsiteComps -->|"calls"| PayPalCheckout
    WebsiteComps -->|"calls"| PayPalRefund

    WebApi -->|"HTTP/REST"| BackendAPI
    PayPalSandbox -->|"API"| PayPalService
    PayPalCheckout -->|"redirect"| PayPalService
    PayPalRefund -->|"API"| PayPalService

    BackendAPI -->|"response"| WebApi
    PayPalService -->|"callback"| PayPalSandbox
    PayPalService -->|"callback"| PayPalCheckout
    PayPalService -->|"callback"| PayPalRefund

    ViteConfig -->|"build pipeline"| AppRouter
    TailwindConfig -->|"CSS pipeline"| WebsiteComps
    PostCSSConfig -->|"CSS processing"| WebsiteComps

    %% Click Events
    click WebsitePages "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/Website/pages"
    click WebsiteComps "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/Website/components"
    click WebRouter "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/features/Website/routes/WebRouter.jsx"
    click WebsiteStore "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/Website/store"
    click AdminPages "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/administration/pages"
    click AdminComps "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/administration/components"
    click AdminRouter "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/features/administration/routes/AdministrationRouter.jsx"
    click AdminStore "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/administration/store"
    click SecurityPages "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/security/pages"
    click SecurityComps "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/security/components"
    click SecurityRouter "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/features/security/routes/SecurityRouter.jsx"
    click SecurityStore "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/features/security/store"
    click AppRouter "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/routes/AppRouter.jsx"
    click SharedActions "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/shared/actions"
    click SharedComps "https://github.com/annerh3/fernandarentals-frontend/tree/main/FernandaRentals-Frontend/src/shared/components"
    click WebApi "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/config/api/WebApi.jsx"
    click PayPalSandbox "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/config/api/PaypalSandBoxApi.js"
    click PayPalCheckout "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/config/api/paypalCheckout.js"
    click PayPalRefund "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/src/config/api/refundPayment.js"
    click ViteConfig "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/vite.config.js"
    click TailwindConfig "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/tailwind.config.js"
    click PostCSSConfig "https://github.com/annerh3/fernandarentals-frontend/blob/main/FernandaRentals-Frontend/postcss.config.js"

    %% Styles
    classDef user fill:#8dd3c7,stroke:#333,stroke-width:1px
    classDef routing fill:#ccebc5,stroke:#333,stroke-width:1px
    classDef ui fill:#a6cee3,stroke:#333,stroke-width:1px
    classDef state fill:#b2df8a,stroke:#333,stroke-width:1px
    classDef api fill:#fd8d3c,stroke:#333,stroke-width:1px
    classDef external fill:#999999,stroke:#333,stroke-width:1px,stroke-dasharray: 5, 5
    classDef build fill:#ffffb3,stroke:#333,stroke-width:1px
```
