# humenth/bid_management architecture

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

- Interactive diagram: https://gitdiagram.com/humenth/bid_management
- Repository: https://github.com/humenth/bid_management

## Overview

##### Project type and purpose
- This is a Frappe/ERPNext “app” written in Python and JavaScript. It provides Tender/Bid Management and an EMD (Earnest Money Deposit) Management module built as plugins on top of the Frappe framework.
- Key functionality exposed via custom DocTypes (tender, tender_item, price_bid_opening, query, emd), server-side Python controllers, client-side JS, reports, workspaces, hooks and patches.

##### File structure
- Top-level files: pyproject.toml, hooks.py, install.py, modules.txt, patches.txt → Frappe app metadata and lifecycle.
- `bid_management/` & `emd_management/` directories each contain:
- `doctype/…` definitions (JSON metadata + Python controllers + JS client scripts + tests)
- `report/` (JSON report definitions)
- `doc_events/` (server hooks on document events)
- `patches/` (DB/behavior migration scripts)
- `public/js/` → global client customizations.
- `config/desktop.py` & `config/docs.py` → app integration points in Frappe’s UI and docs.

##### README for additional insights
- Confirms the app’s name (Bid Management), its purpose (Tender/Bid Management), and license (MIT).
- No further architectural notes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser / Frappe Desk UI"]:::frontend

    subgraph "Frappe HTTP Server"
        subgraph "Frappe Core"
            Routing["HTTP/REST API & Routing"]:::core
            DocTypeEngine["DocType Engine (JSON + Python)"]:::core
            ReportEngine["Report Engine"]:::core
            Scheduler["Scheduler & Patches Runner"]:::core
            PublicJS["Global Client-Side JS"]:::core
            Desktop["Desktop Icons/Menu"]:::core
            Docs["In-App Documentation"]:::core
        end

        subgraph "Bid Management Module"
            HooksBM["Routing & Hooks"]:::bidmod
            InstallBM["Install & Setup"]:::bidmod
            ModulesBM["Module Registration"]:::bidmod
            OverridesBM["Overrides Configuration"]:::bidmod

            subgraph "DocTypes"
                TenderJSON["Tender JSON"]:::bidmod
                TenderPy["Tender Python"]:::bidmod
                TenderJS["Tender JS"]:::bidmod
                TenderTest["Tender Test"]:::bidmod
                TenderItemJSON["Tender Item JSON"]:::bidmod
                TenderItemPy["Tender Item Python"]:::bidmod
                PriceBidJSON["Price Bid Opening JSON"]:::bidmod
                PriceBidPy["Price Bid Opening Python"]:::bidmod
                QueryJSON["Query JSON"]:::bidmod
                QueryPy["Query Python"]:::bidmod
            end

            subgraph "Reports"
                ReportTender["Tender Submitted Report"]:::bidmod
            end

            subgraph "Workspace"
                WorkspaceTenders["Tenders Workspace"]:::bidmod
            end
        end

        subgraph "EMD Management Module"
            subgraph "DocTypes"
                EMDJSON["EMD JSON"]:::emdmod
                EMDPy["EMD Python"]:::emdmod
                EMDJS["EMD JS"]:::emdmod
                EMDListJS["EMD List JS"]:::emdmod
                EMDTest["EMD Test"]:::emdmod
            end

            DocEventsEMD["Document Events Hooks"]:::emdmod

            subgraph "Patches"
                PatchEmail["Create Email Template Patch"]:::emdmod
                PatchVoucher["Voucher Options Patch"]:::emdmod
            end
        end
    end

    Database["MariaDB/MySQL"]:::db
    EmailService["External Email Service"]:::external

    Browser -->|"HTTP Request"| Routing
    Routing -->|"routes to"| HooksBM
    HooksBM --> DocTypeEngine
    DocTypeEngine --> Database
    DocTypeEngine -->|"triggers"| DocEventsEMD
    ReportEngine --> Database
    Scheduler --> PatchEmail
    Scheduler --> PatchVoucher
    Scheduler --> EmailService
    InstallBM --> Scheduler
    PublicJS --> Browser
    Desktop --> Browser
    Docs --> Browser

    click Routing "https://github.com/humenth/bid_management/blob/develop/bid_management/hooks.py"
    click InstallBM "https://github.com/humenth/bid_management/blob/develop/bid_management/install.py"
    click ModulesBM "https://github.com/humenth/bid_management/blob/develop/bid_management/modules.txt"
    click OverridesBM "https://github.com/humenth/bid_management/blob/develop/bid_management/overrides.py"
    click TenderJSON "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender/tender.json"
    click TenderPy "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender/tender.py"
    click TenderJS "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender/tender.js"
    click TenderTest "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender/test_tender.py"
    click TenderItemJSON "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender_item/tender_item.json"
    click TenderItemPy "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/tender_item/tender_item.py"
    click PriceBidJSON "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/price_bid_opening/price_bid_opening.json"
    click PriceBidPy "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/price_bid_opening/price_bid_opening.py"
    click QueryJSON "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/query/query.json"
    click QueryPy "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/doctype/query/query.py"
    click ReportTender "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/report/tender_submitted/tender_submitted.json"
    click WorkspaceTenders "https://github.com/humenth/bid_management/blob/develop/bid_management/bid_management/workspace/tenders/tenders.json"
    click EMDJSON "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doctype/emd/emd.json"
    click EMDPy "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doctype/emd/emd.py"
    click EMDJS "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doctype/emd/emd.js"
    click EMDListJS "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doctype/emd/emd_list.js"
    click EMDTest "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doctype/emd/test_emd.py"
    click DocEventsEMD "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/doc_events/journal_entry.py"
    click PatchEmail "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/patches/create_email_template_for_emd.py"
    click PatchVoucher "https://github.com/humenth/bid_management/blob/develop/bid_management/emd_management/patches/voucher_options.py"
    click PublicJS "https://github.com/humenth/bid_management/blob/develop/bid_management/public/js/globally_changes.js"
    click PublicJS "https://github.com/humenth/bid_management/blob/develop/bid_management/public/js/journal_entry.js"
    click Desktop "https://github.com/humenth/bid_management/blob/develop/bid_management/config/desktop.py"
    click Docs "https://github.com/humenth/bid_management/blob/develop/bid_management/config/docs.py"

    classDef frontend fill:#e3f2fd,stroke:#2196f3,color:#0d47a1;
    classDef core fill:#f5f5f5,stroke:#9e9e9e,color:#424242;
    classDef bidmod fill:#e3f2fd,stroke:#2196f3,color:#0d47a1;
    classDef emdmod fill:#e8f5e9,stroke:#4caf50,color:#1b5e20;
    classDef db fill:#ffe0b2,stroke:#fb8c00,color:#e65100;
    classDef external fill:#fff9c4,stroke:#fbc02d,color:#f57f17;
```
