# whr884657/apinexus architecture

> Architecture diagram of the GitHub repository whr884657/apinexus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/whr884657/apinexus
- Repository: https://github.com/whr884657/apinexus

## Overview

ApiNexus is a self-hosted PHP API platform whose main flow is visitors browsing the themed API catalog, opening details or the playground, and invoking APIs through the proxy gateway. Users manage accounts, tokens and points; administrators review APIs and operate content, finance and system settings. The graph preserves documented installation, authentication, public/system APIs, incentives, mail, statistics and online updates. Some links come only from README or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`user/index.php`](https://github.com/whr884657/apinexus/blob/main/user/index.php) (User portal), [`admin/index.php`](https://github.com/whr884657/apinexus/blob/main/admin/index.php) (Admin console), [`core/theme/default/pages/home.php`](https://github.com/whr884657/apinexus/blob/main/core/theme/default/pages/home.php) (Theme pages), [`admin/api/review.php`](https://github.com/whr884657/apinexus/blob/main/admin/api/review.php) (API review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Public site"]
  node_site_entry["Site entry<br/>[index.php]"]
  node_themes["Theme pages<br/>[home.php]"]
  node_content["Content catalog<br/>[ContentManager.php]"]
end

subgraph group_identity["Accounts and access"]
  node_user_portal["User portal<br/>[index.php]"]
  node_user_auth["User authentication<br/>[UserAuth.php]"]
  node_oauth["OAuth login<br/>[OAuthService.php]"]
  node_token_management["Token management<br/>[ApiKeyManager.php]"]
end

subgraph group_api["API services"]
  node_public_api["API invocation<br/>[index.php]"]
  node_api_catalog["API catalog and review<br/>[ApiManager.php]"]
  node_proxy["Proxy gateway<br/>[ApiProxy.php]"]
  node_system_api["System APIs<br/>[apiquery.php]"]
end

subgraph group_operations["Administration"]
  node_admin_console["Admin console<br/>[index.php]"]
  node_admin_review["API review<br/>[review.php]"]
  node_incentives["Points and incentives"]
  node_mail_ops["Mail operations<br/>[mail.php]"]
end

subgraph group_platform["Platform services"]
  node_installer["Web installer<br/>[index.php]"]
  node_updater["Online updater<br/>[Updater.php]"]
  node_database[("MySQL")]
  node_cache[("Redis")]
end

node_visitor(("Visitor"))
node_user_actor(("Registered user"))
node_admin_actor(("Administrator"))
node_oauth_providers{{"QQ / Gitee"}}
node_payment_service{{"Payment provider"}}
node_cloud_update{{"Update service"}}

node_visitor -->|"visits"| node_site_entry
node_user_actor -->|"opens"| node_user_portal
node_admin_actor -->|"opens"| node_admin_console
node_site_entry -->|"renders"| node_themes
node_themes -.->|"loads content"| node_content
node_themes -->|"invokes"| node_proxy
node_user_portal -->|"uses"| node_user_auth
node_user_portal -->|"loads user data"| node_content
node_user_auth -->|"reads and writes"| node_database
node_oauth -->|"authenticates with"| node_oauth_providers
node_oauth -->|"logs in"| node_user_auth
node_user_portal -.->|"manages tokens"| node_token_management
node_public_api -->|"loads API"| node_api_catalog
node_public_api -.->|"dispatches"| node_proxy
node_api_catalog -->|"reads and writes"| node_database
node_admin_console -.->|"routes to"| node_admin_review
node_admin_review -->|"reviews"| node_api_catalog
node_admin_review -.->|"notifies via"| node_mail_ops
node_incentives -->|"records points"| node_database
node_incentives -->|"uses cache"| node_cache
node_admin_console -.->|"configures"| node_incentives
node_admin_console -.->|"operates"| node_mail_ops
node_installer -->|"installs schema"| node_database
node_installer -->|"checks Redis"| node_cache
node_updater -->|"checks and downloads"| node_cloud_update
node_updater -->|"migrates schema"| node_database
node_system_api -.->|"serves system data"| node_database
node_token_management -->|"stores tokens"| node_database

click node_site_entry "https://github.com/whr884657/apinexus/blob/main/index.php"
click node_themes "https://github.com/whr884657/apinexus/blob/main/core/theme/default/pages/home.php"
click node_content "https://github.com/whr884657/apinexus/blob/main/core/ContentManager.php"
click node_user_portal "https://github.com/whr884657/apinexus/blob/main/user/index.php"
click node_user_auth "https://github.com/whr884657/apinexus/blob/main/core/UserAuth.php"
click node_oauth "https://github.com/whr884657/apinexus/blob/main/core/oauth/OAuthService.php"
click node_token_management "https://github.com/whr884657/apinexus/blob/main/core/ApiKeyManager.php"
click node_public_api "https://github.com/whr884657/apinexus/blob/main/api/index.php"
click node_api_catalog "https://github.com/whr884657/apinexus/blob/main/core/ApiManager.php"
click node_proxy "https://github.com/whr884657/apinexus/blob/main/core/ApiProxy.php"
click node_system_api "https://github.com/whr884657/apinexus/blob/main/core/api/apiquery.php"
click node_admin_console "https://github.com/whr884657/apinexus/blob/main/admin/index.php"
click node_admin_review "https://github.com/whr884657/apinexus/blob/main/admin/api/review.php"
click node_incentives "https://github.com/whr884657/apinexus/blob/main/core/IncentiveManager.php"
click node_mail_ops "https://github.com/whr884657/apinexus/blob/main/admin/ops/mail.php"
click node_installer "https://github.com/whr884657/apinexus/blob/main/install/index.php"
click node_updater "https://github.com/whr884657/apinexus/blob/main/core/Updater.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_site_entry,node_themes,node_content,node_user_actor toneBlue
class node_user_portal,node_user_auth,node_oauth,node_token_management toneAmber
class node_public_api,node_api_catalog,node_proxy,node_system_api toneMint
class node_admin_console,node_admin_review,node_incentives,node_mail_ops toneRose
class node_installer,node_updater,node_database,node_cache,node_visitor,node_admin_actor,node_oauth_providers,node_payment_service,node_cloud_update toneIndigo
```

## Components

### Public site

- [Site entry](https://github.com/whr884657/apinexus/blob/main/index.php): `index.php`
- [Theme pages](https://github.com/whr884657/apinexus/blob/main/core/theme/default/pages/home.php): `core/theme/default/pages/home.php`
- [Content catalog](https://github.com/whr884657/apinexus/blob/main/core/ContentManager.php): `core/ContentManager.php`

### Accounts and access

- [User portal](https://github.com/whr884657/apinexus/blob/main/user/index.php): `user/index.php`
- [User authentication](https://github.com/whr884657/apinexus/blob/main/core/UserAuth.php): `core/UserAuth.php`
- [OAuth login](https://github.com/whr884657/apinexus/blob/main/core/oauth/OAuthService.php): `core/oauth/OAuthService.php`
- [Token management](https://github.com/whr884657/apinexus/blob/main/core/ApiKeyManager.php): `core/ApiKeyManager.php`

### API services

- [API invocation](https://github.com/whr884657/apinexus/blob/main/api/index.php): `api/index.php`
- [API catalog and review](https://github.com/whr884657/apinexus/blob/main/core/ApiManager.php): `core/ApiManager.php`
- [Proxy gateway](https://github.com/whr884657/apinexus/blob/main/core/ApiProxy.php): `core/ApiProxy.php`
- [System APIs](https://github.com/whr884657/apinexus/blob/main/core/api/apiquery.php): `core/api/apiquery.php`

### Administration

- [Admin console](https://github.com/whr884657/apinexus/blob/main/admin/index.php): `admin/index.php`
- [API review](https://github.com/whr884657/apinexus/blob/main/admin/api/review.php): `admin/api/review.php`
- [Points and incentives](https://github.com/whr884657/apinexus/blob/main/core/IncentiveManager.php): `core/IncentiveManager.php`
- [Mail operations](https://github.com/whr884657/apinexus/blob/main/admin/ops/mail.php): `admin/ops/mail.php`

### Platform services

- [Web installer](https://github.com/whr884657/apinexus/blob/main/install/index.php): `install/index.php`
- [Online updater](https://github.com/whr884657/apinexus/blob/main/core/Updater.php): `core/Updater.php`
- **MySQL**
- **Redis**

### Other components

- **Visitor**
- **Registered user**
- **Administrator**
- **QQ / Gitee**
- **Payment provider**
- **Update service**

## Connections

- Visitor → Site entry: visits (evidence: `README.md`)
- Registered user → User portal: opens (evidence: `README.md`)
- Administrator → Admin console: opens (evidence: `README.md`)
- Site entry → Theme pages: renders (evidence: `README.md`)
- Theme pages → Content catalog: loads content
- Theme pages → Proxy gateway: invokes (evidence: `README.md`)
- User portal → User authentication: uses (evidence: `user/index.php`)
- User portal → Content catalog: loads user data (evidence: `user/index.php`)
- User authentication → MySQL: reads and writes (evidence: `core/UserAuth.php`)
- OAuth login → QQ / Gitee: authenticates with (evidence: `core/oauth/OAuthService.php`)
- OAuth login → User authentication: logs in (evidence: `core/oauth/OAuthService.php`)
- User portal → Token management: manages tokens
- API invocation → API catalog and review: loads API (evidence: `api/index.php`)
- API invocation → Proxy gateway: dispatches
- API catalog and review → MySQL: reads and writes (evidence: `core/ApiManager.php`)
- Admin console → API review: routes to
- API review → API catalog and review: reviews (evidence: `admin/api/review.php`)
- API review → Mail operations: notifies via
- Points and incentives → MySQL: records points (evidence: `core/IncentiveManager.php`)
- Points and incentives → Redis: uses cache (evidence: `core/IncentiveManager.php`)
- Admin console → Points and incentives: configures
- Admin console → Mail operations: operates
- Web installer → MySQL: installs schema (evidence: `install/index.php`)
- Web installer → Redis: checks Redis (evidence: `install/index.php`)
- Online updater → Update service: checks and downloads (evidence: `README.md`)
- Online updater → MySQL: migrates schema (evidence: `README.md`)
- System APIs → MySQL: serves system data
- Token management → MySQL: stores tokens (evidence: `core/ApiKeyManager.php`)
