# jaypopat/eduverse-turbo architecture

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

- Interactive diagram: https://gitdiagram.com/jaypopat/eduverse-turbo
- Repository: https://github.com/jaypopat/eduverse-turbo

## Overview

##### Main Components
- Web Application (apps/web): This is the frontend component built with React/TypeScript (note the many .tsx components and Vite configuration). It likely handles user interaction, routing, and displays both “contract” and “metaverse” sections.
- Backend Service (apps/backend): This Node.js/TypeScript service (using Bun) implements APIs, handles authentication, and manages features like metaverse logic and uploads to IPFS. It contains modules, routes, and utilities.
- Smart Contract Component (apps/contract): Written in Rust (Cargo files and lib.rs) this part encapsulates on-chain contracts, likely for managing course management or similar business logic.
- Shared Packages:
- packages/contract-instance: Provides artifacts and scripts to interact with the smart contract.
- packages/eslint-config: Contains shared ESLint configuration.
- packages/typescript-config: Provides common TypeScript settings for the apps.
- Turborepo Configuration (turbo.json): Oversees task running and build caching among the apps and packages.
- Supporting Configuration (e.g., .gitignore, bun.lockb, package.json files): These items are present across apps and packages to standardize project structure and tooling.

##### Relationships and Interactions
- The Web Application should be depicted as the primary client that interacts with:
- The Backend Service via REST/WebSocket API calls for data and authentication.
- The Smart Contract indirectly through the contract-instance package (or possibly directly via browser-based blockchain interactions).
- The Backend Service interacts with both:
- Frontend clients (handling requests, sessions, and real-time features via specific routes such as metaverse-ws).
- External services (e.g., IPFS integration for uploads).
- The Smart Contract component is represented as an isolated module (possibly off-chain) that the backend (and/or frontend via shared packages) interacts with using defined artifacts and APIs.
- Shared packages are utilities/config libraries used across both the web and backend apps to ensure consistency in code quality and contract interactions.

##### Architectural Patterns
- Monorepo Design via Turborepo: Emphasize that the system uses a turborepo structure that coordinates builds, caching, and development across diverse apps and packages.
- Separation of Concerns: Clearly delineate the frontend, backend, and blockchain (contract) components. This includes modularizing configuration (ESLint/TypeScript) and shared logic (contract-instance package).
- API/Service Layer: Show directional flows between frontend (user interface) and backend (API services), as well as communication between backend and the smart contract.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        webapp["Web frontend (React/Vite)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        backend["Backend API (Node/Bun + TypeScript)"]:::backend
    end

    %% Blockchain/Smart Contract Layer
    subgraph "Blockchain"
        contract["Smart Contract (Rust/Cargo)"]:::blockchain
    end

    %% Shared Packages
    subgraph "Shared Packages"
        contractPkg["Contract Interaction Package"]:::package
        eslint["Shared ESLint Config"]:::package
        tsConfig["Shared TypeScript Config"]:::package
    end

    %% Tooling
    subgraph "Tooling"
        turborepo["Turborepo Configuration"]:::tooling
    end

    %% External Services
    subgraph "External Services"
        ipfs["IPFS Service"]:::external
    end

    %% Connections
    webapp -->|"API-call"| backend
    backend -->|"Uploads"| ipfs
    backend -->|"Blockchain-calls"| contract
    webapp -->|"Uses"| contractPkg
    contractPkg -->|"Interfaces"| contract
    backend -->|"Uses"| contractPkg
    webapp -->|"UsesConfig"| eslint
    backend -->|"UsesConfig"| eslint
    webapp -->|"UsesConfig"| tsConfig
    backend -->|"UsesConfig"| tsConfig
    turborepo -.->|"Manages"| webapp
    turborepo -.->|"Manages"| backend
    turborepo -.->|"Manages"| contract
    turborepo -.->|"Manages"| contractPkg

    %% Click Events
    click webapp "https://github.com/jaypopat/eduverse-turbo/tree/main/apps/web"
    click backend "https://github.com/jaypopat/eduverse-turbo/tree/main/apps/backend"
    click contract "https://github.com/jaypopat/eduverse-turbo/tree/main/apps/contract"
    click contractPkg "https://github.com/jaypopat/eduverse-turbo/tree/main/packages/contract-instance"
    click eslint "https://github.com/jaypopat/eduverse-turbo/tree/main/packages/eslint-config"
    click tsConfig "https://github.com/jaypopat/eduverse-turbo/tree/main/packages/typescript-config"
    click turborepo "https://github.com/jaypopat/eduverse-turbo/blob/main/turbo.json"

    %% Styles
    classDef frontend fill:#f9c,stroke:#000,stroke-width:2px;
    classDef backend fill:#ccf,stroke:#000,stroke-width:2px;
    classDef blockchain fill:#cfc,stroke:#000,stroke-width:2px;
    classDef package fill:#fc9,stroke:#000,stroke-width:2px;
    classDef tooling fill:#9cf,stroke:#000,stroke-width:2px;
    classDef external fill:#ffc,stroke:#000,stroke-width:2px;
```
