# hrishi0102/edufi architecture

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

- Interactive diagram: https://gitdiagram.com/hrishi0102/edufi
- Repository: https://github.com/hrishi0102/edufi

## Overview

##### Main Components
- Frontend: Represent the client-facing application built with Vite/React. This part includes UI components such as pages for loan applications, course matching, and dashboard visualizations. It also integrates external wallet services (using Reown AppKit WalletConnect SDK) and communicates with backend APIs.
- Backend: A Node.js/Express server that contains controllers, routes, services, and configuration files. This component handles business logic, triggers ZK-proof processing, and intermediates between the frontend and blockchain.
- Blockchain/Smart Contracts: Represent the smart contract layer deployed on multiple networks (EduChain and Arbitrum Sepolia). This layer includes the EduFi smart contract (for loans, reputation, etc.) and the ZKVerify contract to confirm zero-knowledge income verifications.
- ZK Proof & Circuit Component: This contains the Circom circuit (incomeProof.circom) and supporting tooling (SnarkJS) to compile, generate, and verify ZK-proofs. It connects with the backend services that invoke proof generation routines.
- IPFS/Decentralized Storage: Although not a separate directory, the system relies on IPFS to store certification data and course completion proofs.
- AI Modules: Although parts of the AI agent and course-matching service are likely integrated within backend services (or may be called as external AI services), it is useful to show them as modules (or microservices) for recommendations and chatbot assistance. They reference external AI frameworks like Gemini 1.5, Coinbase AgentKit, GAIA, and Hyperbolic LLM nodes.

- Backend’s interaction with the blockchain smart contracts. For instance, once a user submits their application (with a generated ZK-proof), the backend communicates with the EduFi and ZKVerify contracts for on-chain verification and storing transaction data.
- Circuit’s role by showing the process flow: “Circuit Compilation → ZK Proof Generation (Circom + SnarkJS)” and then “Proof Submission” to the smart contracts.
- Integration with external wallet services from the frontend, which triggers blockchain interactions.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Differentiate between the frontend, backend, smart contracts, and cryptographic/circuit proof components.
- Secure, Privacy-first Design: Emphasize the ZK-proofs module and blockchain-based storage (immutable verifications, decentralized reputation).

##### Relevant Technologies and Frameworks
- Frontend: Vite, React, Tailwind CSS (and wallet connection via Reown AppKit WalletConnect SDK)
- Backend: Node.js (with Express-style controllers, services, and routes)
- Blockchain: Hardhat for contract development & deployment, EduFi smart contracts (with ZK income verification contracts)
- Zero-Knowledge Tools: Circom, SnarkJS, Groth16 ZK-Proof protocols
- AI Tools: Gemini 1.5, Coinbase AgentKit, GAIA, Hyperbolic LLM

##### Putting It All Together
b. Frontend (React/Vite) interacting with the backend.
c. Backend’s services, controllers, and routes that process user requests.
d. Branch out to show how the backend integrates with:
– The circuit processing (Circom/SnarkJS) for generating ZK proofs.
– The blockchain layer (smart contracts for EduFi, ZKVerify) to manage loan validations and reputation scoring.
– External storage (IPFS) for certification proofs.
– AI services that provide career and course recommendations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["User Browser & Wallet\n(e.g., Reown AppKit WalletConnect)"]:::external
    B["Frontend (Vite/React)"]:::frontend
    C["Backend (Node.js/Express)"]:::backend
    D["ZK Proof & Circuit\n(Circom & SnarkJS)"]:::zk
    E["Blockchain/Smart Contracts\n(EduFi & ZKVerify)"]:::blockchain
    F["IPFS / Decentralized Storage"]:::ipfs
    G["AI Modules\n(Course & Career Matching)"]:::ai

    A -->|"Initiates:LoanApp,WalletConnect"| B
    B -->|"Sends API Requests:LoanApp,MatchQuery,ProofData"| C
    C -->|"Invokes Proof Generation"| D
    D -->|"Submits Proof for On-Chain Verification"| E
    C -->|"Triggers on-chain actions"| E
    C -->|"Uploads Certificates"| F
    C -->|"Requests AI Recommendations"| G

    click B "https://github.com/hrishi0102/edufi/tree/master/frontend/vite-project"
    click C "https://github.com/hrishi0102/edufi/tree/master/backend/"
    click C "https://github.com/hrishi0102/edufi/tree/master/backend/src"
    click D "https://github.com/hrishi0102/edufi/blob/master/circuit/incomeProof.circom"
    click D "https://github.com/hrishi0102/edufi/tree/master/output/"
    click E "https://github.com/hrishi0102/edufi/tree/master/contracts/"
    click G "https://github.com/hrishi0102/edufi/blob/master/backend/src/controllers/agentController.js"
    click G "https://github.com/hrishi0102/edufi/blob/master/backend/src/services/aiService.js"

    classDef external fill:#f9f,stroke:#333,stroke-width:2px
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px
    classDef backend fill:#bfb,stroke:#333,stroke-width:2px
    classDef zk fill:#ffb,stroke:#333,stroke-width:2px
    classDef blockchain fill:#fc9,stroke:#333,stroke-width:2px
    classDef ipfs fill:#cff,stroke:#333,stroke-width:2px
    classDef ai fill:#cfc,stroke:#333,stroke-width:2px
```
