# maggperez/piggyunited-react architecture

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

- Interactive diagram: https://gitdiagram.com/maggperez/piggyunited-react
- Repository: https://github.com/maggperez/piggyunited-react

## Overview

##### Project Type and Purpose
- Project Type: A full-stack (client-driven with cloud backend) online banking simulation.
- Purpose: To educate newcomers about banking by simulating a digital banking environment. Users can log in/create accounts, view dashboards, interact with account pages (Checkings, Savings, Credit Cards, etc.), and review their transaction history.

##### File Structure
- Top-level files:
- index.html: Acts as the entry point for the UI.
- package.json, vite.config.js, and eslint.config.js: These define the development and build configurations.
- Public Directory:
- src Directory:
- Business Logic & Utilities:
- Bank.js: Likely handles core banking operations like deposits, withdrawals, and overall state management.
- firebase.js: Manages Firebase integration for authentication and real-time database operations.
- UI Components (in src/components):
- Contains reusable pieces such as AmountButton, Balance, PageTitle, Sidebar, and TransactionTable.
- Pages (in src/pages):
- Contains screen-specific components (Account, App, CD, Checkings, CreditCards, Dashboard, History, Login, Savings) corresponding to distinct application features or routes.
- Additional Scripts & Styles:
- Files like loginScript.js, script.js, login.css, and style.css support specific UI interactions and styling.

##### README for Additional Insights
- The README clearly outlines major user journeys (Login, Dashboard, Account details, transaction history, credit card generation) and includes illustrative screenshots for each.
- These illustrations indicate clear boundaries between the authentication flow, user account management, and interaction with banking functionalities.

