# berru-g/3dscrollanimator architecture

> Architecture diagram of the GitHub repository berru-g/3dscrollanimator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/berru-g/3dscrollanimator
- Repository: https://github.com/berru-g/3dscrollanimator

## Overview

##### Project type and purpose
- this is a full-stack monolithic PHP web application with a no-code 3D scroll-animation builder on the front end (Three.js + vanilla JS/CSS/HTML) and a PHP+MySQL backend for user/project management, gamification, notifications, and payment integration.

##### Main components
A. Front-end client (Browser)
- Static landing page (index.html + style.css + scriptV2.js)
- App UI pages (PHP views: header.php, footer.php, dashboard.php, project.php, etc.)
- Three.js animation engine (V2script.js, cursor.js, scriptV2.js)
- Model assets (model3D/*.glb), images (img/), sounds (sounds/)
B. Backend application (PHP monolith)
- Controllers / endpoints: auth.php, register.php, login.php, search_ajax.php, mark_all_read.php, export_transactions.php, purchase_points.php, etc.
- Business logic classes: NotificationManager.php, PointsManager.php, RewardSystem.php
- Admin interfaces: admin.php, admin2.php, setup_beta_testers.php
- Debug utilities: debug.php, test-path.php
C. Data storage
- Relational database (MySQL) defined via database.sql
- File storage for user uploads (uploads/avatars)
D. External services and integrations
- Payment gateways: Stripe (via PHP), Solana Pay (web3/solana-payment.js, solana-payement-without-dependance.js)
- Crypto-price lookup service (web3/crypto-price-service.js)
- Third-party APIs for payment keys (Lemon API upcoming)
- CodePen export endpoint (frontend JavaScript packaging HTML/CSS/JS)

##### Relationships and data flows
1. User → Browser UI
2. Browser UI → PHP endpoints (over HTTP/S)
- Authentication, registration, project CRUD, points purchase, notifications, history
3. PHP application ↔ MySQL
- read/write user, project, transaction, notification, points tables
4. PHP application → File system
- store/retrieve avatars, exported packages, 3D models, logs
5. PHP application → External payment APIs
- initiate charges (Stripe REST API, Solana Pay RPC calls, future Lemon)
6. Browser UI (Three.js) loads 3D models and sync animations to scroll percentage
7. Export feature bundles UI + Three.js + assets into standalone package or CodePen

##### Architectural patterns and design principles
- MVC-style separation:
- Models (NotificationManager, PointsManager, RewardSystem)
- Views (PHP templates: header, footer, project builder)
- Controllers (auth.php, project.php, etc.)
- Monolithic deployment: single PHP server hosting both landing and app
- Layered design: Presentation → Business Logic → Data Access
- Gamification module (points/rewards) plugged into core user flows
- Extensible payment layer allowing multiple gateways (Stripe, Solana, future Lemon)
- “No-code” export module packaging front-end assets for external hosting

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client-side (Frontend)
    subgraph "Client-side (Browser)"
        direction TB
        Browser["Browser"]:::frontend
        subgraph "Landing Page" 
            direction TB
            Index["index.html"]:::frontend
            StyleCSS["style.css"]:::frontend
            ScriptV2["scriptV2.js"]:::frontend
            V2Style["V2style.css"]:::frontend
            V2Script["V2script.js"]:::frontend
        end
        subgraph "App UI Pages (PHP Views)"
            direction TB
            Header["header.php"]:::frontend
            Footer["footer.php"]:::frontend
            HeaderNotif["headerNotif.php"]:::frontend
            Dashboard["dashboard.php"]:::frontend
            ProjectPage["project.php"]:::frontend
            Projects["projects.php"]:::frontend
            Gallery["gallery.php"]:::frontend
            History["history.php"]:::frontend
            Contact["contact.php"]:::frontend
            LoginPage["login.php"]:::frontend
            RegisterPage["register.php"]:::frontend
            UserProfile["user_profile.php"]:::frontend
            Tarif["tarif.php"]:::frontend
        end
        subgraph "Three.js Animation Engine"
            direction TB
            ThreeJS1["V2script.js"]:::frontend
            ThreeJS2["scriptV2.js"]:::frontend
        end
        subgraph "Assets"
            direction TB
            Models["3D Models (.glb)"]:::frontend
            Images["Images (img/)"]:::frontend
            Sounds["Sounds (sounds/)"]:::frontend
        end
        Exporter["Export Module"]:::frontend
    end

    %% Backend (PHP Monolith)
    subgraph "Backend (PHP App)"
        direction TB
        subgraph "Controllers / Endpoints"
            Auth["auth.php"]:::backend
            Register["register.php"]:::backend
            Login["login.php"]:::backend
            SearchAJAX["search_ajax.php"]:::backend
            MarkRead["mark_all_read.php"]:::backend
            ExportTrans["export_transactions.php"]:::backend
            PurchasePts["purchase_points.php"]:::backend
            SetupBeta["setup_beta_testers.php"]:::backend
            Admin1["admin.php"]:::backend
            Admin2["admin2.php"]:::backend
        end
        subgraph "Business Logic"
            NotificationMgr["NotificationManager.php"]:::backend
            PointsMgr["PointsManager.php"]:::backend
            RewardSys["RewardSystem.php"]:::backend
        end
        subgraph "Debug Utilities"
            Debug1["debug.php"]:::backend
            TestPath["test-path.php"]:::backend
            RootDebug["debug.php (root)"]:::backend
        end
    end

    %% Data Storage
    subgraph "Data Storage"
        direction TB
        DB[(MySQL Database)]:::storage
        FileStore["File Storage (uploads/avatars)"]:::storage
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Stripe["Stripe API"]:::external
        SolanaPay["Solana Pay"]:::external
        Lemon["Lemon API (future)"]:::external
        CryptoPrice["Crypto-price Service"]:::external
        CodePen["CodePen API"]:::external
    end

    %% Relationships
    Browser -->|loads| Index
    Browser -->|navigates| Header
    Browser -->|navigates| Dashboard
    Browser -->|runs| ThreeJS1
    Browser -->|runs| ThreeJS2
    ThreeJS1 -->|loads models| Models
    ThreeJS2 -->|loads models| Models
    Browser -->|click export| Exporter
    Exporter -->|packages assets| Models
    Exporter --> CodePen

    %% HTTP Requests
    Header -->|HTTP/S| Auth
    LoginPage -->|HTTP/S| Login
    RegisterPage -->|HTTP/S| Register
    Dashboard -->|HTTP/S| SearchAJAX
    Dashboard -->|HTTP/S| MarkRead
    History -->|HTTP/S| ExportTrans
    Tarif -->|HTTP/S| PurchasePts
    SetupBeta -->|HTTP/S| SetupBeta
    Admin1 -->|HTTP/S| Admin1
    Admin2 -->|HTTP/S| Admin2

    %% Backend to Storage
    Auth -->|SQL queries| DB
    Register -->|SQL queries| DB
    Login -->|SQL queries| DB
    SearchAJAX -->|SQL queries| DB
    PurchasePts -->|writes| DB
    ExportTrans -->|reads| DB
    Auth -->|reads/writes avatars| FileStore

    %% Backend to Business Logic
    Auth --> NotificationMgr
    PurchasePts --> PointsMgr
    PurchasePts --> RewardSys

    %% Backend to External
    PurchasePts -->|REST API| Stripe
    PurchasePts -->|RPC calls| SolanaPay
    PurchasePts -->|REST API| Lemon
    Dashboard -->|fetch price| CryptoPrice

    %% Styling classes
    classDef frontend fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef backend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef storage fill:#ffe5cc,stroke:#333,stroke-width:1px
    classDef external fill:#e0e0e0,stroke:#333,stroke-width:1px

    %% Click events
    click Index "https://github.com/berru-g/3dscrollanimator/blob/main/index.html"
    click StyleCSS "https://github.com/berru-g/3dscrollanimator/blob/main/app/style.css"
    click ScriptV2 "https://github.com/berru-g/3dscrollanimator/blob/main/app/scriptV2.js"
    click V2Style "https://github.com/berru-g/3dscrollanimator/blob/main/app/V2style.css"
    click V2Script "https://github.com/berru-g/3dscrollanimator/blob/main/app/V2script.js"
    click Header "https://github.com/berru-g/3dscrollanimator/blob/main/app/header.php"
    click Footer "https://github.com/berru-g/3dscrollanimator/blob/main/app/footer.php"
    click HeaderNotif "https://github.com/berru-g/3dscrollanimator/blob/main/app/headerNotif.php"
    click Dashboard "https://github.com/berru-g/3dscrollanimator/blob/main/app/dashboard.php"
    click ProjectPage "https://github.com/berru-g/3dscrollanimator/blob/main/app/project.php"
    click Projects "https://github.com/berru-g/3dscrollanimator/blob/main/app/projects.php"
    click Gallery "https://github.com/berru-g/3dscrollanimator/blob/main/app/gallery.php"
    click History "https://github.com/berru-g/3dscrollanimator/blob/main/app/history.php"
    click Contact "https://github.com/berru-g/3dscrollanimator/blob/main/app/contact.php"
    click LoginPage "https://github.com/berru-g/3dscrollanimator/blob/main/app/login.php"
    click RegisterPage "https://github.com/berru-g/3dscrollanimator/blob/main/app/register.php"
    click UserProfile "https://github.com/berru-g/3dscrollanimator/blob/main/app/user_profile.php"
    click Tarif "https://github.com/berru-g/3dscrollanimator/blob/main/app/tarif.php"
    click ThreeJS1 "https://github.com/berru-g/3dscrollanimator/blob/main/app/V2script.js"
    click ThreeJS2 "https://github.com/berru-g/3dscrollanimator/blob/main/app/scriptV2.js"
    click Auth "https://github.com/berru-g/3dscrollanimator/blob/main/app/auth.php"
    click Register "https://github.com/berru-g/3dscrollanimator/blob/main/app/register.php"
    click Login "https://github.com/berru-g/3dscrollanimator/blob/main/app/login.php"
    click SearchAJAX "https://github.com/berru-g/3dscrollanimator/blob/main/app/search_ajax.php"
    click MarkRead "https://github.com/berru-g/3dscrollanimator/blob/main/app/mark_all_read.php"
    click ExportTrans "https://github.com/berru-g/3dscrollanimator/blob/main/app/export_transactions.php"
    click PurchasePts "https://github.com/berru-g/3dscrollanimator/blob/main/app/purchase_points.php"
    click SetupBeta "https://github.com/berru-g/3dscrollanimator/blob/main/app/setup_beta_testers.php"
    click Admin1 "https://github.com/berru-g/3dscrollanimator/blob/main/app/admin.php"
    click Admin2 "https://github.com/berru-g/3dscrollanimator/blob/main/app/admin2.php"
    click NotificationMgr "https://github.com/berru-g/3dscrollanimator/blob/main/app/NotificationManager.php"
    click PointsMgr "https://github.com/berru-g/3dscrollanimator/blob/main/app/PointsManager.php"
    click RewardSys "https://github.com/berru-g/3dscrollanimator/blob/main/app/RewardSystem.php"
    click Debug1 "https://github.com/berru-g/3dscrollanimator/blob/main/app/debug.php"
    click TestPath "https://github.com/berru-g/3dscrollanimator/blob/main/app/test-path.php"
    click RootDebug "https://github.com/berru-g/3dscrollanimator/blob/main/debug.php"
    click DB "https://github.com/berru-g/3dscrollanimator/blob/main/app/database.sql"
    click FileStore "https://github.com/berru-g/3dscrollanimator/tree/main/uploads/avatars"
    click SolanaPay "https://github.com/berru-g/3dscrollanimator/blob/main/web3/solana-payment.js"
    click CryptoPrice "https://github.com/berru-g/3dscrollanimator/blob/main/web3/crypto-price-service.js"
```
