# nicholastsk/educhain architecture

> Architecture diagram of the GitHub repository nicholastsk/educhain, 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/nicholastsk/educhain
- Repository: https://github.com/nicholastsk/educhain

## Overview

##### Main Components
- Frontend (educhain-frontend):
- Built with React.js.
- Contains the core UI logic (App.js) and the contract ABI (EduChainABI.json) for interacting with Ethereum-based smart contracts.
- Handles interactions like course enrollment, assignment submissions, and certificate verifications.
- Backend (educhain-backend):
- Built with Node.js and Express.
- Serves as the API layer interfacing between the frontend and deployed smart contracts.
- The main entry (index.js) defines routes and controllers to process business logic and smart contract interactions.
- Smart Contracts:
- EduChain.sol for managing course creation/enrollment.
- EduCert.sol for issuing NFT-based certificates.
- These contracts represent the decentralized logic of the platform and need integration into both the frontend and the backend.
- External Services/Integrations:
- MetaMask for Ethereum blockchain interactions.
- Remix IDE for contract deployment as noted in the README.

##### Diagramming the Architectural Relationships
- Frontend (React.js), labeled with "User Interface & Smart Contract Integration" along with specific files like App.js and EduChainABI.json.
- Backend (Node.js + Express) with clear labeling for API endpoints in index.js.
- Smart Contracts (EduChain.sol and EduCert.sol) housed on the Ethereum blockchain.
- Link these components:

##### Architectural Patterns and Design Principles
- Separation of concerns:
- The React.js-based frontend handles user interaction and smart contract calls via MetaMask.
- The Node.js backend abstracts the blockchain interactions (e.g., by interfacing with the contracts) and provides APIs.
- The blockchain and smart contracts encapsulate the business logic for course management and NFT certification.
- Decentralized logic pattern, where the smart contracts maintain integrity and trust independently on the Ethereum network.

##### Relevant Technologies
- Frontend: React.js, Web3.js (or ethers.js, if used), MetaMask.
- Backend: Node.js, Express, npm modules.
- Blockchain: Ethereum, MetaMask integration.
- Smart Contracts: Solidity (EduChain.sol and EduCert.sol).

- Additionally, add a branch from the Frontend to MetaMask illustrating “Wallet & Transaction Signing.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (React)"
        A1("App.js"):::frontend
        A2("EduChainABI.json"):::frontend
    end

    subgraph "Backend (Node.js + Express)"
        B1("index.js"):::backend
    end

    subgraph "Smart Contracts (Solidity)"
        S1("EduChain.sol"):::contract
        S2("EduCert.sol"):::contract
    end

    MM("MetaMask"):::external
    RI("Remix IDE"):::external

    %% Connections
    A1 -->|"API_Calls"| B1
    A2 -->|"API_Calls"| B1
    B1 -->|"Contract_Interaction"| S1
    B1 -->|"Contract_Interaction"| S2
    A1 -->|"Wallet&TxSigning"| MM
    RI -->|"Deployment"| S1
    RI -->|"Deployment"| S2

    %% Click Events
    click A1 "https://github.com/nicholastsk/educhain/blob/main/educhain-frontend/App.js"
    click A2 "https://github.com/nicholastsk/educhain/blob/main/educhain-frontend/EduChainABI.json"
    click B1 "https://github.com/nicholastsk/educhain/blob/main/educhain-backend/index.js"

    %% Styles
    classDef frontend fill:#A7E8BD,stroke:#333,stroke-width:2px;
    classDef backend fill:#9FBFF2,stroke:#333,stroke-width:2px;
    classDef contract fill:#F49AC2,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
```
