# vineets46/invoiceflow architecture

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

- Interactive diagram: https://gitdiagram.com/vineets46/invoiceflow
- Repository: https://github.com/vineets46/invoiceflow

## Overview

##### Project type and purpose
- This is a full-stack invoice management web application (“InvoiceFlow”).
- Frontend: React SPA (bootstrapped with Create React App) under the root `src` and `public` folders.
- Backend: Serverless functions in `invoiceflow-backend` (Azure Functions).
- Auth & Persistence: Firebase for user authentication and Firestore for storing invoice metadata (in `src/firebaseConfig.js`).
- File processing: Users upload invoice PDFs via a presigned-URL flow; a storage trigger processes them.

##### File structure
- Root:
- `public` & `src` → React app sources, assets, components, hooks, pages.
- `firebaseConfig.js` & `useAuth.js` → Firebase Auth / Firestore integration.
- `invoiceflow-backend` → Azure Functions project:
– `getUploadUrl` (HTTP-trigger)
– `processInvoice` (Blob-trigger)
– `host.json`, `.funcignore` → function runtime configuration
- Patterns:
- SPA with protected routes (`ProtectedRoute.js`)
- Serverless microservices (two functions)
- Event-driven processing (blob trigger)

##### README
- Standard CRA instructions—no bespoke architecture doc.

##### Final advice
- Be very detailed—break out each function and each SDK interaction.
- Don’t overthink—separate the system into its logical components (Auth, API, Storage, Processing, DB, UI).
- Both synchronous (HTTP) and asynchronous (event) flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global entities
    User["Client Browser"]:::external

    %% Frontend SPA
    subgraph "Frontend: React SPA"
        direction TB
        Index["Entry (src/index.js)"]:::frontend
        FirebaseConfig["Firebase Config (src/firebaseConfig.js)"]:::frontend
        AuthHook["Auth Hook (src/hooks/useAuth.js)"]:::frontend
        Login["Login Component (src/components/Auth/Login.js)"]:::frontend
        ProtectedRoute["ProtectedRoute (src/components/ProtectedRoute.js)"]:::frontend
        Layout["Layout (src/components/Layout/Layout.js)"]:::frontend
        Dashboard["Dashboard (src/components/Dashboard/Dashboard.js)"]:::frontend
        Analytics["Analytics Page (src/pages/Analytics.js)"]:::frontend
        History["Invoice History (src/pages/InvoiceHistory.js)"]:::frontend
        Profile["Profile Page (src/pages/Profile.js)"]:::frontend
    end

    %% Backend functions
    subgraph "Backend: Azure Functions"
        direction TB
        GetURL["Azure Function: getUploadUrl"]:::backend
        ProcessInv["Azure Function: processInvoice"]:::backend
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        BlobStorage["Azure Blob Storage"]:::datastore
        FirestoreDB["Firebase Firestore"]:::datastore
    end

    %% Flows
    User -->|"1. Load SPA"| Index
    Index -->|"2. Init Auth"| FirebaseConfig
    FirebaseConfig --> AuthHook
    AuthHook --> Login
    Login -->|"3. Authenticate"| FirebaseConfig
    Login -->|"4. Route Guard"| ProtectedRoute
    ProtectedRoute --> Layout
    Layout --> Dashboard
    Layout --> Analytics
    Layout --> History
    Layout --> Profile
    Layout -->|"5. Request Upload URL"| GetURL
    GetURL -->|"6. Return Presigned URL"| Layout
    Layout -->|"7. Upload PDF"| BlobStorage
    BlobStorage -->|"8. Blob Trigger"| ProcessInv
    ProcessInv -->|"9. Write Invoice Metadata"| FirestoreDB
    FirestoreDB -->|"10. Query Invoices"| Layout

    %% Click Events
    click Index "https://github.com/vineets46/invoiceflow/blob/main/src/index.js"
    click FirebaseConfig "https://github.com/vineets46/invoiceflow/blob/main/src/firebaseConfig.js"
    click AuthHook "https://github.com/vineets46/invoiceflow/blob/main/src/hooks/useAuth.js"
    click Login "https://github.com/vineets46/invoiceflow/blob/main/src/components/Auth/Login.js"
    click ProtectedRoute "https://github.com/vineets46/invoiceflow/blob/main/src/components/ProtectedRoute.js"
    click Layout "https://github.com/vineets46/invoiceflow/blob/main/src/components/Layout/Layout.js"
    click Dashboard "https://github.com/vineets46/invoiceflow/blob/main/src/components/Dashboard/Dashboard.js"
    click Analytics "https://github.com/vineets46/invoiceflow/blob/main/src/pages/Analytics.js"
    click History "https://github.com/vineets46/invoiceflow/blob/main/src/pages/InvoiceHistory.js"
    click Profile "https://github.com/vineets46/invoiceflow/blob/main/src/pages/Profile.js"
    click GetURL "https://github.com/vineets46/invoiceflow/blob/main/invoiceflow-backend/src/functions/getUploadUrl.js"
    click ProcessInv "https://github.com/vineets46/invoiceflow/blob/main/invoiceflow-backend/src/functions/processInvoice.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000
    classDef backend fill:#90EE90,stroke:#000
    classDef datastore fill:#FFA500,stroke:#000
    classDef external fill:#CCCCCC,stroke:#000
```
