# sushanth-gs-bit/pb_hackathon architecture

> Architecture diagram of the GitHub repository sushanth-gs-bit/pb_hackathon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sushanth-gs-bit/pb_hackathon
- Repository: https://github.com/sushanth-gs-bit/pb_hackathon

## Overview

This is a small Flask academic-certificate demo: users can add records, inspect the chain, verify certificates, check integrity, and simulate tampering. The browser-side script calls Flask endpoints; the Flask handlers validate and process requests using an in-memory blockchain, whose blocks are linked and checked with hashes. The README gives no architectural detail, so the map relies on the shown Flask and JavaScript excerpts; template contents and unsampled frontend behavior are not inferred.

Main entry points: [`blockchain.py`](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/blockchain.py) (Chain management), [`static/script.js`](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/static/script.js) (Client interactions), [`app.py`](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py) (Flask routes), [`templates/index.html`](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/templates/index.html) (Browser interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_browser["Browser interface<br/>[index.html]"]
  node_frontend["Client interactions<br/>[script.js]"]
end

subgraph group_api["Flask API"]
  node_routes["Flask routes<br/>[app.py]"]
  node_record["Record intake<br/>[app.py]"]
  node_certificate["Certificate lookup<br/>[app.py]"]
  node_integrity["Integrity check<br/>[app.py]"]
  node_tamper["Tamper demo<br/>[app.py]"]
end

subgraph group_chain["Blockchain core"]
  node_blockchain[("Chain management<br/>[blockchain.py]")]
  node_block["Block hashing<br/>[blockchain.py]"]
end

node_user(("User"))

node_user -.->|"uses"| node_browser
node_routes -->|"renders"| node_browser
node_frontend -->|"fetches chain"| node_routes
node_frontend -->|"submits record"| node_record
node_frontend -->|"checks certificate"| node_certificate
node_frontend -->|"requests tamper"| node_tamper
node_record -->|"adds record"| node_blockchain
node_certificate -->|"searches chain"| node_blockchain
node_certificate -->|"checks validity"| node_blockchain
node_integrity -->|"checks validity"| node_blockchain
node_tamper -->|"modifies and checks"| node_blockchain
node_routes -->|"reads chain"| node_blockchain
node_blockchain -->|"creates blocks"| node_block
node_block -->|"calculates hash"| node_block

click node_browser "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/templates/index.html"
click node_frontend "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/static/script.js"
click node_routes "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py"
click node_record "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py"
click node_certificate "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py"
click node_integrity "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py"
click node_tamper "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py"
click node_blockchain "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/blockchain.py"
click node_block "https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/blockchain.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_frontend,node_user toneBlue
class node_routes,node_record,node_certificate,node_integrity,node_tamper toneAmber
class node_blockchain,node_block toneMint
```

## Components

### Web interface

- [Browser interface](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/templates/index.html): `templates/index.html`
- [Client interactions](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/static/script.js): `static/script.js`

### Flask API

- [Flask routes](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py): `app.py`
- [Record intake](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py): `app.py`
- [Certificate lookup](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py): `app.py`
- [Integrity check](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py): `app.py`
- [Tamper demo](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/app.py): `app.py`

### Blockchain core

- [Chain management](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/blockchain.py): `blockchain.py`
- [Block hashing](https://github.com/sushanth-gs-bit/pb_hackathon/blob/main/blockchain.py): `blockchain.py`

### Other components

- **User**

## Connections

- User → Browser interface: uses
- Flask routes → Browser interface: renders (evidence: `app.py`)
- Client interactions → Flask routes: fetches chain (evidence: `static/script.js`)
- Client interactions → Record intake: submits record (evidence: `static/script.js`)
- Client interactions → Certificate lookup: checks certificate (evidence: `static/script.js`)
- Client interactions → Tamper demo: requests tamper (evidence: `static/script.js`)
- Record intake → Chain management: adds record (evidence: `app.py`)
- Certificate lookup → Chain management: searches chain (evidence: `app.py`)
- Certificate lookup → Chain management: checks validity (evidence: `app.py`)
- Integrity check → Chain management: checks validity (evidence: `app.py`)
- Tamper demo → Chain management: modifies and checks (evidence: `app.py`)
- Flask routes → Chain management: reads chain (evidence: `app.py`)
- Chain management → Block hashing: creates blocks (evidence: `blockchain.py`)
- Block hashing → Block hashing: calculates hash (evidence: `blockchain.py`)
