# 0xdeathchief/blog-site architecture

> Architecture diagram of the GitHub repository 0xdeathchief/blog-site, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xdeathchief/blog-site
- Repository: https://github.com/0xdeathchief/blog-site

## Overview

MadQuill is a community-driven technical publishing platform. Its main workflow runs from contributor drafting and submission through editorial review and publication, then public discovery, reading, and community engagement; role-based administration supports the publication. The graph combines documented capabilities with sampled call relationships. Some page and route implementations were not sampled, so their connections are shown only where the README documents them or are left out. Other unsampled capabilities are represented by their existing route or component paths.

Main entry points: [`src/app/api/articles`](https://github.com/0xdeathchief/blog-site/tree/main/src/app/api/articles) (Article workflow API), [`src/lib/supabase/server.js`](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/server.js) (Supabase server client), [`src/lib/supabase/admin.js`](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/admin.js) (Supabase admin client), [`src/app/api/article-media/[...path]/route.js`](https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/article-media/%5B...path%5D/route.js) (Article media delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_publishing["Publishing workflow"]
  node_article_workspace["Article workspace"]
  node_article_editor["Article editor<br/>[ArticleEditor.jsx]"]
  node_article_routes["Article workflow API"]
  node_content_rules["Content validation<br/>[content.js]"]
  node_editorial_review["Editorial review"]
end

subgraph group_reader["Reader experience"]
  node_public_articles["Published articles"]
  node_discovery["Content discovery"]
  node_article_cards["Article cards<br/>[ArticleCards.jsx]"]
  node_reader_portal["Reader collections<br/>[PortalArticles.jsx]"]
  node_portal_frame["Portal frame<br/>[PortalFrame.jsx]"]
  node_theme_toggle["Theme controls<br/>[ThemeToggle.jsx]"]
  node_interactions["Likes and comments"]
  node_guest_api["Guest activity API<br/>[route.js]"]
end

subgraph group_identity["Identity and access"]
  node_guest_sessions["Guest sessions<br/>[guest-session.js]"]
  node_sign_in["Sign-in form<br/>[SignInForm.jsx]"]
  node_authorization["Role authorization<br/>[authorization.js]"]
  node_api_auth["API authorization<br/>[api.js]"]
end

subgraph group_operations["Administration and media"]
  node_admin_routes["Admin operations"]
  node_cover_upload["Cover upload<br/>[route.js]"]
  node_media_delivery["Article media delivery<br/>[route.js]"]
  node_media_variants["Media variants<br/>[variants.mjs]"]
end

subgraph group_platform["Backend services"]
  node_supabase_server["Supabase server client<br/>[server.js]"]
  node_supabase_browser["Supabase browser client<br/>[browser.js]"]
  node_supabase_admin["Supabase admin client<br/>[admin.js]"]
  node_supabase_public["Supabase public client<br/>[public.js]"]
  node_supabase_config["Supabase configuration<br/>[config.js]"]
end

node_contributors(("Contributors and editors"))
node_readers(("Readers and guests"))
node_supabase[("Supabase services")]
node_turnstile{{"Cloudflare Turnstile"}}

node_contributors -->|"create drafts"| node_article_workspace
node_article_workspace -->|"uses editor"| node_article_editor
node_contributors -->|"submit articles"| node_article_routes
node_article_routes -->|"validates content"| node_content_rules
node_article_routes -->|"checks roles"| node_api_auth
node_article_routes -->|"saves articles"| node_supabase
node_article_routes -->|"supports review"| node_editorial_review
node_editorial_review -->|"publishes articles"| node_public_articles
node_readers -->|"find stories"| node_discovery
node_discovery -->|"renders cards"| node_article_cards
node_article_cards -.->|"links articles"| node_public_articles
node_readers -->|"manage reading"| node_reader_portal
node_reader_portal -->|"uses frame"| node_portal_frame
node_readers -->|"engage with articles"| node_interactions
node_interactions -.->|"records activity"| node_guest_api
node_guest_api -->|"verifies identity"| node_guest_sessions
node_guest_api -->|"records engagement"| node_supabase_admin
node_guest_sessions -->|"verifies challenge"| node_turnstile
node_readers -->|"sign in"| node_sign_in
node_sign_in -->|"authenticates with"| node_supabase_browser
node_api_auth -->|"checks permissions"| node_authorization
node_authorization -->|"loads session"| node_supabase_server
node_admin_routes -->|"protects operations"| node_api_auth
node_admin_routes -->|"accesses records"| node_supabase_server
node_cover_upload -->|"checks roles"| node_api_auth
node_cover_upload -->|"stores variants"| node_media_variants
node_cover_upload -->|"uploads cover"| node_supabase_admin
node_media_delivery -->|"selects variants"| node_media_variants
node_media_delivery -->|"loads media"| node_supabase_admin
node_media_delivery -->|"checks visibility"| node_supabase_server
node_media_delivery -->|"checks publication"| node_supabase_public
node_supabase_server -->|"loads config"| node_supabase_config
node_supabase_admin -->|"loads config"| node_supabase_config
node_supabase_public -->|"loads config"| node_supabase_config
node_supabase_server -->|"uses auth and data"| node_supabase
node_supabase_admin -->|"uses privileged access"| node_supabase
node_supabase_browser -->|"uses client auth"| node_supabase
node_supabase_public -->|"reads public content"| node_supabase
node_theme_toggle -->|"appears in header"| node_portal_frame

click node_article_workspace "https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleWorkspace.jsx"
click node_article_editor "https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleEditor.jsx"
click node_article_routes "https://github.com/0xdeathchief/blog-site/tree/main/src/app/api/articles"
click node_content_rules "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/articles/content.js"
click node_editorial_review "https://github.com/0xdeathchief/blog-site/tree/main/src/app/editor"
click node_public_articles "https://github.com/0xdeathchief/blog-site/tree/main/src/app/articles"
click node_discovery "https://github.com/0xdeathchief/blog-site/blob/main/src/components/public/ArticleDiscovery.jsx"
click node_article_cards "https://github.com/0xdeathchief/blog-site/blob/main/src/components/public/ArticleCards.jsx"
click node_reader_portal "https://github.com/0xdeathchief/blog-site/blob/main/src/components/portal/PortalArticles.jsx"
click node_portal_frame "https://github.com/0xdeathchief/blog-site/blob/main/src/components/portal/PortalFrame.jsx"
click node_theme_toggle "https://github.com/0xdeathchief/blog-site/blob/main/src/components/layout/ThemeToggle.jsx"
click node_interactions "https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleInteractions.jsx"
click node_guest_api "https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/guest/activity/route.js"
click node_guest_sessions "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/community/guest-session.js"
click node_sign_in "https://github.com/0xdeathchief/blog-site/blob/main/src/components/auth/SignInForm.jsx"
click node_authorization "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/auth/authorization.js"
click node_api_auth "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/auth/api.js"
click node_admin_routes "https://github.com/0xdeathchief/blog-site/tree/main/src/app/api/admin"
click node_cover_upload "https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/article-covers/route.js"
click node_media_delivery "https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/article-media/%5B...path%5D/route.js"
click node_media_variants "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/media/variants.mjs"
click node_supabase_server "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/server.js"
click node_supabase_browser "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/browser.js"
click node_supabase_admin "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/admin.js"
click node_supabase_public "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/public.js"
click node_supabase_config "https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/config.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_article_workspace,node_article_editor,node_article_routes,node_content_rules,node_editorial_review toneBlue
class node_public_articles,node_discovery,node_article_cards,node_reader_portal,node_portal_frame,node_theme_toggle,node_interactions,node_guest_api,node_supabase toneAmber
class node_guest_sessions,node_sign_in,node_authorization,node_api_auth toneMint
class node_admin_routes,node_cover_upload,node_media_delivery,node_media_variants toneRose
class node_supabase_server,node_supabase_browser,node_supabase_admin,node_supabase_public,node_supabase_config,node_contributors,node_readers,node_turnstile toneIndigo
```

## Components

### Publishing workflow

- [Article workspace](https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleWorkspace.jsx): `src/components/articles/ArticleWorkspace.jsx`
- [Article editor](https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleEditor.jsx): `src/components/articles/ArticleEditor.jsx`
- [Article workflow API](https://github.com/0xdeathchief/blog-site/tree/main/src/app/api/articles): `src/app/api/articles`
- [Content validation](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/articles/content.js): `src/lib/articles/content.js`
- [Editorial review](https://github.com/0xdeathchief/blog-site/tree/main/src/app/editor): `src/app/editor`

### Reader experience

- [Published articles](https://github.com/0xdeathchief/blog-site/tree/main/src/app/articles): `src/app/articles`
- [Content discovery](https://github.com/0xdeathchief/blog-site/blob/main/src/components/public/ArticleDiscovery.jsx): `src/components/public/ArticleDiscovery.jsx`
- [Article cards](https://github.com/0xdeathchief/blog-site/blob/main/src/components/public/ArticleCards.jsx): `src/components/public/ArticleCards.jsx`
- [Reader collections](https://github.com/0xdeathchief/blog-site/blob/main/src/components/portal/PortalArticles.jsx): `src/components/portal/PortalArticles.jsx`
- [Portal frame](https://github.com/0xdeathchief/blog-site/blob/main/src/components/portal/PortalFrame.jsx): `src/components/portal/PortalFrame.jsx`
- [Theme controls](https://github.com/0xdeathchief/blog-site/blob/main/src/components/layout/ThemeToggle.jsx): `src/components/layout/ThemeToggle.jsx`
- [Likes and comments](https://github.com/0xdeathchief/blog-site/blob/main/src/components/articles/ArticleInteractions.jsx): `src/components/articles/ArticleInteractions.jsx`
- [Guest activity API](https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/guest/activity/route.js): `src/app/api/guest/activity/route.js`

### Identity and access

- [Guest sessions](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/community/guest-session.js): `src/lib/community/guest-session.js`
- [Sign-in form](https://github.com/0xdeathchief/blog-site/blob/main/src/components/auth/SignInForm.jsx): `src/components/auth/SignInForm.jsx`
- [Role authorization](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/auth/authorization.js): `src/lib/auth/authorization.js`
- [API authorization](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/auth/api.js): `src/lib/auth/api.js`

### Administration and media

- [Admin operations](https://github.com/0xdeathchief/blog-site/tree/main/src/app/api/admin): `src/app/api/admin`
- [Cover upload](https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/article-covers/route.js): `src/app/api/article-covers/route.js`
- [Article media delivery](https://github.com/0xdeathchief/blog-site/blob/main/src/app/api/article-media/%5B...path%5D/route.js): `src/app/api/article-media/[...path]/route.js`
- [Media variants](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/media/variants.mjs): `src/lib/media/variants.mjs`

### Backend services

- [Supabase server client](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/server.js): `src/lib/supabase/server.js`
- [Supabase browser client](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/browser.js): `src/lib/supabase/browser.js`
- [Supabase admin client](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/admin.js): `src/lib/supabase/admin.js`
- [Supabase public client](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/public.js): `src/lib/supabase/public.js`
- [Supabase configuration](https://github.com/0xdeathchief/blog-site/blob/main/src/lib/supabase/config.js): `src/lib/supabase/config.js`

### Other components

- **Contributors and editors**
- **Readers and guests**
- **Supabase services**
- **Cloudflare Turnstile**

## Connections

- Contributors and editors → Article workspace: create drafts (evidence: `README.md`)
- Article workspace → Article editor: uses editor (evidence: `src/components/articles/ArticleWorkspace.jsx`)
- Contributors and editors → Article workflow API: submit articles (evidence: `README.md`)
- Article workflow API → Content validation: validates content (evidence: `src/app/api/articles/route.js`)
- Article workflow API → API authorization: checks roles (evidence: `src/app/api/articles/route.js`)
- Article workflow API → Supabase services: saves articles (evidence: `README.md`)
- Article workflow API → Editorial review: supports review (evidence: `README.md`)
- Editorial review → Published articles: publishes articles (evidence: `README.md`)
- Readers and guests → Content discovery: find stories (evidence: `README.md`)
- Content discovery → Article cards: renders cards (evidence: `src/components/public/ArticleDiscovery.jsx`)
- Article cards → Published articles: links articles
- Readers and guests → Reader collections: manage reading (evidence: `README.md`)
- Reader collections → Portal frame: uses frame (evidence: `src/components/portal/ReaderCollectionPage.jsx`)
- Readers and guests → Likes and comments: engage with articles (evidence: `README.md`)
- Likes and comments → Guest activity API: records activity
- Guest activity API → Guest sessions: verifies identity (evidence: `src/app/api/guest/activity/route.js`)
- Guest activity API → Supabase admin client: records engagement (evidence: `src/app/api/guest/activity/route.js`)
- Guest sessions → Cloudflare Turnstile: verifies challenge (evidence: `src/lib/community/guest-session.js`)
- Readers and guests → Sign-in form: sign in (evidence: `README.md`)
- Sign-in form → Supabase browser client: authenticates with (evidence: `src/components/auth/SignInForm.jsx`)
- API authorization → Role authorization: checks permissions (evidence: `src/lib/auth/api.js`)
- Role authorization → Supabase server client: loads session (evidence: `src/lib/auth/authorization.js`)
- Admin operations → API authorization: protects operations (evidence: `src/app/api/admin/catalog/[kind]/route.js`)
- Admin operations → Supabase server client: accesses records (evidence: `src/app/api/admin/catalog/[kind]/route.js`)
- Cover upload → API authorization: checks roles (evidence: `src/app/api/article-covers/route.js`)
- Cover upload → Media variants: stores variants (evidence: `src/app/api/article-covers/route.js`)
- Cover upload → Supabase admin client: uploads cover (evidence: `src/app/api/article-covers/route.js`)
- Article media delivery → Media variants: selects variants (evidence: `src/app/api/article-media/[...path]/route.js`)
- Article media delivery → Supabase admin client: loads media (evidence: `src/app/api/article-media/[...path]/route.js`)
- Article media delivery → Supabase server client: checks visibility (evidence: `src/app/api/article-media/[...path]/route.js`)
- Article media delivery → Supabase public client: checks publication (evidence: `src/app/api/article-media/[...path]/route.js`)
- Supabase server client → Supabase configuration: loads config (evidence: `src/lib/supabase/server.js`)
- Supabase admin client → Supabase configuration: loads config (evidence: `src/lib/supabase/admin.js`)
- Supabase public client → Supabase configuration: loads config (evidence: `src/lib/supabase/public.js`)
- Supabase server client → Supabase services: uses auth and data (evidence: `README.md`)
- Supabase admin client → Supabase services: uses privileged access (evidence: `README.md`)
- Supabase browser client → Supabase services: uses client auth (evidence: `README.md`)
- Supabase public client → Supabase services: reads public content (evidence: `README.md`)
- Theme controls → Portal frame: appears in header
