# srmora-ec/propactfront architecture

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

- Interactive diagram: https://gitdiagram.com/srmora-ec/propactfront
- Repository: https://github.com/srmora-ec/propactfront

## Overview

- The Contract Assistant component makes calls to external Gemini and ChatPDF APIs to evaluate contracts.
- Supabase is used for handling user login, contract creation, and exporting contracts.

##### Main Components
a. Frontend Client:
- This includes all the React components found under the /src directory (e.g., login.tsx, contractassistent.tsx, newcontract.tsx, ContractListExport.tsx, dashboar.tsx, navbar.tsx, etc.).
- The UI deals with user interactions, showing loading screens (Loading.js and its associated CSS), navigation, and displaying evaluated contract data.
b. External APIs:
- Gemini API: Invoked from the Contract Assistant component for contract evaluations.
- ChatPDF API: Also called from the Contract Assistant for processing or analyzing contract documents.
c. Backend-as-a-Service – Supabase:
- A dedicated Supabase client (present via supabaseClient.js) is used to manage user authentication, contract creation, and contract export functionalities.

##### Architectural Patterns and Design Principles
- Modular Component Design: Indicate that the application is built with a set of modular components that handle distinct functions, making it simple to extend or modify.
- API Integration: Emphasize the external API integration pattern where specific components (the Contract Assistant) isolate the logic for calling Gemini and ChatPDF.
- BaaS Abstraction: Show that Supabase is utilized as a backend service providing authentication, database, and export functionalities, abstracting traditional backend development.

##### Relevant Technologies and Tools
- React (through Create React App) as the core framework for building the UI.
- TypeScript (use of .tsx files) and JavaScript files.
- External services: Gemini API, ChatPDF API.
- Supabase as the backend service.
- Tailwind CSS (as indicated by tailwind.config.js) for styling.
- Vite (as seen in vite.config.js) which may indicate advantages in build performance.

##### Detailed Schematic Outline
- At the top level, include an “End User / Browser” block that interacts with the “React Frontend Application” block.
- Within the React Frontend, break down subcomponents such as:
- Navigation Bar (navbar.tsx)
- To the side or below, include external blocks for “Gemini API”, “ChatPDF API”, and “Supabase Backend”.
- Use connectors that show that the UI not only sends data requests but also receives data and updates in response to user interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser("End User / Browser"):::frontend

    subgraph "React Frontend Application"
        ReactFrontend("React Frontend Application"):::frontend
        Navbar("Navigation Bar (Navbar)"):::frontend
        Login("Login/Authentication Component"):::frontend
        ContractAssistant("Contract Assistant (External API Calls)"):::frontend
        NewContract("New Contract"):::frontend
        ContractListExport("Contract List & Export"):::frontend
        Loading("Loading Component"):::frontend
        LoadingCSS("Loading Styling"):::frontend
    end

    GeminiAPI("Gemini API"):::api
    ChatPDFAPI("ChatPDF API"):::api
    Supabase("Supabase Backend"):::backend

    %% Connections
    Browser --> ReactFrontend
    ReactFrontend --> Navbar
    ReactFrontend --> Login
    ReactFrontend --> ContractAssistant
    ReactFrontend --> NewContract
    ReactFrontend --> ContractListExport
    ReactFrontend --> Loading
    ReactFrontend --> LoadingCSS

    Login -->|"AuthRequest"| Supabase
    NewContract <-->|"CRUD"| Supabase
    ContractListExport <-->|"CRUD"| Supabase

    ContractAssistant -->|"EvaluateContractData"| GeminiAPI
    ContractAssistant -->|"EvaluateContractData"| ChatPDFAPI

    %% Click Events
    click ReactFrontend "https://github.com/srmora-ec/propactfront/tree/master//src"
    click Navbar "https://github.com/srmora-ec/propactfront/blob/master//src/components/navbar.tsx"
    click Login "https://github.com/srmora-ec/propactfront/blob/master//src/components/login.tsx"
    click ContractAssistant "https://github.com/srmora-ec/propactfront/blob/master//src/components/contractassistent.tsx"
    click NewContract "https://github.com/srmora-ec/propactfront/blob/master//src/components/newcontract.tsx"
    click ContractListExport "https://github.com/srmora-ec/propactfront/blob/master//src/components/ContractListExport.tsx"
    click Loading "https://github.com/srmora-ec/propactfront/blob/master//src/components/Loading.js"
    click LoadingCSS "https://github.com/srmora-ec/propactfront/blob/master//src/components/LoadingScreen.css"
    click Supabase "https://github.com/srmora-ec/propactfront/blob/master//src/components/supabaseClient.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef api fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef backend fill:#FFA500,stroke:#000,stroke-width:2px;
```
