# shathing/shathing-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/shathing/shathing-frontend
- Repository: https://github.com/shathing/shathing-frontend

## Overview

Shathing is a localized frontend for neighborhood item sharing. Its main flow is browsing and filtering share listings, opening a detail, and—when authenticated—creating or editing a post with region/category selection and image upload. Authentication and protected profile/chat areas extend that flow; chat loads history over REST and exchanges live messages over STOMP. Evidence is strongest for sampled listing, post, region, auth, and chat-hook code; other documented capabilities are represented at their supported route or directory paths.

Main entry points: [`src/app/[locale]/(with-layout)/(protected)/post/page.tsx`](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/post/page.tsx) (Post editor), [`src/apis/share.ts`](https://github.com/shathing/shathing-frontend/blob/main/src/apis/share.ts) (Share API), [`src/apis/config.ts`](https://github.com/shathing/shathing-frontend/blob/main/src/apis/config.ts) (HTTP client), [`src/app/[locale]/(with-layout)/share/ClientShareItemList.tsx`](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/share/ClientShareItemList.tsx) (Share listing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App routing"]
  node_proxy["Locale proxy<br/>[proxy.ts]"]
  node_i18n["Locale routing<br/>[routing.ts]"]
  node_home["Home landing<br/>[page.tsx]"]
end

subgraph group_sharing["Sharing workflow"]
  node_listing["Share listing"]
  node_detail["Share detail<br/>[page.tsx]"]
  node_post["Post editor<br/>[page.tsx]"]
  node_region["Region selector<br/>[Region.tsx]"]
  node_category["Category selector<br/>[Category.tsx]"]
  node_poststate["Post selection state"]
  node_shareapi["Share API<br/>[share.ts]"]
  node_fileapi["Image upload API<br/>[file.ts]"]
end

subgraph group_identity["Identity and access"]
  node_authpage["Authentication pages<br/>[AuthForm.tsx]"]
  node_authapi["Auth API<br/>[auth.ts]"]
  node_guard["Protected layout<br/>[layout.tsx]"]
  node_profile["Profile page<br/>[page.tsx]"]
end

subgraph group_messaging["Chat"]
  node_chatui["Chat interface<br/>[ChatPanel.tsx]"]
  node_chatlist["Chat room list<br/>[ChatList.tsx]"]
  node_chatmessages["Room messages hook"]
  node_chatapi["Chat REST API<br/>[chat.ts]"]
end

subgraph group_platform["Client platform"]
  node_providers["App providers<br/>[index.tsx]"]
  node_query["Query cache"]
  node_http["HTTP client<br/>[config.ts]"]
end

node_user(("Visitor"))
node_cdn["R2 / CDN"]
node_backend["Spring backend"]
node_stomp["STOMP service"]

node_user -->|"opens localized app"| node_proxy
node_proxy -->|"uses locale rules"| node_i18n
node_user -->|"browses"| node_home
node_home -.->|"opens listings"| node_listing
node_listing -->|"fetches pages"| node_shareapi
node_shareapi -->|"sends requests"| node_http
node_http -.->|"calls REST"| node_backend
node_listing -.->|"opens item"| node_detail
node_detail -->|"loads item"| node_shareapi
node_user -->|"creates or edits"| node_post
node_post -->|"loads and saves"| node_shareapi
node_post -->|"requests upload"| node_fileapi
node_fileapi -.->|"uploads image"| node_cdn
node_post -->|"renders selector"| node_region
node_post -->|"renders selector"| node_category
node_region -->|"updates selection"| node_poststate
node_category -->|"updates selection"| node_poststate
node_user -->|"authenticates"| node_authpage
node_authpage -.->|"submits credentials"| node_authapi
node_authapi -->|"sends requests"| node_http
node_guard -.->|"redirects unauthenticated"| node_authpage
node_user -.->|"views profile"| node_profile
node_user -.->|"opens chat"| node_chatui
node_chatui -->|"shows rooms"| node_chatlist
node_chatui -.->|"loads room messages"| node_chatmessages
node_chatmessages -->|"fetches history"| node_chatapi
node_chatapi -.->|"sends requests"| node_http
node_chatmessages -->|"subscribes and publishes"| node_stomp
node_stomp -.->|"exchanges live messages"| node_backend
node_providers -->|"installs provider"| node_query

click node_proxy "https://github.com/shathing/shathing-frontend/blob/main/src/proxy.ts"
click node_i18n "https://github.com/shathing/shathing-frontend/blob/main/src/i18n/routing.ts"
click node_home "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/page.tsx"
click node_listing "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/share/ClientShareItemList.tsx"
click node_detail "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/share/%5Bid%5D/page.tsx"
click node_post "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/post/page.tsx"
click node_region "https://github.com/shathing/shathing-frontend/blob/main/src/components/Region.tsx"
click node_category "https://github.com/shathing/shathing-frontend/blob/main/src/components/Category.tsx"
click node_poststate "https://github.com/shathing/shathing-frontend/blob/main/src/stores/useShareItemPostStore.ts"
click node_shareapi "https://github.com/shathing/shathing-frontend/blob/main/src/apis/share.ts"
click node_fileapi "https://github.com/shathing/shathing-frontend/blob/main/src/apis/file.ts"
click node_authpage "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/auth/AuthForm.tsx"
click node_authapi "https://github.com/shathing/shathing-frontend/blob/main/src/apis/auth.ts"
click node_guard "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/layout.tsx"
click node_profile "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/me/page.tsx"
click node_chatui "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/chat/ChatPanel.tsx"
click node_chatlist "https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/chat/ChatList.tsx"
click node_chatmessages "https://github.com/shathing/shathing-frontend/blob/main/src/hooks/chat/useChatRoomMessages.ts"
click node_chatapi "https://github.com/shathing/shathing-frontend/blob/main/src/apis/chat.ts"
click node_providers "https://github.com/shathing/shathing-frontend/blob/main/src/providers/index.tsx"
click node_query "https://github.com/shathing/shathing-frontend/blob/main/src/providers/ReactQueryProvider.tsx"
click node_http "https://github.com/shathing/shathing-frontend/blob/main/src/apis/config.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_proxy,node_i18n,node_home toneBlue
class node_listing,node_detail,node_post,node_region,node_category,node_poststate,node_shareapi,node_fileapi toneAmber
class node_authpage,node_authapi,node_guard,node_profile toneMint
class node_chatui,node_chatlist,node_chatmessages,node_chatapi toneRose
class node_providers,node_query,node_http,node_user,node_cdn,node_backend,node_stomp toneIndigo
```

## Components

### App routing

- [Locale proxy](https://github.com/shathing/shathing-frontend/blob/main/src/proxy.ts): `src/proxy.ts`
- [Locale routing](https://github.com/shathing/shathing-frontend/blob/main/src/i18n/routing.ts): `src/i18n/routing.ts`
- [Home landing](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/page.tsx): `src/app/[locale]/(with-layout)/page.tsx`

### Sharing workflow

- [Share listing](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/share/ClientShareItemList.tsx): `src/app/[locale]/(with-layout)/share/ClientShareItemList.tsx`
- [Share detail](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/share/%5Bid%5D/page.tsx): `src/app/[locale]/(with-layout)/share/[id]/page.tsx`
- [Post editor](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/post/page.tsx): `src/app/[locale]/(with-layout)/(protected)/post/page.tsx`
- [Region selector](https://github.com/shathing/shathing-frontend/blob/main/src/components/Region.tsx): `src/components/Region.tsx`
- [Category selector](https://github.com/shathing/shathing-frontend/blob/main/src/components/Category.tsx): `src/components/Category.tsx`
- [Post selection state](https://github.com/shathing/shathing-frontend/blob/main/src/stores/useShareItemPostStore.ts): `src/stores/useShareItemPostStore.ts`
- [Share API](https://github.com/shathing/shathing-frontend/blob/main/src/apis/share.ts): `src/apis/share.ts`
- [Image upload API](https://github.com/shathing/shathing-frontend/blob/main/src/apis/file.ts): `src/apis/file.ts`

### Identity and access

- [Authentication pages](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/auth/AuthForm.tsx): `src/app/[locale]/auth/AuthForm.tsx`
- [Auth API](https://github.com/shathing/shathing-frontend/blob/main/src/apis/auth.ts): `src/apis/auth.ts`
- [Protected layout](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/layout.tsx): `src/app/[locale]/(with-layout)/(protected)/layout.tsx`
- [Profile page](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/me/page.tsx): `src/app/[locale]/(with-layout)/(protected)/me/page.tsx`

### Chat

- [Chat interface](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/chat/ChatPanel.tsx): `src/app/[locale]/(with-layout)/(protected)/chat/ChatPanel.tsx`
- [Chat room list](https://github.com/shathing/shathing-frontend/blob/main/src/app/%5Blocale%5D/(with-layout)/(protected)/chat/ChatList.tsx): `src/app/[locale]/(with-layout)/(protected)/chat/ChatList.tsx`
- [Room messages hook](https://github.com/shathing/shathing-frontend/blob/main/src/hooks/chat/useChatRoomMessages.ts): `src/hooks/chat/useChatRoomMessages.ts`
- [Chat REST API](https://github.com/shathing/shathing-frontend/blob/main/src/apis/chat.ts): `src/apis/chat.ts`

### Client platform

- [App providers](https://github.com/shathing/shathing-frontend/blob/main/src/providers/index.tsx): `src/providers/index.tsx`
- [Query cache](https://github.com/shathing/shathing-frontend/blob/main/src/providers/ReactQueryProvider.tsx): `src/providers/ReactQueryProvider.tsx`
- [HTTP client](https://github.com/shathing/shathing-frontend/blob/main/src/apis/config.ts): `src/apis/config.ts`

### Other components

- **Visitor**
- **R2 / CDN**
- **Spring backend**
- **STOMP service**

## Connections

- Visitor → Locale proxy: opens localized app
- Locale proxy → Locale routing: uses locale rules (evidence: `src/proxy.ts`)
- Visitor → Home landing: browses
- Home landing → Share listing: opens listings
- Share listing → Share API: fetches pages (evidence: `src/app/[locale]/(with-layout)/share/ClientShareItemList.tsx`)
- Share API → HTTP client: sends requests (evidence: `src/apis/share.ts`)
- HTTP client → Spring backend: calls REST
- Share listing → Share detail: opens item
- Share detail → Share API: loads item (evidence: `src/app/[locale]/(with-layout)/share/[id]/page.tsx`)
- Visitor → Post editor: creates or edits
- Post editor → Share API: loads and saves (evidence: `src/app/[locale]/(with-layout)/(protected)/post/page.tsx`)
- Post editor → Image upload API: requests upload (evidence: `src/app/[locale]/(with-layout)/(protected)/post/page.tsx`)
- Image upload API → R2 / CDN: uploads image
- Post editor → Region selector: renders selector (evidence: `src/app/[locale]/(with-layout)/(protected)/post/page.tsx`)
- Post editor → Category selector: renders selector (evidence: `src/app/[locale]/(with-layout)/(protected)/post/page.tsx`)
- Region selector → Post selection state: updates selection (evidence: `src/components/Region.tsx`)
- Category selector → Post selection state: updates selection (evidence: `src/components/Category.tsx`)
- Visitor → Authentication pages: authenticates
- Authentication pages → Auth API: submits credentials
- Auth API → HTTP client: sends requests (evidence: `src/apis/auth.ts`)
- Protected layout → Authentication pages: redirects unauthenticated
- Visitor → Profile page: views profile
- Visitor → Chat interface: opens chat
- Chat interface → Chat room list: shows rooms
- Chat interface → Room messages hook: loads room messages
- Room messages hook → Chat REST API: fetches history (evidence: `src/hooks/chat/useChatRoomMessages.ts`)
- Chat REST API → HTTP client: sends requests
- Room messages hook → STOMP service: subscribes and publishes (evidence: `src/hooks/chat/useChatRoomMessages.ts`)
- STOMP service → Spring backend: exchanges live messages
- App providers → Query cache: installs provider (evidence: `src/providers/index.tsx`)
