# lintiance078/hhh-workbuddy-homepage architecture

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

- Interactive diagram: https://gitdiagram.com/lintiance078/hhh-workbuddy-homepage
- Repository: https://github.com/lintiance078/hhh-workbuddy-homepage

## Overview

This is a personal homepage, blog, and toolbox with a single-page frontend and Cloudflare Pages API. Visitors browse published posts and site information; the administrator logs in, edits and manages posts, and can update the site profile. In offline or local mode, drafts stay in browser storage and can later be uploaded in batches. The README documents frontend behavior, while the sampled API files show authentication and D1 access; unsampled frontend details are represented only where the README supports them.

Main entry points: [`functions/api/posts.js`](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts.js) (Posts collection API), [`functions/api/posts/[id].js`](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts/%5Bid%5D.js) (Single-post API), [`public/index.html`](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html) (Drafts box), [`functions/api/profile.js`](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/profile.js) (Profile API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Homepage and authoring"]
  node_homepage["Homepage SPA<br/>[index.html]"]
  node_article_reader["Article reader<br/>[index.html]"]
  node_article_editor["Article editor<br/>[index.html]"]
  node_hidden_login["Hidden login entry<br/>[index.html]"]
  node_drafts_box["Drafts box<br/>[index.html]"]
  node_local_drafts[("Local drafts<br/>[index.html]")]
end

subgraph group_api["Pages API"]
  node_login_api["Login endpoint<br/>[login.js]"]
  node_auth["Token signing and verification<br/>[_auth.js]"]
  node_posts_api["Posts collection API<br/>[posts.js]"]
  node_post_api["Single-post API<br/>[&#91;id&#93;.js]"]
  node_profile_api["Profile API<br/>[profile.js]"]
end

subgraph group_data["Persistent data"]
  node_d1[("Cloudflare D1<br/>[schema.sql]")]
end

node_visitor(("Visitor"))
node_admin(("Administrator"))

node_visitor -->|"visits"| node_homepage
node_admin -->|"opens entry"| node_hidden_login
node_hidden_login -->|"submits password"| node_login_api
node_login_api -->|"signs token"| node_auth
node_admin -->|"writes articles"| node_article_editor
node_article_editor -->|"creates articles"| node_posts_api
node_article_editor -->|"edits articles"| node_post_api
node_homepage -->|"loads list"| node_posts_api
node_article_reader -->|"loads article"| node_post_api
node_drafts_box -->|"loads online drafts"| node_posts_api
node_drafts_box -->|"changes status"| node_post_api
node_article_reader -->|"changes status"| node_post_api
node_article_editor -->|"saves offline"| node_local_drafts
node_drafts_box -->|"reads drafts"| node_local_drafts
node_drafts_box -->|"uploads batches"| node_posts_api
node_homepage -->|"loads profile"| node_profile_api
node_admin -->|"updates profile"| node_profile_api
node_posts_api -->|"checks admin"| node_auth
node_post_api -->|"checks admin"| node_auth
node_profile_api -->|"checks admin"| node_auth
node_posts_api -->|"reads and writes"| node_d1
node_post_api -->|"reads and writes"| node_d1
node_profile_api -->|"reads and writes"| node_d1

click node_homepage "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_article_reader "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_article_editor "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_hidden_login "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_drafts_box "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_local_drafts "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html"
click node_login_api "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/login.js"
click node_auth "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/_auth.js"
click node_posts_api "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts.js"
click node_post_api "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts/%5Bid%5D.js"
click node_profile_api "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/profile.js"
click node_d1 "https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/schema.sql"

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_homepage,node_article_reader,node_article_editor,node_hidden_login,node_drafts_box,node_local_drafts toneBlue
class node_login_api,node_auth,node_posts_api,node_post_api,node_profile_api toneAmber
class node_d1 toneMint
class node_visitor,node_admin toneIndigo
```

## Components

### Homepage and authoring

- [Homepage SPA](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`
- [Article reader](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`
- [Article editor](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`
- [Hidden login entry](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`
- [Drafts box](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`
- [Local drafts](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/public/index.html): `public/index.html`

### Pages API

- [Login endpoint](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/login.js): `functions/api/login.js`
- [Token signing and verification](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/_auth.js): `functions/api/_auth.js`
- [Posts collection API](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts.js): `functions/api/posts.js`
- [Single-post API](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/posts/%5Bid%5D.js): `functions/api/posts/[id].js`
- [Profile API](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/functions/api/profile.js): `functions/api/profile.js`

### Persistent data

- [Cloudflare D1](https://github.com/lintiance078/hhh-workbuddy-homepage/blob/main/schema.sql): `schema.sql`

### Other components

- **Visitor**
- **Administrator**

## Connections

- Visitor → Homepage SPA: visits (evidence: `README.md`)
- Administrator → Hidden login entry: opens entry (evidence: `README.md`)
- Hidden login entry → Login endpoint: submits password (evidence: `README.md`)
- Login endpoint → Token signing and verification: signs token (evidence: `functions/api/login.js`)
- Administrator → Article editor: writes articles (evidence: `README.md`)
- Article editor → Posts collection API: creates articles (evidence: `README.md`)
- Article editor → Single-post API: edits articles (evidence: `README.md`)
- Homepage SPA → Posts collection API: loads list (evidence: `README.md`)
- Article reader → Single-post API: loads article (evidence: `README.md`)
- Drafts box → Posts collection API: loads online drafts (evidence: `README.md`)
- Drafts box → Single-post API: changes status (evidence: `functions/api/posts/[id].js`)
- Article reader → Single-post API: changes status (evidence: `functions/api/posts/[id].js`)
- Article editor → Local drafts: saves offline (evidence: `README.md`)
- Drafts box → Local drafts: reads drafts (evidence: `README.md`)
- Drafts box → Posts collection API: uploads batches (evidence: `README.md`)
- Homepage SPA → Profile API: loads profile (evidence: `README.md`)
- Administrator → Profile API: updates profile (evidence: `README.md`)
- Posts collection API → Token signing and verification: checks admin (evidence: `functions/api/posts.js`)
- Single-post API → Token signing and verification: checks admin (evidence: `functions/api/posts/[id].js`)
- Profile API → Token signing and verification: checks admin (evidence: `functions/api/profile.js`)
- Posts collection API → Cloudflare D1: reads and writes (evidence: `functions/api/posts.js`)
- Single-post API → Cloudflare D1: reads and writes (evidence: `functions/api/posts/[id].js`)
- Profile API → Cloudflare D1: reads and writes (evidence: `functions/api/profile.js`)
