# allyssonharry/wp-graphql-headless-login architecture

> Architecture diagram of the GitHub repository allyssonharry/wp-graphql-headless-login, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allyssonharry/wp-graphql-headless-login
- Repository: https://github.com/allyssonharry/wp-graphql-headless-login

## Overview

##### And Define the Main Components
- WordPress Environment – Represent the core WordPress site into which the plugin is installed. Include WPGraphQL as a central component that exposes the GraphQL endpoints.
- Plugin Bootstrapping – Include core files such as activation.php and deactivation.php that manage plugin lifecycle.
- GraphQL API / Mutations – In the “src” directory you see key folders (Auth, Mutation, Model, Type, etc.). Show a block representing the “GraphQL Authentication API Layer” that processes login mutations, token refreshes, revocations, and linking of user identities.
- Authentication Providers – Detail the “Auth/ProviderConfig” modules (and submodules for Facebook, GitHub, Google, etc.) which handle various authentication flows (OAuth2, Password, JWT, etc.). Indicate that these are pluggable and extensible.
- Admin UI (Configuration Panel) – In the “packages/admin” and “src/Admin” directories, there is a React-based admin panel interface. Represent this as the “Admin Settings/Configuration Dashboard” that allows users (e.g., administrators) to manage authentication settings.
- Utility & Helper Modules – Include support for common utilities (in “src/Utils” and “vendor” libraries) that handle JWT, HTTP requests (using Guzzle), and OAuth libraries.

##### Architectural Patterns and Design Principles
- Modular and Extensible Architecture – The authentication process is modular with separate provider configurations (using “ProviderConfig” classes). Emphasize how new providers can easily be added.
○ Presentation Layer (Admin UI built with React/TypeScript),
○ Business Logic (GraphQL Mutations and Authentication Logic in “src/Mutation” and “src/Auth”),
○ Data Model (User and Client models in “src/Model”).
- Integration with WordPress - Note how the plugin hooks into the WordPress environment (using activation hooks, filters, and actions) to extend WPGraphQL.
- Use of External Libraries – Clearly denote integration with third-party libraries (OAuth2 libraries, Guzzle, Firebase/php-jwt and others listed under vendor) that enable critical functionality.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    A("Client Login Request"):::external

    %% Main WordPress Environment
    B("WordPress Plugin Core"):::plugin

    %% Subgraph for WordPress Plugin Core Components
    subgraph "WordPress Plugin Core Components"
        direction TB
        %% Plugin Bootstrapping
        B1("Plugin Bootstrapping"):::plugin
        B1a("activation.php"):::plugin
        B1b("deactivation.php"):::plugin
        %% GraphQL API & Authentication Layer
        B2("GraphQL API & Authentication Layer"):::logic
        B2a("Authentication Mutations (src/Mutation)"):::logic
        B2b("Core Auth Processes (src/Auth)"):::logic
        B2c("Data Models (src/Model)"):::logic
        B2d("GraphQL Types (src/Type)"):::logic
        %% Authentication Providers
        B3("Authentication Providers (src/Auth/ProviderConfig)"):::logic
        %% Admin UI
        B4("Admin Settings Dashboard (Admin UI)"):::ui
        B4a("React Admin (packages/admin)"):::ui
        B4b("Admin Settings Logic (src/Admin)"):::ui
        %% Utility & Helper Modules
        B5("Utility & Helper Modules"):::helper
        B5a("Utils & Vendor Libs (src/Utils)"):::helper
    end

    %% External Services
    C("External Auth Services"):::external

    %% Testing & Development Tools
    D("Testing & Dev Tools"):::dev

    %% Data Flow Connections
    A -->|"loginRequest"| B2a
    B --> B1
    B1 --> B1a
    B1 --> B1b
    B1 -->|"init"| B2
    B2 --> B2a
    B2 --> B2b
    B2 --> B2c
    B2 --> B2d
    B2a -->|"validate"| B3
    B3 -->|"authResponse"| B2b
    B4 -->|"configUpdate"| B2b
    B4 --> B4a
    B4 --> B4b
    B3 -->|"externalAuth"| C
    B5 --> B5a
    B5a --> C
    D --> B

    %% Click Events
    click B "https://github.com/allyssonharry/wp-graphql-headless-login/blob/develop/wp-graphql-headless-login.php"
    click B1a "https://github.com/allyssonharry/wp-graphql-headless-login/blob/develop/activation.php"
    click B1b "https://github.com/allyssonharry/wp-graphql-headless-login/blob/develop/deactivation.php"
    click B2a "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Mutation"
    click B2b "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Auth"
    click B2c "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Model"
    click B2d "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Type"
    click B3 "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Auth/ProviderConfig"
    click B4a "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/packages/admin"
    click B4b "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Admin"
    click B5a "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/src/Utils"
    click D "https://github.com/allyssonharry/wp-graphql-headless-login/tree/develop/tests"

    %% Styles
    classDef plugin fill:#f9f,stroke:#333,stroke-width:2px;
    classDef logic fill:#bbf,stroke:#333,stroke-width:2px;
    classDef ui fill:#bfb,stroke:#333,stroke-width:2px;
    classDef external fill:#ffc,stroke:#333,stroke-width:2px;
    classDef helper fill:#ff9,stroke:#333,stroke-width:2px;
    classDef dev fill:#ccc,stroke:#333,stroke-width:2px;
```