a. Main Components to be Represented:
- Frontend UI Layer:
- index.html (initial HTML shell)
- main.jsx (bootstrapping the React application)
- App component (root component) which manages routing and layout.
- Feature Pages:
- Login, Dashboard, Account, Checkings, CreditCards, Savings, History, etc.
- Reusable Components:
- Sidebar, Balance, PageTitle, AmountButton, TransactionTable.
- Business Logic and Services:
- Bank.js for handling core banking operations.
- firebase.js for backend services (authentication, database interactions).
- Static Assets:
b. Relationships and Interactions:
- Within the UI, demonstrate routing from App.jsx to various pages (e.g., Login, Dashboard, Account).
- How common components (Sidebar, TransactionTable, etc.) are shared across pages.
- That data flows from the UI components to Bank.js for transaction handling.
- Bank.js with firebase.js to indicate storage, authentication, and real-time updates.
c. Architectural Patterns and Principles:
- Component-Based Architecture: With React components categorized by UI pieces and pages.
- Separation of Concerns: Isolating business logic (Bank.js) and backend integration (firebase.js) from presentation.
- Routing & State Management: Likely handled in main.jsx/App.jsx as indicated by separate pages.
d. Technologies & Frameworks:
- React (JSX components)
- Vite (for development and bundling)
- Firebase (for backend services)
- CSS and configuration files for styling and linting

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::aux

    subgraph "Frontend Bootstrapping"
        HTML("Entry Point: index.html"):::ui
        MAIN("Bootstrapping: main.jsx"):::ui
    end
    U -->|"initiates"| HTML
    HTML -->|"loads"| MAIN

    subgraph "Routing & Pages"
        APP("App Component"):::page
        subgraph "Feature Pages"
            LOGIN("Login Page"):::page
            DASHBOARD("Dashboard Page"):::page
            ACCOUNT("Account Page"):::page
            CHECKINGS("Checkings Page"):::page
            CREDIT("CreditCards Page"):::page
            SAVINGS("Savings Page"):::page
            HISTORY("History Page"):::page
            CD("CD Page"):::page
        end
        APP -->|"routes-to"| LOGIN
        APP -->|"routes-to"| DASHBOARD
        APP -->|"routes-to"| ACCOUNT
        APP -->|"routes-to"| CHECKINGS
        APP -->|"routes-to"| CREDIT
        APP -->|"routes-to"| SAVINGS
        APP -->|"routes-to"| HISTORY
        APP -->|"routes-to"| CD
    end

    subgraph "Shared Components"
        SIDEBAR("Sidebar"):::component
        BALANCE("Balance"):::component
        PAGETITLE("PageTitle"):::component
        AMOUNT("AmountButton"):::component
        TRANSACTION("TransactionTable"):::component
    end
    APP -->|"uses"| SIDEBAR
    APP -->|"uses"| BALANCE
    APP -->|"uses"| PAGETITLE
    APP -->|"uses"| AMOUNT
    APP -->|"uses"| TRANSACTION

    subgraph "Business Logic Layer"
        BANK("Business Logic: Bank.js"):::business
        FIREBASE("Backend Service: firebase.js"):::backend
    end
    APP -->|"handles-transactions"| BANK
    BANK -->|"integrates-with"| FIREBASE

    subgraph "External Services"
        FCLOUD("Firebase Cloud Services"):::backend
    end
    FIREBASE -->|"connects-to"| FCLOUD

    subgraph "Static & Auxiliary Assets"
        STATIC("Static Assets: public"):::asset
        AUX1("loginScript.js"):::aux
        AUX2("script.js"):::aux
        AUX3("login.css"):::aux
        AUX4("style.css"):::aux
    end
    HTML -->|"references"| STATIC
    MAIN -->|"includes"| AUX1
    MAIN -->|"includes"| AUX2
    MAIN -->|"includes"| AUX3
    MAIN -->|"includes"| AUX4

    click HTML "https://github.com/maggperez/piggyunited-react/blob/main/index.html"
    click MAIN "https://github.com/maggperez/piggyunited-react/blob/main/src/main.jsx"
    click APP "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/App.jsx"
    click LOGIN "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/Login.jsx"
    click DASHBOARD "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/Dashboard.jsx"
    click ACCOUNT "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/Account.jsx"
    click CHECKINGS "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/Checkings.jsx"
    click CREDIT "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/CreditCards.jsx"
    click SAVINGS "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/Savings.jsx"
    click HISTORY "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/History.jsx"
    click CD "https://github.com/maggperez/piggyunited-react/blob/main/src/pages/CD.jsx"
    click SIDEBAR "https://github.com/maggperez/piggyunited-react/blob/main/src/components/Sidebar.jsx"
    click BALANCE "https://github.com/maggperez/piggyunited-react/blob/main/src/components/Balance.jsx"
    click PAGETITLE "https://github.com/maggperez/piggyunited-react/blob/main/src/components/PageTitle.jsx"
    click AMOUNT "https://github.com/maggperez/piggyunited-react/blob/main/src/components/AmountButton.jsx"
    click TRANSACTION "https://github.com/maggperez/piggyunited-react/blob/main/src/components/TransactionTable.jsx"
    click BANK "https://github.com/maggperez/piggyunited-react/blob/main/src/Bank.js"
    click FIREBASE "https://github.com/maggperez/piggyunited-react/blob/main/src/firebase.js"
    click STATIC "https://github.com/maggperez/piggyunited-react/tree/main/public"
    click AUX1 "https://github.com/maggperez/piggyunited-react/blob/main/src/loginScript.js"
    click AUX2 "https://github.com/maggperez/piggyunited-react/blob/main/src/script.js"
    click AUX3 "https://github.com/maggperez/piggyunited-react/blob/main/src/login.css"
    click AUX4 "https://github.com/maggperez/piggyunited-react/blob/main/src/style.css"

    classDef ui fill:#b3e5fc,stroke:#000,stroke-width:1px;
    classDef page fill:#ffcc80,stroke:#000,stroke-width:1px;
    classDef component fill:#dcedc8,stroke:#000,stroke-width:1px;
    classDef business fill:#f8bbd0,stroke:#000,stroke-width:1px;
    classDef backend fill:#e1bee7,stroke:#000,stroke-width:1px;
    classDef asset fill:#c5cae9,stroke:#000,stroke-width:1px;
    classDef aux fill:#d7ccc8,stroke:#000,stroke-width:1px;
```
