# hasanuzzamanbe/buy-me-coffee architecture

> Architecture diagram of the GitHub repository hasanuzzamanbe/buy-me-coffee, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hasanuzzamanbe/buy-me-coffee
- Repository: https://github.com/hasanuzzamanbe/buy-me-coffee

## Overview

##### Main Components Identification
The system should be divided into these primary components:

a) WordPress Integration Layer
- Plugin Core (includes/Classes/)
- Admin Interface (src/js/Components/)
- Public Interface (includes/views/)

b) Payment Processing Layer
- Stripe Integration (includes/Builder/Methods/Stripe/)
- PayPal Integration (includes/Builder/Methods/PayPal/)

c) Data Management Layer
- Database Handling (includes/Models/)
- WP Fluent Integration (includes/libs/wp-fluent/)

##### Component Relationships

**[WordPress Site]**
- ↓
**[Plugin Core]**
- ↓
**[Frontend Layer] ←→ [Payment Processing Layer] ←→ [External Services]**
- ↓                      ↓
**[View Templates] ←→ [Data Management Layer]**

##### Specific Implementation Details

a) Core Components (Rectangle):
- Builder System (includes/Builder/)
- Controllers (includes/Controllers/)
- Models (includes/Models/)

- Stripe API
- PayPal API

c) Interface Components (Rounded Rectangle):
- Vue.js Components (src/js/Components/)
- Editor Blocks (includes/Builder/EditorBlocks/)

##### Data Flow Representation

- User Interaction → Frontend Components
- Frontend → Payment Processors
- Payment Processors → External Services
- Payment Processors → Database Layer

##### Key Technical Elements to Highlight

- Vue.js Components Structure
- Payment Gateway Integration Points
- Database Layer with WP Fluent
- WordPress Hook Integration Points

##### Important Architectural Patterns

- MVC Pattern (Controllers, Models, Views)
- Service-based Architecture (Payment Methods)
- Event-driven Architecture (WordPress Hooks)

##### Customization points

Keep the focus on the payment processing flow as it's the core functionality, but don't neglect the supporting features like reporting and user management.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph WP["WordPress Site"]
        Core["Plugin Core"]
        click Core "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/Classes/"
    end

    subgraph FL["Frontend Layer"]
        AdminUI["Admin Interface"]
        click AdminUI "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/src/js/Components/"
        PublicUI["Public Interface"]
        click PublicUI "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/views/"
        VueAdmin["Vue.js Admin Dashboard"]
        click VueAdmin "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/src/js/Components/Dashboard.vue"
        Reports["Reporting Interface"]
        click Reports "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/src/js/Components/Report.vue"
        PaymentUI["Payment Methods UI"]
        click PaymentUI "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/src/js/PaymentMethods/"
        EditorBlocks["Editor Blocks"]
        click EditorBlocks "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/Builder/EditorBlocks/"
    end

    subgraph PL["Payment Processing Layer"]
        PaymentHandler["Payment Handler"]
        click PaymentHandler "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/includes/Controllers/PaymentHandler.php"
        SubmissionHandler["Submission Handler"]
        click SubmissionHandler "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/includes/Controllers/SubmissionHandler.php"
        
        subgraph PM["Payment Methods"]
            Stripe["Stripe Integration"]
            click Stripe "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/Builder/Methods/Stripe/"
            PayPal["PayPal Integration"]
            click PayPal "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/Builder/Methods/PayPal/"
        end
    end

    subgraph DL["Data Management Layer"]
        DB[(Database)]
        WPFluent["WP Fluent"]
        click WPFluent "https://github.com/hasanuzzamanbe/buy-me-coffee/tree/main/includes/libs/wp-fluent/"
        
        subgraph Models["Data Models"]
            Supporters["Supporter Management"]
            click Supporters "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/includes/Models/Supporters.php"
            Transactions["Transaction Management"]
            click Transactions "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/includes/Models/Transactions.php"
            EmailNotif["Email Notifications"]
            click EmailNotif "https://github.com/hasanuzzamanbe/buy-me-coffee/blob/main/includes/Models/EmailNotifications.php"
        end
    end

    subgraph EX["External Services"]
        StripeAPI["Stripe API"]
        PayPalAPI["PayPal API"]
    end

    %% Core Relationships
    Core --> FL
    Core --> PL
    Core --> DL

    %% Frontend Layer Relationships
    AdminUI --> PaymentHandler
    PublicUI --> PaymentHandler
    VueAdmin --> Reports
    PaymentUI --> SubmissionHandler

    %% Payment Processing Relationships
    PaymentHandler --> PM
    SubmissionHandler --> PM
    Stripe --> StripeAPI
    PayPal --> PayPalAPI
    PM --> Models

    %% Data Management Relationships
    WPFluent --> DB
    Models --> WPFluent

    %% Styling
    classDef wordpress fill:#2271b1,color:white
    classDef frontend fill:#ff6b6b,color:white
    classDef payment fill:#51cf66,color:white
    classDef data fill:#845ef7,color:white
    classDef external fill:#868e96,color:white
    classDef model fill:#339af0,color:white

    class WP wordpress
    class FL,AdminUI,PublicUI,VueAdmin,Reports,PaymentUI,EditorBlocks frontend
    class PL,PaymentHandler,SubmissionHandler,PM,Stripe,PayPal payment
    class DL,DB,WPFluent,Models data
    class EX,StripeAPI,PayPalAPI external
    class Supporters,Transactions,EmailNotif model
```
