# j7-dev/wp-power-course architecture

> Architecture diagram of the GitHub repository j7-dev/wp-power-course, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/j7-dev/wp-power-course
- Repository: https://github.com/j7-dev/wp-power-course

## Overview

##### Main System Components

a. Frontend Layer:
- Course viewing interface (inc/templates/pages/classroom)
- Product/Course catalog (inc/templates/pages/course-product)
- My Account section (inc/templates/pages/my-account)
- Video player components (multiple providers supported)

b. Admin Layer:
- Course management
- Product management
- Email system
- Media library (Bunny integration)
- Settings and configuration
- Student management

c. Core Components:
- API handlers (inc/classes/Api)
- Resource managers (inc/classes/Resources)
- Template system (inc/classes/Templates)
- Email system (inc/classes/PowerEmail)

##### Key Architectural Elements

a. Data Flow:
**User Interface (React/TypeScript) ↔ WordPress REST API ↔ Core Plugin Logic ↔ Database**

b. Integration Points:
- WooCommerce integration for e-commerce
- Bunny.net for video hosting
- WordPress core integration
- External video providers (YouTube, Vimeo)

**[Frontend Layer]**
- ↑↓
**[WordPress REST API Layer]**
- ↑↓
**[Core Plugin Logic]**
- ↑↓
**[Database Layer]**

**[External Services]**
- Bunny.net
- WooCommerce
- Video Providers

##### Important Relationships to Highlight

- Course-Product relationship
- User-Course access control
- Email trigger system
- Media management flow
- Chapter/Content organization

##### Implementation Details

- Component name
- Key responsibilities
- Integration points
- Data flow direction indicators

Example Component Structure:
**┌─────────────────────┐**
- Course Management   │
- ┤
- Content org      │
- Access control   │
- Progress tracking│
- ┬────────────┘
- ↓
- [Database Layer]

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[User Interface]
        CV["Course Viewer"]
        PC["Product Catalog"]
        MA["My Account"]
        VP["Video Player"]
        FC["Frontend Components"]
    end

    subgraph API
        WPA["WordPress REST API"]
        AH["API Handlers"]
        RM["Resource Managers"]
    end

    subgraph Core
        TS["Template System"]
        ES["Email System"]
        CM["Course Management"]
        PM["Product Management"]
        ML["Media Library"]
        SI["Settings Interface"]
    end

    subgraph External
        BN["Bunny.net"]
        WC["WooCommerce"]
        VP3["Video Providers"]
    end

    subgraph Data
        CD["Course Data"]
        ChM["Chapter Management"]
        SL["Student Logging"]
        CS["Comment System"]
    end

    UI --> CV
    UI --> PC
    UI --> MA
    UI --> VP
    UI --> FC

    CV --> WPA
    PC --> WPA
    MA --> WPA
    VP --> WPA

    WPA --> AH
    AH --> RM

    RM --> TS
    RM --> ES
    RM --> CM
    RM --> PM
    RM --> ML
    RM --> SI

    ML --> BN
    PM --> WC
    VP --> VP3

    CM --> CD
    CM --> ChM
    CM --> SL
    CM --> CS

    %% Click events for component mapping
    click CV "https://github.com/j7-dev/wp-power-course/tree/master/inc/templates/pages/classroom/"
    click PC "https://github.com/j7-dev/wp-power-course/tree/master/inc/templates/pages/course-product/"
    click MA "https://github.com/j7-dev/wp-power-course/tree/master/inc/templates/pages/my-account/"
    click VP "https://github.com/j7-dev/wp-power-course/tree/master/inc/templates/components/video/"
    click CM "https://github.com/j7-dev/wp-power-course/tree/master/js/src/pages/admin/Courses/"
    click PM "https://github.com/j7-dev/wp-power-course/tree/master/js/src/pages/admin/Products/"
    click ES "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/PowerEmail/"
    click ML "https://github.com/j7-dev/wp-power-course/tree/master/js/src/bunny/MediaLibrary/"
    click SI "https://github.com/j7-dev/wp-power-course/tree/master/js/src/pages/admin/Settings/"
    click AH "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Api/"
    click RM "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Resources/"
    click TS "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Templates/"
    click BN "https://github.com/j7-dev/wp-power-course/tree/master/js/src/bunny/"
    click WC "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/BundleProduct/"
    click CD "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Resources/Course/"
    click ChM "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Resources/Chapter/"
    click SL "https://github.com/j7-dev/wp-power-course/tree/master/inc/classes/Resources/StudentLog/"
    click CS "https://github.com/j7-dev/wp-power-course/blob/master/inc/classes/Resources/Comment.php"
    click FC "https://github.com/j7-dev/wp-power-course/tree/master/inc/templates/components/"

    classDef frontend fill:#a8d1ff
    classDef api fill:#90EE90
    classDef core fill:#FFB366
    classDef external fill:#D3D3D3
    classDef data fill:#DDA0DD

    class UI,CV,PC,MA,VP,FC frontend
    class WPA,AH,RM api
    class TS,ES,CM,PM,ML,SI core
    class BN,WC,VP3 external
    class CD,ChM,SL,CS data
```
