# mrpurpleprogrammer/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/mrpurpleprogrammer/portfolio
- Repository: https://github.com/mrpurpleprogrammer/portfolio

## Overview

##### Main Components

a. Frontend Layer:
- React Client Application (in /client)
- Next.js Application (in /next)
- Key UI Components:
- Media Management
- Authentication
- Upload System
- Portfolio Library
- Tutorial Animations

b. Backend Layer:
- Node.js Server (in /server)
- Controllers
- Services
- Models
- Routes
- Middleware

c. Blockchain Layer:
- Smart Contracts (in /dmct)
- Web3 Integration
- DMCT Token System
- IPFS Oracle

d. Storage Layer:
- MongoDB Database (indicated by /data directory)
- IPFS Storage
- Smart Contract Storage

**[Frontend Tier]**
- ↕
**[Backend API Tier]**
- ↕
**[Blockchain & Storage Tier]**
- ↕
**[External Services]**

##### Key Relationships to Highlight

a. Client-Server Communication:
- REST API endpoints
- Authentication flows
- Media upload/download paths

b. Blockchain Integration:
- Smart contract interactions
- Token management
- IPFS storage connections

c. Data Flow:
- Media certification process
- User authentication
- Asset management

##### Specific Implementation Details

a. Frontend Components:
- Separation between React components
- Media management interface
- Authentication flows
- Upload workflow

b. Backend Services:
- Controllers (account, asset, authentication, etc.)
- Service layer architecture
- Model relationships

c. Blockchain Layer:
- Smart contract interaction flow
- DMCT token management
- IPFS integration

##### Additional Elements

- Numbered sequence flows for key processes
- Security boundaries
- Scalability points

##### Media Upload Flow
**User → Upload UI → Backend Validation → IPFS Storage → Smart Contract → Token Minting**

##### Authentication Flow
**User → Auth UI → Backend Auth Service → Database → Token Generation**

##### Media Certification
**Media → Steganography Service → IPFS → Blockchain Verification → DMCT Token**

##### Technical Stack Indicators

- React/Next.js for frontend
- Node.js for backend
- MongoDB for database
- Ethereum for blockchain
- IPFS for decentralized storage

Remember to include:
- System boundaries
- Security zones
- Data flow directions
- API endpoints
- Service interactions
- Storage systems
- External service integrations

This will provide a comprehensive view of the DMCT system while maintaining clarity and usefulness for development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef blockchain fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        ReactApp["React Client App"]:::frontend
        NextApp["Next.js App"]:::frontend
        UIComp["UI Components"]:::frontend
        MediaMgmt["Media Management"]:::frontend
        AuthUI["Authentication UI"]:::frontend
        UploadSys["Upload System"]:::frontend
        Portfolio["Portfolio Library"]:::frontend
        Tutorial["Tutorial Animations"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        NodeServer["Node.js Server"]:::backend
        Controllers["Controllers"]:::backend
        Services["Services"]:::backend
        Models["Models"]:::backend
        Routes["API Routes"]:::backend
        AuthController["Auth Controller"]:::backend
    end

    %% Blockchain Layer
    subgraph Blockchain
        SmartContracts["Smart Contracts"]:::blockchain
        Web3["Web3 Integration"]:::blockchain
        DMCTToken["DMCT Token System"]:::blockchain
        IPFSOracle["IPFS Oracle"]:::blockchain
    end

    %% Storage Layer
    subgraph Storage
        MongoDB[(MongoDB)]:::storage
        IPFS[(IPFS Storage)]:::storage
        ContractStorage[(Smart Contract Storage)]:::storage
    end

    %% Relationships
    ReactApp --> NodeServer
    NextApp --> NodeServer
    UIComp --> NodeServer
    MediaMgmt --> Controllers
    AuthUI --> AuthController
    UploadSys --> Controllers
    
    NodeServer --> Services
    Controllers --> Services
    Services --> Models
    Models --> MongoDB
    
    Services --> SmartContracts
    SmartContracts --> Web3
    Web3 --> DMCTToken
    IPFSOracle --> IPFS
    Services --> IPFS
    DMCTToken --> ContractStorage

    %% Click events
    click ReactApp "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src"
    click NextApp "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/next/portfolio-nextjs"
    click UIComp "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src/components"
    click NodeServer "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/server/src"
    click Controllers "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/server/src/controllers"
    click Services "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/server/src/services"
    click Models "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/server/src/models"
    click Routes "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/server/src/routes"
    click SmartContracts "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/dmct/contracts"
    click Web3 "https://github.com/MrPurpleProgrammer/Portfolio/blob/master/dmct/oracles/web3.js"
    click IPFSOracle "https://github.com/MrPurpleProgrammer/Portfolio/blob/master/dmct/oracles/ipfs.oracle.js"
    click DMCTToken "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/dmct/contracts/DMCT"
    click MongoDB "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/data"
    click AuthController "https://github.com/MrPurpleProgrammer/Portfolio/blob/master/server/src/controllers/authentication.controller.js"
    click MediaMgmt "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src/components/VarsunLibrary/media"
    click UploadSys "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src/scenes/upload"
    click Portfolio "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src/components/PortfolioLibrary"
    click Tutorial "https://github.com/MrPurpleProgrammer/Portfolio/tree/master/client/src/components/PortfolioLibrary/tutorial-animations"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Backend_L["Backend"]:::backend
        Blockchain_L["Blockchain"]:::blockchain
        Storage_L["Storage"]:::storage
        External_L["External Services"]:::external
    end
```
