# hh12356/dotpub architecture

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

- Interactive diagram: https://gitdiagram.com/hh12356/dotpub
- Repository: https://github.com/hh12356/dotpub

## Overview

DotPub is a technical-article community. Visitors browse, search, and read articles; registered users authenticate to publish and manage articles, comments, likes, and bookmarks; administrators moderate users/content and view analytics. The frontend routes pages and calls the FastAPI API layer, whose handlers enforce permissions and operate on ORM models. The README documents additional user, moderation, and analytics capabilities whose implementation was not sampled, so those links are shown only at the subsystem level. The AI assistant is documented and its frontend streaming call is visible; backend wiring beyond the chat router registration was not sampled.

Main entry points: [`frontend/src/pages/Layout/index.jsx`](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Layout/index.jsx) (Community layout), [`backend/main.py`](https://github.com/hh12356/dotpub/blob/master/backend/main.py) (FastAPI application), [`frontend/src/apis`](https://github.com/hh12356/dotpub/tree/master/frontend/src/apis) (API clients), [`backend/models`](https://github.com/hh12356/dotpub/tree/master/backend/models) (Community records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_browser["React application<br/>[index.jsx]"]
  node_routes["Page routing<br/>[index.jsx]"]
  node_layout["Community layout<br/>[index.jsx]"]
  node_home["Article discovery<br/>[index.jsx]"]
  node_article_page["Article detail<br/>[index.jsx]"]
  node_write["Article editor<br/>[index.jsx]"]
  node_search["Article search<br/>[index.jsx]"]
  node_user_pages["User lists and profile"]
  node_admin_page["Admin dashboard<br/>[index.jsx]"]
  node_chat_ui["AI chat widget<br/>[index.jsx]"]
  node_frontend_apis["API clients"]
end

subgraph group_api["API services"]
  node_entry["FastAPI application<br/>[main.py]"]
  node_auth_api["Authentication endpoints<br/>[login.py]"]
  node_signup_api["Registration endpoints<br/>[sign_up.py]"]
  node_article_api["Article and comment endpoints<br/>[article.py]"]
  node_user_api["User endpoints<br/>[user.py]"]
  node_admin_api["Administration endpoints<br/>[admin.py]"]
  node_chat_api["Chat endpoint<br/>[chat.py]"]
  node_security["Authentication and permissions<br/>[security.py]"]
end

subgraph group_domain["Community domain"]
  node_models["Community records"]
end

subgraph group_platform["Runtime platform"]
  node_db[("MySQL database")]
  node_ai_service["AI service"]
end

node_visitor(("Visitor / user"))

node_visitor -->|"uses"| node_browser
node_browser -->|"renders"| node_routes
node_routes -->|"routes pages"| node_layout
node_layout -->|"shows discovery"| node_home
node_layout -->|"opens article"| node_article_page
node_layout -->|"opens editor"| node_write
node_layout -->|"opens search"| node_search
node_layout -->|"opens account"| node_user_pages
node_routes -->|"guards admin"| node_admin_page
node_layout -->|"mounts assistant"| node_chat_ui
node_home -->|"requests lists"| node_frontend_apis
node_search -->|"requests search"| node_frontend_apis
node_article_page -->|"requests article actions"| node_frontend_apis
node_write -->|"submits article"| node_frontend_apis
node_user_pages -->|"requests user data"| node_frontend_apis
node_admin_page -->|"requests metrics"| node_frontend_apis
node_chat_ui -->|"streams prompts"| node_frontend_apis
node_frontend_apis -->|"calls API"| node_entry
node_entry -->|"mounts router"| node_auth_api
node_entry -->|"mounts router"| node_signup_api
node_entry -->|"mounts router"| node_article_api
node_entry -->|"mounts router"| node_user_api
node_entry -->|"mounts router"| node_admin_api
node_entry -->|"mounts router"| node_chat_api
node_auth_api -->|"uses token security"| node_security
node_signup_api -->|"creates accounts"| node_models
node_auth_api -->|"checks accounts"| node_models
node_article_api -->|"checks permissions"| node_security
node_article_api -->|"reads and writes"| node_models
node_user_api -->|"checks identity"| node_security
node_user_api -->|"reads and updates"| node_models
node_admin_api -->|"checks admin role"| node_security
node_admin_api -->|"aggregates and moderates"| node_models
node_models -->|"persists records"| node_db
node_chat_api -.->|"streams responses"| node_ai_service

click node_browser "https://github.com/hh12356/dotpub/blob/master/frontend/src/index.jsx"
click node_routes "https://github.com/hh12356/dotpub/blob/master/frontend/src/router/index.jsx"
click node_layout "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Layout/index.jsx"
click node_home "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Home/index.jsx"
click node_article_page "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Article/index.jsx"
click node_write "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Write/index.jsx"
click node_search "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Search/index.jsx"
click node_user_pages "https://github.com/hh12356/dotpub/tree/master/frontend/src/pages/User"
click node_admin_page "https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Admin/index.jsx"
click node_chat_ui "https://github.com/hh12356/dotpub/blob/master/frontend/src/components/ChatFloat/index.jsx"
click node_frontend_apis "https://github.com/hh12356/dotpub/tree/master/frontend/src/apis"
click node_entry "https://github.com/hh12356/dotpub/blob/master/backend/main.py"
click node_auth_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/login.py"
click node_signup_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/sign_up.py"
click node_article_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/article.py"
click node_user_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/user.py"
click node_admin_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/admin.py"
click node_chat_api "https://github.com/hh12356/dotpub/blob/master/backend/apis/chat.py"
click node_security "https://github.com/hh12356/dotpub/blob/master/backend/core/security.py"
click node_models "https://github.com/hh12356/dotpub/tree/master/backend/models"

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_browser,node_routes,node_layout,node_home,node_article_page,node_write,node_search,node_user_pages,node_admin_page,node_chat_ui,node_frontend_apis,node_visitor toneBlue
class node_entry,node_auth_api,node_signup_api,node_article_api,node_user_api,node_admin_api,node_chat_api,node_security toneAmber
class node_models toneMint
class node_db,node_ai_service toneRose
```

## Components

### Web application

- [React application](https://github.com/hh12356/dotpub/blob/master/frontend/src/index.jsx): `frontend/src/index.jsx`
- [Page routing](https://github.com/hh12356/dotpub/blob/master/frontend/src/router/index.jsx): `frontend/src/router/index.jsx`
- [Community layout](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Layout/index.jsx): `frontend/src/pages/Layout/index.jsx`
- [Article discovery](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Home/index.jsx): `frontend/src/pages/Home/index.jsx`
- [Article detail](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Article/index.jsx): `frontend/src/pages/Article/index.jsx`
- [Article editor](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Write/index.jsx): `frontend/src/pages/Write/index.jsx`
- [Article search](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Search/index.jsx): `frontend/src/pages/Search/index.jsx`
- [User lists and profile](https://github.com/hh12356/dotpub/tree/master/frontend/src/pages/User): `frontend/src/pages/User`
- [Admin dashboard](https://github.com/hh12356/dotpub/blob/master/frontend/src/pages/Admin/index.jsx): `frontend/src/pages/Admin/index.jsx`
- [AI chat widget](https://github.com/hh12356/dotpub/blob/master/frontend/src/components/ChatFloat/index.jsx): `frontend/src/components/ChatFloat/index.jsx`
- [API clients](https://github.com/hh12356/dotpub/tree/master/frontend/src/apis): `frontend/src/apis`

### API services

- [FastAPI application](https://github.com/hh12356/dotpub/blob/master/backend/main.py): `backend/main.py`
- [Authentication endpoints](https://github.com/hh12356/dotpub/blob/master/backend/apis/login.py): `backend/apis/login.py`
- [Registration endpoints](https://github.com/hh12356/dotpub/blob/master/backend/apis/sign_up.py): `backend/apis/sign_up.py`
- [Article and comment endpoints](https://github.com/hh12356/dotpub/blob/master/backend/apis/article.py): `backend/apis/article.py`
- [User endpoints](https://github.com/hh12356/dotpub/blob/master/backend/apis/user.py): `backend/apis/user.py`
- [Administration endpoints](https://github.com/hh12356/dotpub/blob/master/backend/apis/admin.py): `backend/apis/admin.py`
- [Chat endpoint](https://github.com/hh12356/dotpub/blob/master/backend/apis/chat.py): `backend/apis/chat.py`
- [Authentication and permissions](https://github.com/hh12356/dotpub/blob/master/backend/core/security.py): `backend/core/security.py`

### Community domain

- [Community records](https://github.com/hh12356/dotpub/tree/master/backend/models): `backend/models`

### Runtime platform

- **MySQL database**
- **AI service**

### Other components

- **Visitor / user**

## Connections

- Visitor / user → React application: uses
- React application → Page routing: renders
- Page routing → Community layout: routes pages
- Community layout → Article discovery: shows discovery
- Community layout → Article detail: opens article
- Community layout → Article editor: opens editor
- Community layout → Article search: opens search
- Community layout → User lists and profile: opens account
- Page routing → Admin dashboard: guards admin
- Community layout → AI chat widget: mounts assistant
- Article discovery → API clients: requests lists
- Article search → API clients: requests search
- Article detail → API clients: requests article actions
- Article editor → API clients: submits article
- User lists and profile → API clients: requests user data
- Admin dashboard → API clients: requests metrics
- AI chat widget → API clients: streams prompts
- API clients → FastAPI application: calls API
- FastAPI application → Authentication endpoints: mounts router
- FastAPI application → Registration endpoints: mounts router
- FastAPI application → Article and comment endpoints: mounts router
- FastAPI application → User endpoints: mounts router
- FastAPI application → Administration endpoints: mounts router
- FastAPI application → Chat endpoint: mounts router
- Authentication endpoints → Authentication and permissions: uses token security
- Registration endpoints → Community records: creates accounts
- Authentication endpoints → Community records: checks accounts
- Article and comment endpoints → Authentication and permissions: checks permissions
- Article and comment endpoints → Community records: reads and writes
- User endpoints → Authentication and permissions: checks identity
- User endpoints → Community records: reads and updates
- Administration endpoints → Authentication and permissions: checks admin role
- Administration endpoints → Community records: aggregates and moderates
- Community records → MySQL database: persists records
- Chat endpoint → AI service: streams responses
