# harshalkotkar156/pharmachain architecture

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

- Interactive diagram: https://gitdiagram.com/harshalkotkar156/pharmachain
- Repository: https://github.com/harshalkotkar156/pharmachain

## Overview

##### Main Components
- Blockchain / Smart Contract Layer:
- Contracts are stored in the contracts/ folder.
- Artifacts (the generated build information) reside in the artifacts/ directory.
- Hardhat configuration and the testing environment exist (hardhat.config.js, cache, test/ folder).
- There’s also an Ignition module (in ignition/modules) used for deployment.

- Frontend Application:
- The Frontend/ folder holds a complete React/Vite application.
- It contains assets, components, layouts, a router, and configuration files (e.g., tailwind.config.js, vite.config.js).
- The README in the Frontend directory and structure within src indicate that this part of the system provides the user interface to interact with the underlying blockchain contracts.

##### Relationships and Interactions
- The front end communicates with the blockchain:
- Exploit on-chain interactions by reading from and/or writing to the deployed smart contracts.
- Hardhat serves as the development, testing, and deployment tool for the contracts:
- It compiles, tests, and deploys contracts.
- The ignition module (../ignition/modules/Lock.js) automates the deployment process.
- Artifacts and cache directories track the deployment outcomes and compilation details.
- The test/ suite verifies the correctness and behavior of the contracts.

##### Architectural Patterns & Design Principles
- Separation of Concerns:
- The system is clearly divided into a smart contract backend and a frontend dApp.
- The Frontend folder follows a modular component-based design (React components, layouts, router, etc.), while the contract folder and Hardhat environment handle blockchain logic.
- Development Lifecycle Automation:
- Hardhat and its Ignition module ensure that deployment and testing follow a streamlined pipeline.
- Modern Frontend Framework:
- Use of Vite and TailwindCSS indicates an emphasis on fast development cycles and a responsive UI.

##### Instructing the Principal Software Engineer
- “Frontend Application” block: List components such as “Routing,” “Components,” “Layouts,” and “Assets.” Include a note that this uses Vite, React, and TailwindCSS.
- “Blockchain & Smart Contracts” block: List “Contracts,” “Hardhat Configuration,” “Testing Module,” “Deployment (Ignition Module),” and “Artifacts.”
- From “Frontend Application” to “Blockchain & Smart Contracts” indicating API calls or direct blockchain interactions (e.g., via Web3 or ethers.js).
- Technologies next to each component:
- Within the Frontend block, indicate technologies like React, Vite, TailwindCSS.
- For the blockchain section, indicate Solidity, Hardhat, and Hardhat Ignition.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Blockchain & Smart Contracts Section
    subgraph "Blockchain & Smart Contracts"
        A1["Contracts (Solidity)"]:::blockchain
        A2["Artifacts (Build Info)"]:::blockchain
        subgraph "Hardhat Environment"
            A3["Hardhat Config (hardhat.config.js)"]:::blockchain
            A4["Cache (cache/)"]:::blockchain
            A5["Test Suite (test/)"]:::blockchain
        end
        A6["Deployment Module (Ignition) (Lock.js)"]:::blockchain
    end

    %% Frontend Application Section
    subgraph "Frontend Application"
        B1["Main App & Configurations (React, Vite, TailwindCSS)"]:::frontend
        subgraph "UI Layer"
            B2["Components (Frontend/src/components/)"]:::frontend
            B3["Assets (Frontend/src/assets/)"]:::frontend
        end
        B4["Routing (Frontend/src/router.jsx)"]:::frontend
        B5["Layouts (Frontend/src/layouts/)"]:::frontend
    end

    %% Relationships within Blockchain Layer
    A3 -->|"deploys"| A1
    A4 -->|"supports"| A1
    A5 -->|"tests"| A1
    A6 -->|"deploys"| A1
    A1 -->|"generates"| A2

    %% Interaction from Frontend to Blockchain
    B4 -->|"interacts"| A1
    B1 -->|"configures"| B2

    %% Click Events for Blockchain Layer
    click A1 "https://github.com/harshalkotkar156/pharmachain/tree/main/contracts/"
    click A2 "https://github.com/harshalkotkar156/pharmachain/tree/main/artifacts/"
    click A3 "https://github.com/harshalkotkar156/pharmachain/blob/main/hardhat.config.js"
    click A4 "https://github.com/harshalkotkar156/pharmachain/tree/main/cache/"
    click A5 "https://github.com/harshalkotkar156/pharmachain/tree/main/test/"
    click A6 "https://github.com/harshalkotkar156/pharmachain/blob/main/ignition/modules/Lock.js"

    %% Click Events for Frontend Application
    click B1 "https://github.com/harshalkotkar156/pharmachain/tree/main/Frontend/"
    click B2 "https://github.com/harshalkotkar156/pharmachain/tree/main/Frontend/src/components/"
    click B3 "https://github.com/harshalkotkar156/pharmachain/tree/main/Frontend/src/assets/"
    click B4 "https://github.com/harshalkotkar156/pharmachain/blob/main/Frontend/src/router.jsx"
    click B5 "https://github.com/harshalkotkar156/pharmachain/tree/main/Frontend/src/layouts/"

    %% Styles
    classDef blockchain fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef frontend fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
```
