# rockyflux/wanzhi architecture

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

- Interactive diagram: https://gitdiagram.com/rockyflux/wanzhi
- Repository: https://github.com/rockyflux/wanzhi

## Overview

Wanzi is a dynamic bookmark-directory web app: visitors browse themed packs, navigate category trees, search and export links; signed-in users can favorite links and track visits; administrators manage packs, categories, sites, imports, users and statistics. The Vue router selects views, while Pinia stores and shared libraries provide authentication and catalog behavior backed by Supabase. The README documents these capabilities and Supabase’s role; several view and store excerpts are partial, so unshown internal calls are not inferred.

Main entry points: [`src/stores/catalog.ts`](https://github.com/rockyflux/wanzhi/blob/main/src/stores/catalog.ts) (Catalog and activity), [`src/router/index.ts`](https://github.com/rockyflux/wanzhi/blob/main/src/router/index.ts) (Route selection), [`src/views/admin/AdminLayout.vue`](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminLayout.vue) (Admin workspace), [`src/stores/auth.ts`](https://github.com/rockyflux/wanzhi/blob/main/src/stores/auth.ts) (Authentication state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Bookmark browsing"]
  node_home["Home and pack pages<br/>[HomeView.vue]"]
  node_pack["Pack browsing<br/>[PackView.vue]"]
  node_site["Site details<br/>[SiteDetailView.vue]"]
end

subgraph group_identity["Accounts and activity"]
  node_favorites["Favorites<br/>[FavoritesView.vue]"]
  node_visits["Visit history<br/>[VisitsView.vue]"]
  node_login["Sign in<br/>[LoginView.vue]"]
  node_register["Registration<br/>[RegisterView.vue]"]
  node_authstore["Authentication state<br/>[auth.ts]"]
end

subgraph group_admin["Administration"]
  node_adminlayout["Admin workspace<br/>[AdminLayout.vue]"]
  node_adminpacks["Pack management<br/>[AdminPacks.vue]"]
  node_admincategories["Category management"]
  node_adminsites["Site management<br/>[AdminSites.vue]"]
  node_adminimport["Bookmark import<br/>[AdminImport.vue]"]
  node_adminusers["User management<br/>[AdminUsers.vue]"]
  node_adminstats["Statistics<br/>[AdminStats.vue]"]
  node_adminusage["Usage reporting<br/>[AdminUsage.vue]"]
end

subgraph group_core["Shared application core"]
  node_router["Route selection<br/>[index.ts]"]
  node_catalog["Catalog and activity<br/>[catalog.ts]"]
  node_tree["Category tree utilities<br/>[tree.ts]"]
  node_mappers["Data mapping<br/>[mappers.ts]"]
  node_categorycache["Category cache<br/>[categoryCache.ts]"]
  node_export["HTML and Markdown export<br/>[exportPack.ts]"]
  node_icons["Pack icon helpers<br/>[packIcons.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
end

node_visitor(("Visitor"))
node_member(("Signed-in user"))
node_administrator(("Administrator"))
node_supabase[("Supabase services and data")]

node_visitor -->|"opens pages"| node_router
node_member -->|"opens pages"| node_router
node_administrator -->|"opens admin"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_site
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_register
node_router -->|"routes to"| node_favorites
node_router -->|"routes to"| node_visits
node_router -->|"routes to"| node_adminlayout
node_router -->|"checks access"| node_authstore
node_home -->|"renders pack"| node_pack
node_home -->|"loads catalog"| node_catalog
node_pack -->|"loads and updates"| node_catalog
node_pack -->|"uses category paths"| node_tree
node_pack -->|"exports links"| node_export
node_site -->|"records activity"| node_catalog
node_site -->|"checks identity"| node_authstore
node_favorites -->|"loads favorites"| node_catalog
node_favorites -->|"exports links"| node_export
node_visits -->|"loads visits"| node_catalog
node_visits -->|"exports links"| node_export
node_login -->|"authenticates"| node_authstore
node_register -->|"registers account"| node_authstore
node_adminlayout -->|"hosts admin pages"| node_adminpacks
node_adminlayout -->|"hosts admin pages"| node_admincategories
node_adminlayout -->|"hosts admin pages"| node_adminsites
node_adminlayout -->|"hosts admin pages"| node_adminimport
node_adminlayout -->|"hosts admin pages"| node_adminusers
node_adminlayout -->|"hosts admin pages"| node_adminstats
node_adminlayout -->|"hosts admin pages"| node_adminusage
node_adminpacks -->|"manages packs"| node_catalog
node_admincategories -->|"manages categories"| node_catalog
node_adminsites -->|"manages sites"| node_catalog
node_adminimport -->|"imports catalog data"| node_catalog
node_adminusers -->|"manages users"| node_authstore
node_adminstats -->|"reads statistics"| node_catalog
node_adminusage -->|"queries usage"| node_supabaseclient
node_catalog -->|"maps records"| node_mappers
node_catalog -->|"reads and writes"| node_categorycache
node_catalog -->|"uses category lookup"| node_tree
node_catalog -->|"checks user state"| node_authstore
node_catalog -->|"queries and updates"| node_supabaseclient
node_authstore -->|"uses client"| node_supabaseclient
node_supabaseclient -->|"connects to"| node_supabase
node_visitor -.->|"downloads formats"| node_export
node_catalog -->|"uses icon helpers"| node_icons

click node_router "https://github.com/rockyflux/wanzhi/blob/main/src/router/index.ts"
click node_home "https://github.com/rockyflux/wanzhi/blob/main/src/views/HomeView.vue"
click node_pack "https://github.com/rockyflux/wanzhi/blob/main/src/views/PackView.vue"
click node_site "https://github.com/rockyflux/wanzhi/blob/main/src/views/SiteDetailView.vue"
click node_favorites "https://github.com/rockyflux/wanzhi/blob/main/src/views/FavoritesView.vue"
click node_visits "https://github.com/rockyflux/wanzhi/blob/main/src/views/VisitsView.vue"
click node_login "https://github.com/rockyflux/wanzhi/blob/main/src/views/LoginView.vue"
click node_register "https://github.com/rockyflux/wanzhi/blob/main/src/views/RegisterView.vue"
click node_authstore "https://github.com/rockyflux/wanzhi/blob/main/src/stores/auth.ts"
click node_adminlayout "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminLayout.vue"
click node_adminpacks "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminPacks.vue"
click node_admincategories "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminCategories.vue"
click node_adminsites "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminSites.vue"
click node_adminimport "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminImport.vue"
click node_adminusers "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminUsers.vue"
click node_adminstats "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminStats.vue"
click node_adminusage "https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminUsage.vue"
click node_catalog "https://github.com/rockyflux/wanzhi/blob/main/src/stores/catalog.ts"
click node_tree "https://github.com/rockyflux/wanzhi/blob/main/src/lib/tree.ts"
click node_mappers "https://github.com/rockyflux/wanzhi/blob/main/src/lib/mappers.ts"
click node_categorycache "https://github.com/rockyflux/wanzhi/blob/main/src/lib/categoryCache.ts"
click node_export "https://github.com/rockyflux/wanzhi/blob/main/src/lib/exportPack.ts"
click node_icons "https://github.com/rockyflux/wanzhi/blob/main/src/lib/packIcons.ts"
click node_supabaseclient "https://github.com/rockyflux/wanzhi/blob/main/src/lib/supabase.ts"

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_home,node_pack,node_site,node_member toneBlue
class node_favorites,node_visits,node_login,node_register,node_authstore,node_supabase toneAmber
class node_adminlayout,node_adminpacks,node_admincategories,node_adminsites,node_adminimport,node_adminusers,node_adminstats,node_adminusage toneMint
class node_router,node_catalog,node_tree,node_mappers,node_categorycache,node_export,node_icons,node_supabaseclient toneRose
class node_visitor,node_administrator toneIndigo
```

## Components

### Bookmark browsing

- [Home and pack pages](https://github.com/rockyflux/wanzhi/blob/main/src/views/HomeView.vue): `src/views/HomeView.vue`
- [Pack browsing](https://github.com/rockyflux/wanzhi/blob/main/src/views/PackView.vue): `src/views/PackView.vue`
- [Site details](https://github.com/rockyflux/wanzhi/blob/main/src/views/SiteDetailView.vue): `src/views/SiteDetailView.vue`

### Accounts and activity

- [Favorites](https://github.com/rockyflux/wanzhi/blob/main/src/views/FavoritesView.vue): `src/views/FavoritesView.vue`
- [Visit history](https://github.com/rockyflux/wanzhi/blob/main/src/views/VisitsView.vue): `src/views/VisitsView.vue`
- [Sign in](https://github.com/rockyflux/wanzhi/blob/main/src/views/LoginView.vue): `src/views/LoginView.vue`
- [Registration](https://github.com/rockyflux/wanzhi/blob/main/src/views/RegisterView.vue): `src/views/RegisterView.vue`
- [Authentication state](https://github.com/rockyflux/wanzhi/blob/main/src/stores/auth.ts): `src/stores/auth.ts`

### Administration

- [Admin workspace](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminLayout.vue): `src/views/admin/AdminLayout.vue`
- [Pack management](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminPacks.vue): `src/views/admin/AdminPacks.vue`
- [Category management](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminCategories.vue): `src/views/admin/AdminCategories.vue`
- [Site management](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminSites.vue): `src/views/admin/AdminSites.vue`
- [Bookmark import](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminImport.vue): `src/views/admin/AdminImport.vue`
- [User management](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminUsers.vue): `src/views/admin/AdminUsers.vue`
- [Statistics](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminStats.vue): `src/views/admin/AdminStats.vue`
- [Usage reporting](https://github.com/rockyflux/wanzhi/blob/main/src/views/admin/AdminUsage.vue): `src/views/admin/AdminUsage.vue`

### Shared application core

- [Route selection](https://github.com/rockyflux/wanzhi/blob/main/src/router/index.ts): `src/router/index.ts`
- [Catalog and activity](https://github.com/rockyflux/wanzhi/blob/main/src/stores/catalog.ts): `src/stores/catalog.ts`
- [Category tree utilities](https://github.com/rockyflux/wanzhi/blob/main/src/lib/tree.ts): `src/lib/tree.ts`
- [Data mapping](https://github.com/rockyflux/wanzhi/blob/main/src/lib/mappers.ts): `src/lib/mappers.ts`
- [Category cache](https://github.com/rockyflux/wanzhi/blob/main/src/lib/categoryCache.ts): `src/lib/categoryCache.ts`
- [HTML and Markdown export](https://github.com/rockyflux/wanzhi/blob/main/src/lib/exportPack.ts): `src/lib/exportPack.ts`
- [Pack icon helpers](https://github.com/rockyflux/wanzhi/blob/main/src/lib/packIcons.ts): `src/lib/packIcons.ts`
- [Supabase client](https://github.com/rockyflux/wanzhi/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Visitor**
- **Signed-in user**
- **Administrator**
- **Supabase services and data**

## Connections

- Visitor → Route selection: opens pages (evidence: `src/router/index.ts`)
- Signed-in user → Route selection: opens pages (evidence: `src/router/index.ts`)
- Administrator → Route selection: opens admin (evidence: `src/router/index.ts`)
- Route selection → Home and pack pages: routes to (evidence: `src/router/index.ts`)
- Route selection → Site details: routes to (evidence: `src/router/index.ts`)
- Route selection → Sign in: routes to (evidence: `src/router/index.ts`)
- Route selection → Registration: routes to (evidence: `src/router/index.ts`)
- Route selection → Favorites: routes to (evidence: `src/router/index.ts`)
- Route selection → Visit history: routes to (evidence: `src/router/index.ts`)
- Route selection → Admin workspace: routes to (evidence: `src/router/index.ts`)
- Route selection → Authentication state: checks access (evidence: `src/router/index.ts`)
- Home and pack pages → Pack browsing: renders pack (evidence: `src/views/HomeView.vue`)
- Home and pack pages → Catalog and activity: loads catalog (evidence: `src/views/HomeView.vue`)
- Pack browsing → Catalog and activity: loads and updates (evidence: `src/views/PackView.vue`)
- Pack browsing → Category tree utilities: uses category paths (evidence: `src/views/PackView.vue`)
- Pack browsing → HTML and Markdown export: exports links (evidence: `src/views/PackView.vue`)
- Site details → Catalog and activity: records activity (evidence: `src/views/SiteDetailView.vue`)
- Site details → Authentication state: checks identity (evidence: `src/views/SiteDetailView.vue`)
- Favorites → Catalog and activity: loads favorites (evidence: `src/views/FavoritesView.vue`)
- Favorites → HTML and Markdown export: exports links (evidence: `src/views/FavoritesView.vue`)
- Visit history → Catalog and activity: loads visits (evidence: `src/views/VisitsView.vue`)
- Visit history → HTML and Markdown export: exports links (evidence: `src/views/VisitsView.vue`)
- Sign in → Authentication state: authenticates (evidence: `src/views/LoginView.vue`)
- Registration → Authentication state: registers account (evidence: `src/views/RegisterView.vue`)
- Admin workspace → Pack management: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → Category management: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → Site management: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → Bookmark import: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → User management: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → Statistics: hosts admin pages (evidence: `src/router/index.ts`)
- Admin workspace → Usage reporting: hosts admin pages (evidence: `src/router/index.ts`)
- Pack management → Catalog and activity: manages packs (evidence: `src/views/admin/AdminPacks.vue`)
- Category management → Catalog and activity: manages categories (evidence: `src/views/admin/AdminCategories.vue`)
- Site management → Catalog and activity: manages sites (evidence: `src/views/admin/AdminSites.vue`)
- Bookmark import → Catalog and activity: imports catalog data (evidence: `src/views/admin/AdminImport.vue`)
- User management → Authentication state: manages users (evidence: `src/views/admin/AdminUsers.vue`)
- Statistics → Catalog and activity: reads statistics (evidence: `src/views/admin/AdminStats.vue`)
- Usage reporting → Supabase client: queries usage (evidence: `src/views/admin/AdminUsage.vue`)
- Catalog and activity → Data mapping: maps records (evidence: `src/stores/catalog.ts`)
- Catalog and activity → Category cache: reads and writes (evidence: `src/stores/catalog.ts`)
- Catalog and activity → Category tree utilities: uses category lookup (evidence: `src/stores/catalog.ts`)
- Catalog and activity → Authentication state: checks user state (evidence: `src/stores/catalog.ts`)
- Catalog and activity → Supabase client: queries and updates (evidence: `src/stores/catalog.ts`)
- Authentication state → Supabase client: uses client (evidence: `src/stores/auth.ts`)
- Supabase client → Supabase services and data: connects to (evidence: `README.md`)
- Visitor → HTML and Markdown export: downloads formats (evidence: `README.md`)
- Catalog and activity → Pack icon helpers: uses icon helpers (evidence: `src/stores/catalog.ts`)
