# sure-block/sure architecture

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

- Interactive diagram: https://gitdiagram.com/sure-block/sure
- Repository: https://github.com/sure-block/sure

## Overview

Sure の小站 is a personal blog and interactive site with a Vue-based administration console. Visitors browse posts, photos, projects, bookmarks, and moments; they can comment or leave messages, while administrators manage content and site settings. Next.js pages and API routes handle these workflows, with Prisma-backed persistence and shared authentication and object-storage helpers. Music, a novel reader, and the Garden of interactive tools are additional visitor-facing capabilities. The README documents several features whose detailed implementation was not sampled, so those branches are shown at subsystem level; edges are limited to sampled references and documented relationships.

Main entry points: [`app/api/posts/route.ts`](https://github.com/sure-block/sure/blob/main/app/api/posts/route.ts) (Post endpoints), [`app/api`](https://github.com/sure-block/sure/tree/main/app/api) (Next.js API routes), [`app/lib/prisma.ts`](https://github.com/sure-block/sure/blob/main/app/lib/prisma.ts) (Prisma data access), [`app/api/music/route.ts`](https://github.com/sure-block/sure/blob/main/app/api/music/route.ts) (Music endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_visitor["Visitor experience"]
  node_home["Home dashboard<br/>[HomeClient.tsx]"]
  node_posts_view["Posts and comments<br/>[page.tsx]"]
  node_moments_view["Moments feed<br/>[page.tsx]"]
  node_music_view["Music experience<br/>[page.tsx]"]
  node_novel_view["Novel reader<br/>[page.tsx]"]
  node_garden["Interactive Garden"]
  node_music_provider["Music playback state<br/>[MusicProvider.tsx]"]
end

subgraph group_content["Content workflows"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin console"]
  node_admin_content["Content management"]
  node_admin_settings["Site configuration<br/>[index.vue]"]
end

subgraph group_services["API and services"]
  node_api["Next.js API routes"]
  node_posts_api["Post endpoints<br/>[route.ts]"]
  node_music_api["Music endpoints<br/>[route.ts]"]
  node_auth_routes["Authentication routes"]
  node_auth["Token authentication<br/>[auth.ts]"]
  node_messages_api["Message client<br/>[messages.ts]"]
end

subgraph group_storage["Persistence and integrations"]
  node_prisma["Prisma data access<br/>[prisma.ts]"]
  node_database[("SQLite database")]
  node_object_storage["R2 object storage<br/>[r2.ts]"]
  node_site_config["Site config data<br/>[site-config-db.ts]"]
  node_site_defaults["Default site settings<br/>[siteConfig.ts]"]
end

node_visitor(("Site visitor"))

node_visitor -->|"opens"| node_home
node_home -.->|"browses"| node_posts_view
node_visitor -->|"reads and comments"| node_posts_view
node_visitor -->|"reads and reacts"| node_moments_view
node_moments_view -->|"requests moments"| node_api
node_posts_view -->|"loads posts"| node_api
node_visitor -->|"plays music"| node_music_view
node_music_view -->|"uses playback state"| node_music_provider
node_visitor -.->|"reads novels"| node_novel_view
node_visitor -.->|"uses tools"| node_garden
node_admin_ui -.->|"manages posts"| node_admin_content
node_admin_ui -->|"manages settings"| node_admin_settings
node_admin_content -.->|"submits content"| node_posts_api
node_api -.->|"routes requests"| node_posts_api
node_posts_api -->|"checks identity"| node_auth
node_posts_api -->|"reads and writes"| node_prisma
node_music_api -->|"reads music"| node_prisma
node_auth_routes -.->|"uses tokens"| node_auth
node_prisma -->|"persists records"| node_database
node_site_config -->|"reads settings"| node_prisma
node_site_config -.->|"falls back to"| node_site_defaults
node_messages_api -.->|"calls endpoints"| node_api
node_music_api -->|"uploads audio"| node_object_storage
node_music_api -->|"checks administrator"| node_auth

click node_home "https://github.com/sure-block/sure/blob/main/app/HomeClient.tsx"
click node_posts_view "https://github.com/sure-block/sure/blob/main/app/posts/page.tsx"
click node_moments_view "https://github.com/sure-block/sure/blob/main/app/moments/page.tsx"
click node_music_view "https://github.com/sure-block/sure/blob/main/app/music/page.tsx"
click node_novel_view "https://github.com/sure-block/sure/blob/main/app/novel/%5BbookUrl%5D/page.tsx"
click node_garden "https://github.com/sure-block/sure/tree/main/app/garden"
click node_api "https://github.com/sure-block/sure/tree/main/app/api"
click node_posts_api "https://github.com/sure-block/sure/blob/main/app/api/posts/route.ts"
click node_music_api "https://github.com/sure-block/sure/blob/main/app/api/music/route.ts"
click node_auth_routes "https://github.com/sure-block/sure/tree/main/app/api/auth"
click node_auth "https://github.com/sure-block/sure/blob/main/app/lib/auth.ts"
click node_admin_ui "https://github.com/sure-block/sure/tree/main/admin/src"
click node_admin_content "https://github.com/sure-block/sure/tree/main/admin/src/views/post"
click node_admin_settings "https://github.com/sure-block/sure/blob/main/admin/src/views/site-config/index.vue"
click node_prisma "https://github.com/sure-block/sure/blob/main/app/lib/prisma.ts"
click node_object_storage "https://github.com/sure-block/sure/blob/main/app/lib/r2.ts"
click node_site_config "https://github.com/sure-block/sure/blob/main/app/lib/site-config-db.ts"
click node_site_defaults "https://github.com/sure-block/sure/blob/main/siteConfig.ts"
click node_music_provider "https://github.com/sure-block/sure/blob/main/components/providers/MusicProvider.tsx"
click node_messages_api "https://github.com/sure-block/sure/blob/main/app/api/messages.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_posts_view,node_moments_view,node_music_view,node_novel_view,node_garden,node_music_provider toneBlue
class node_admin_ui,node_admin_content,node_admin_settings toneMint
class node_api,node_posts_api,node_music_api,node_auth_routes,node_auth,node_messages_api toneRose
class node_prisma,node_database,node_object_storage,node_site_config,node_site_defaults,node_visitor toneIndigo
```

## Components

### Visitor experience

- [Home dashboard](https://github.com/sure-block/sure/blob/main/app/HomeClient.tsx): `app/HomeClient.tsx`
- [Posts and comments](https://github.com/sure-block/sure/blob/main/app/posts/page.tsx): `app/posts/page.tsx`
- [Moments feed](https://github.com/sure-block/sure/blob/main/app/moments/page.tsx): `app/moments/page.tsx`
- [Music experience](https://github.com/sure-block/sure/blob/main/app/music/page.tsx): `app/music/page.tsx`
- [Novel reader](https://github.com/sure-block/sure/blob/main/app/novel/%5BbookUrl%5D/page.tsx): `app/novel/[bookUrl]/page.tsx`
- [Interactive Garden](https://github.com/sure-block/sure/tree/main/app/garden): `app/garden`
- [Music playback state](https://github.com/sure-block/sure/blob/main/components/providers/MusicProvider.tsx): `components/providers/MusicProvider.tsx`

### Administration

- [Admin console](https://github.com/sure-block/sure/tree/main/admin/src): `admin/src`
- [Content management](https://github.com/sure-block/sure/tree/main/admin/src/views/post): `admin/src/views/post`
- [Site configuration](https://github.com/sure-block/sure/blob/main/admin/src/views/site-config/index.vue): `admin/src/views/site-config/index.vue`

### API and services

- [Next.js API routes](https://github.com/sure-block/sure/tree/main/app/api): `app/api`
- [Post endpoints](https://github.com/sure-block/sure/blob/main/app/api/posts/route.ts): `app/api/posts/route.ts`
- [Music endpoints](https://github.com/sure-block/sure/blob/main/app/api/music/route.ts): `app/api/music/route.ts`
- [Authentication routes](https://github.com/sure-block/sure/tree/main/app/api/auth): `app/api/auth`
- [Token authentication](https://github.com/sure-block/sure/blob/main/app/lib/auth.ts): `app/lib/auth.ts`
- [Message client](https://github.com/sure-block/sure/blob/main/app/api/messages.ts): `app/api/messages.ts`

### Persistence and integrations

- [Prisma data access](https://github.com/sure-block/sure/blob/main/app/lib/prisma.ts): `app/lib/prisma.ts`
- **SQLite database**
- [R2 object storage](https://github.com/sure-block/sure/blob/main/app/lib/r2.ts): `app/lib/r2.ts`
- [Site config data](https://github.com/sure-block/sure/blob/main/app/lib/site-config-db.ts): `app/lib/site-config-db.ts`
- [Default site settings](https://github.com/sure-block/sure/blob/main/siteConfig.ts): `siteConfig.ts`

### Other components

- **Site visitor**

## Connections

- Site visitor → Home dashboard: opens
- Home dashboard → Posts and comments: browses
- Site visitor → Posts and comments: reads and comments
- Site visitor → Moments feed: reads and reacts
- Moments feed → Next.js API routes: requests moments (evidence: `app/moments/page.tsx`)
- Posts and comments → Next.js API routes: loads posts (evidence: `app/posts/page.tsx`)
- Site visitor → Music experience: plays music
- Music experience → Music playback state: uses playback state (evidence: `app/music/page.tsx`)
- Site visitor → Novel reader: reads novels
- Site visitor → Interactive Garden: uses tools
- Admin console → Content management: manages posts
- Admin console → Site configuration: manages settings
- Content management → Post endpoints: submits content
- Next.js API routes → Post endpoints: routes requests
- Post endpoints → Token authentication: checks identity (evidence: `app/api/posts/route.ts`)
- Post endpoints → Prisma data access: reads and writes (evidence: `app/api/posts/route.ts`)
- Music endpoints → Prisma data access: reads music (evidence: `app/api/music/route.ts`)
- Authentication routes → Token authentication: uses tokens
- Prisma data access → SQLite database: persists records (evidence: `app/lib/prisma.ts`)
- Site config data → Prisma data access: reads settings (evidence: `app/lib/site-config-db.ts`)
- Site config data → Default site settings: falls back to
- Message client → Next.js API routes: calls endpoints (evidence: `app/api/messages.ts`)
- Music endpoints → R2 object storage: uploads audio
- Music endpoints → Token authentication: checks administrator
