# ethan985211/devtoolsbox architecture

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

- Interactive diagram: https://gitdiagram.com/ethan985211/devtoolsbox
- Repository: https://github.com/ethan985211/devtoolsbox

## Overview

DevToolsBox is a static site offering browser-based developer utilities, with related articles, curated resource pages, and a C++ practice area. A separate Cloudflare Pages API in that area supports account access and paid memberships: users register or log in, create an order, and payment confirmation activates membership. Tool behavior and most site-page connections are not shown in the sampled source, so those branches are represented at directory level; API calls shown in source are linked directly.

Main entry points: [`cpp-practice/functions/_utils/db.js`](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/db.js) (Account and order data), [`cpp-practice/functions/_utils/jwt.js`](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/jwt.js) (JWT utilities), [`cpp-practice/functions/api/epay/notify.js`](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/epay/notify.js) (Payment callback), [`cpp-practice/functions/api/login.js`](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/login.js) (Login API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tools["Online tools"]
  node_image_tools["Image tools"]
  node_document_tools["PDF tools"]
  node_text_tools["Text utilities"]
  node_other_tools["Other utilities"]
end

subgraph group_discovery["Content and discovery"]
  node_articles["Guides and blog"]
  node_resource_sites["Resource directories"]
  node_products["Digital products"]
end

subgraph group_accounts["Accounts and API"]
  node_practice_site["C++ practice site<br/>[index.html]"]
  node_api_middleware["API CORS middleware<br/>[_middleware.js]"]
  node_registration["Registration API<br/>[register.js]"]
  node_login["Login API<br/>[login.js]"]
  node_user_status["User status APIs<br/>[user.js]"]
  node_membership_status["Membership status API<br/>[status.js]"]
  node_jwt["JWT utilities<br/>[jwt.js]"]
end

subgraph group_membership["Membership payments"]
  node_plans["Membership plans API<br/>[plans.js]"]
  node_order_creation["Create payment order<br/>[create-order.js]"]
  node_order_check["Check order API<br/>[check.js]"]
  node_payment_callback["Payment callback<br/>[notify.js]"]
  node_database_helpers["Account and order data<br/>[db.js]"]
  node_d1[("Cloudflare D1")]
end

subgraph group_runtime["Site runtime"]
  node_service_worker["Offline cache<br/>[sw.js]"]
end

node_visitor(("Visitor"))
node_epay["Epay service"]

node_visitor -.->|"uses"| node_image_tools
node_visitor -.->|"uses"| node_document_tools
node_visitor -.->|"uses"| node_text_tools
node_visitor -.->|"uses"| node_other_tools
node_registration -->|"creates account"| node_database_helpers
node_registration -->|"signs token"| node_jwt
node_login -->|"reads account"| node_database_helpers
node_login -->|"reads membership"| node_database_helpers
node_login -->|"signs token"| node_jwt
node_user_status -->|"verifies token"| node_jwt
node_user_status -->|"reads membership"| node_database_helpers
node_membership_status -->|"verifies token"| node_jwt
node_membership_status -->|"reads membership"| node_database_helpers
node_order_creation -->|"verifies token"| node_jwt
node_order_creation -->|"creates order"| node_database_helpers
node_order_creation -->|"builds payment URL"| node_epay
node_order_check -->|"verifies token"| node_jwt
node_order_check -->|"checks order"| node_database_helpers
node_payment_callback -->|"checks order"| node_database_helpers
node_payment_callback -->|"activates membership"| node_database_helpers
node_payment_callback -->|"marks paid"| node_database_helpers
node_database_helpers -->|"queries and updates"| node_d1
node_epay -.->|"sends callback"| node_payment_callback
node_service_worker -->|"caches selected pages"| node_image_tools
node_service_worker -->|"caches selected pages"| node_document_tools

click node_image_tools "https://github.com/ethan985211/devtoolsbox/tree/main/tools"
click node_document_tools "https://github.com/ethan985211/devtoolsbox/tree/main/tools"
click node_text_tools "https://github.com/ethan985211/devtoolsbox/tree/main/tools"
click node_other_tools "https://github.com/ethan985211/devtoolsbox/tree/main/tools"
click node_articles "https://github.com/ethan985211/devtoolsbox/tree/main/blog"
click node_resource_sites "https://github.com/ethan985211/devtoolsbox/tree/main/sites"
click node_products "https://github.com/ethan985211/devtoolsbox/tree/main/products"
click node_practice_site "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/index.html"
click node_api_middleware "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/_middleware.js"
click node_registration "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/register.js"
click node_login "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/login.js"
click node_user_status "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/user.js"
click node_membership_status "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/status.js"
click node_jwt "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/jwt.js"
click node_plans "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/plans.js"
click node_order_creation "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/create-order.js"
click node_order_check "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/orders/check.js"
click node_payment_callback "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/epay/notify.js"
click node_database_helpers "https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/db.js"
click node_service_worker "https://github.com/ethan985211/devtoolsbox/blob/main/sw.js"

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_image_tools,node_document_tools,node_text_tools,node_other_tools toneBlue
class node_articles,node_resource_sites,node_products toneAmber
class node_practice_site,node_api_middleware,node_registration,node_login,node_user_status,node_membership_status,node_jwt toneMint
class node_plans,node_order_creation,node_order_check,node_payment_callback,node_database_helpers,node_d1 toneRose
class node_service_worker,node_visitor,node_epay toneIndigo
```

## Components

### Online tools

- [Image tools](https://github.com/ethan985211/devtoolsbox/tree/main/tools): `tools`
- [PDF tools](https://github.com/ethan985211/devtoolsbox/tree/main/tools): `tools`
- [Text utilities](https://github.com/ethan985211/devtoolsbox/tree/main/tools): `tools`
- [Other utilities](https://github.com/ethan985211/devtoolsbox/tree/main/tools): `tools`

### Content and discovery

- [Guides and blog](https://github.com/ethan985211/devtoolsbox/tree/main/blog): `blog`
- [Resource directories](https://github.com/ethan985211/devtoolsbox/tree/main/sites): `sites`
- [Digital products](https://github.com/ethan985211/devtoolsbox/tree/main/products): `products`

### Accounts and API

- [C++ practice site](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/index.html): `cpp-practice/index.html`
- [API CORS middleware](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/_middleware.js): `cpp-practice/functions/api/_middleware.js`
- [Registration API](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/register.js): `cpp-practice/functions/api/register.js`
- [Login API](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/login.js): `cpp-practice/functions/api/login.js`
- [User status APIs](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/user.js): `cpp-practice/functions/api/user.js`
- [Membership status API](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/status.js): `cpp-practice/functions/api/membership/status.js`
- [JWT utilities](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/jwt.js): `cpp-practice/functions/_utils/jwt.js`

### Membership payments

- [Membership plans API](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/plans.js): `cpp-practice/functions/api/membership/plans.js`
- [Create payment order](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/membership/create-order.js): `cpp-practice/functions/api/membership/create-order.js`
- [Check order API](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/orders/check.js): `cpp-practice/functions/api/orders/check.js`
- [Payment callback](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/api/epay/notify.js): `cpp-practice/functions/api/epay/notify.js`
- [Account and order data](https://github.com/ethan985211/devtoolsbox/blob/main/cpp-practice/functions/_utils/db.js): `cpp-practice/functions/_utils/db.js`
- **Cloudflare D1**

### Site runtime

- [Offline cache](https://github.com/ethan985211/devtoolsbox/blob/main/sw.js): `sw.js`

### Other components

- **Visitor**
- **Epay service**

## Connections

- Visitor → Image tools: uses
- Visitor → PDF tools: uses
- Visitor → Text utilities: uses
- Visitor → Other utilities: uses
- Registration API → Account and order data: creates account (evidence: `cpp-practice/functions/api/register.js`)
- Registration API → JWT utilities: signs token (evidence: `cpp-practice/functions/api/register.js`)
- Login API → Account and order data: reads account (evidence: `cpp-practice/functions/api/login.js`)
- Login API → Account and order data: reads membership (evidence: `cpp-practice/functions/api/login.js`)
- Login API → JWT utilities: signs token (evidence: `cpp-practice/functions/api/login.js`)
- User status APIs → JWT utilities: verifies token (evidence: `cpp-practice/functions/api/user.js`)
- User status APIs → Account and order data: reads membership (evidence: `cpp-practice/functions/api/user.js`)
- Membership status API → JWT utilities: verifies token (evidence: `cpp-practice/functions/api/membership/status.js`)
- Membership status API → Account and order data: reads membership (evidence: `cpp-practice/functions/api/membership/status.js`)
- Create payment order → JWT utilities: verifies token (evidence: `cpp-practice/functions/api/membership/create-order.js`)
- Create payment order → Account and order data: creates order (evidence: `cpp-practice/functions/api/membership/create-order.js`)
- Create payment order → Epay service: builds payment URL (evidence: `cpp-practice/functions/api/membership/create-order.js`)
- Check order API → JWT utilities: verifies token (evidence: `cpp-practice/functions/api/orders/check.js`)
- Check order API → Account and order data: checks order (evidence: `cpp-practice/functions/api/orders/check.js`)
- Payment callback → Account and order data: checks order (evidence: `cpp-practice/functions/api/epay/notify.js`)
- Payment callback → Account and order data: activates membership (evidence: `cpp-practice/functions/api/epay/notify.js`)
- Payment callback → Account and order data: marks paid (evidence: `cpp-practice/functions/api/epay/notify.js`)
- Account and order data → Cloudflare D1: queries and updates (evidence: `cpp-practice/functions/_utils/db.js`)
- Epay service → Payment callback: sends callback
- Offline cache → Image tools: caches selected pages (evidence: `sw.js`)
- Offline cache → PDF tools: caches selected pages (evidence: `sw.js`)
