# suprith-44/hashproof architecture

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

- Interactive diagram: https://gitdiagram.com/suprith-44/hashproof
- Repository: https://github.com/suprith-44/hashproof

## Overview

##### Project Type and Purpose
- HashProof is a full-stack web application for secure evidence handling in crime investigations.
- Frontend: React + Tailwind CSS (in the App/ directory).
- Backend: Flask (Server.py) providing REST APIs.
- Blockchain: MultiChain for immutable storage of case metadata.
- File Storage: IPFS for digital evidence (images, videos).

##### Main Components
a. User Interface (React App)
- Pages: LoginPage, WelcomePage, role-based dashboards (admin, investigator, examiner, officer), logs.
- Assets: public/index.html, Tailwind config.
b. API Layer (Flask server)
- server.py exposes endpoints for authentication, case management, evidence upload, log retrieval.
c. Blockchain Node (MultiChain)
- Permissioned chain storing case metadata and tamper-proof hashes.
d. File Storage Node (IPFS)
- Stores raw evidence; returns content identifiers (CIDs).
e. Role-Based Access Control
- Enforced in backend and MultiChain permissions.

##### Component Relationships and Data Flow
- User → UI: User interacts with React pages.
- UI → Flask: HTTP(S) requests carrying JSON payloads (login, create case, upload evidence).
- Flask → IPFS: On evidence upload, Flask sends file to IPFS; receives CID.
- Flask → MultiChain:
- Writes case metadata + CID into the blockchain.
- Reads audit trail (logs, case history).
- Flask → UI: Returns responses (success, data, error).
- UI ← shows real-time data from backend responses.

##### Architectural Patterns and Principles
- Single Page Application (SPA) pattern in React.
- RESTful API in Flask.
- Separation of concerns: UI, business logic, data storage.
- Immutability and auditability via blockchain.
- External service integration (IPFS, MultiChain).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    User["User Browser"]:::user
    ReactSPA["React SPA"]:::frontend
    FlaskServer["Flask Server"]:::backend
    subgraph "Blockchain & Storage Services"
        IPFSNode["IPFS Node"]:::storage
        MultiChainNode["MultiChain Node"]:::storage
    end

    %% Connections
    User -->|"interacts"| ReactSPA
    ReactSPA -->|"POST /login\nGET /cases\nPOST /uploadEvidence"| FlaskServer
    FlaskServer -->|"stores file"| IPFSNode
    IPFSNode -->|"returns CID"| FlaskServer
    FlaskServer -->|"write/read metadata"| MultiChainNode
    MultiChainNode -->|"returns data"| FlaskServer
    FlaskServer -->|"response"| ReactSPA

    %% Click Events
    click ReactSPA "https://github.com/suprith-44/hashproof/tree/main/App/"
    click FlaskServer "https://github.com/suprith-44/hashproof/blob/main/Server.py"

    %% Styles
    classDef user fill:#DDDDDD,stroke:#333,stroke-width:1px
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFFF99,stroke:#333,stroke-width:1px
```
