# harish2704/upi-qr-code-from-bank-details architecture

> Architecture diagram of the GitHub repository harish2704/upi-qr-code-from-bank-details, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harish2704/upi-qr-code-from-bank-details
- Repository: https://github.com/harish2704/upi-qr-code-from-bank-details

## Overview

##### Project type and purpose
- This is a static, single‐page web application (SPA) that runs entirely in the browser.
- Purpose: take user‐entered bank details, build a UPI payment URI, generate a QR code and shareable link—all on the client side.
- No backend or server‐side logic; it is hosted on GitHub Pages and pulls CSS/JS libraries from CDNs.

##### File structure
- Top level files only:
- index.html – the SPA entry point
- README.md – project description
- LICENSE
- There are no “frontend” vs “backend” folders, since everything is in one HTML file.
- Dependencies are loaded via `<script>` and `<link>` tags: unpkg.com (for JS libraries) and Milligram CSS.

##### Extract key insights from the README
- The tool:
1. Generates a UPI ID from bank account details.
2. Creates a QR code image (using node-qrcode library in the browser).
3. Constructs a shareable URL with all parameters serialized into the URL hash (no data is sent to any server).
4. Uses URL schemes (upi://) to launch UPI apps on mobile.
- No server-side data storage; all processing is client-side.

##### Main components
a. User’s Web Browser (SPA)
- UI layer (HTML + Milligram CSS)
- JS logic: form parsing → build UPI URI → update URL hash
- QR Code module (node-qrcode loaded from unpkg)
- Hash-based routing/storage (no server calls)
- UPI URL scheme invocation (upi://pay?...)
b. Static Hosting (GitHub Pages)
- Serves index.html, README.md, LICENSE
c. External CDNs
- unpkg.com (node-qrcode, any other packages)
- Milligram.io (CSS)
d. External UPI App
- Invoked by the browser via custom URL scheme

##### Relationships & Interactions
- Browser requests index.html (and associated CSS/JS) from GitHub Pages.
- Browser also fetches CSS and JS libraries from unpkg.com and milligram.io.
- User enters bank details into the SPA form.
- In-browser JS constructs UPI URI and serializes data into window.location.hash.
- QR generator module produces a canvas/png QR code.
- SPA updates the DOM to show QR and shareable link.
- When the link is clicked on a mobile device, the UPI payment app is launched via the upi:// URI.

##### Architectural patterns & design principles
- Client-side SPA: all logic runs in the browser.
- Hash-based routing/data storage: no HTTP API calls for user data.
- Dependency injection via CDN: reduces project weight, no local package management.

##### Final recommendations
- Data flow: user input → UPI URI → hashed URL → QR code.
- Fact that no data ever leaves the browser beyond the UPI app invocation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User’s Web Browser" 
        direction TB
        UI["HTML/CSS UI"]:::browser
        Form["Form Handler"]:::browser
        UPI["UPI URI Builder"]:::browser
        QR["QR Code Generator"]:::browser
        Hash["Hash Storage"]:::browser
    end

    Static["GitHub Pages\n(Static Hosting)"]:::external
    CDN["CDN Providers\n(node-qrcode, Milligram)"]:::external
    UPIApp["External UPI App"]:::external

    README["README.md"]:::file
    LICENSE["LICENSE"]:::file

    Static -->|serves index.html| UI
    Static -->|serves README.md| README
    Static -->|serves LICENSE| LICENSE
    CDN -->|loads CSS/JS| UI
    UI -->|user input| Form
    Form -->|parsed data| UPI
    UPI -->|build upi:// URI| Hash
    UPI -->|generate QR data| QR
    Hash -->|update URL hash| UI
    QR -->|render QR code| UI
    UI -->|click link| UPIApp

    click UI "https://github.com/harish2704/upi-qr-code-from-bank-details/blob/main/index.html"
    click README "https://github.com/harish2704/upi-qr-code-from-bank-details/blob/main/README.md"
    click LICENSE "https://github.com/harish2704/upi-qr-code-from-bank-details/tree/main/LICENSE"

    classDef browser fill:#E0F7FA,stroke:#006064,color:#004D40;
    classDef external fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20;
    classDef file fill:#FFF8E1,stroke:#FF6F00,color:#E65100;
```
