# haizdwng/animalrestaurantshop architecture

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

- Interactive diagram: https://gitdiagram.com/haizdwng/animalrestaurantshop
- Repository: https://github.com/haizdwng/animalrestaurantshop

## Overview

This is a Vietnamese game-account portal for authentication, browsing and buying shop items, topping up coins, editing an avatar and managing account activity; administrators also manage players, users, gift codes and shop data. The principal flow is session boot or sign-in, role-aware navigation, then shop readiness/catalogue loading and purchase or top-up, with account refreshes after relevant actions. The graph preserves documented administration and avatar branches. Relationships are limited to calls visible in excerpts or references listed in the SOURCE INDEX; unsampled feature-to-API behavior is not inferred.

Main entry points: [`src/application/App.jsx`](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/application/App.jsx) (App and navigation), [`src/features/administration/AdminPanel.jsx`](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/AdminPanel.jsx) (Admin console), [`src/shared/library/api`](https://github.com/haizdwng/animalrestaurantshop/tree/main/src/shared/library/api) (API client and services), [`src/shared/library/api/client.js`](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/library/api/client.js) (HTTP transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App and navigation<br/>[App.jsx]"]
  node_api["API client and services"]
  node_api_transport["HTTP transport<br/>[client.js]"]
end

subgraph group_identity["Identity and account"]
  node_session["Session lifecycle<br/>[useSession.js]"]
  node_auth["Sign-in and registration<br/>[Auth.jsx]"]
  node_account["Account and transactions"]
end

subgraph group_commerce["Shop and payments"]
  node_shop_state["Shop data loader<br/>[useShop.js]"]
  node_shop["Shop catalogue<br/>[Shop.jsx]"]
  node_purchase["Item purchase<br/>[BuyDialog.jsx]"]
  node_topup["Coin top-up<br/>[TopUp.jsx]"]
  node_payment["Payment tracking<br/>[PaymentDialog.jsx]"]
end

subgraph group_avatar["Avatar editor"]
  node_avatar["Avatar editor<br/>[Avatar.jsx]"]
  node_avatar_stage["Avatar rendering stage<br/>[AvatarStage.jsx]"]
  node_avatar_state["Editor state"]
  node_avatar_render["Rendering utilities<br/>[avatarRendering.js]"]
  node_avatar_assets["Asset manifest and geometry"]
end

subgraph group_admin["Administration"]
  node_admin["Admin console<br/>[AdminPanel.jsx]"]
  node_giftcodes["Gift-code management<br/>[GiftCodes.jsx]"]
  node_players["Player management<br/>[Players.jsx]"]
  node_users["User management<br/>[Users.jsx]"]
  node_shop_admin["Shop editor<br/>[ShopEditor.jsx]"]
end

node_visitor(("Visitor"))
node_server["Backend API"]
node_browser_store[("Browser local storage")]

node_visitor -->|"opens"| node_app
node_app -->|"checks session"| node_session
node_app -->|"shows for guests"| node_auth
node_auth -->|"reports sign-in"| node_app
node_session -->|"requests identity"| node_api
node_app -->|"loads when active"| node_shop_state
node_app -->|"renders shop"| node_shop
node_app -->|"renders account"| node_account
node_app -->|"renders editor"| node_avatar
node_app -->|"renders admin"| node_admin
node_shop_state -->|"checks and fetches"| node_api
node_shop -->|"shows top-up"| node_topup
node_shop -->|"opens purchase"| node_purchase
node_topup -->|"opens payment"| node_payment
node_payment -->|"checks transaction"| node_api
node_admin -->|"includes management"| node_giftcodes
node_admin -->|"includes management"| node_players
node_admin -->|"includes management"| node_users
node_admin -->|"includes editor"| node_shop_admin
node_avatar -->|"renders stage"| node_avatar_stage
node_avatar_stage -->|"uses rendering"| node_avatar_render
node_avatar_render -->|"uses geometry and assets"| node_avatar_assets
node_avatar_state -->|"uses manifest and config"| node_avatar_assets
node_avatar_stage -->|"uses geometry and loading"| node_avatar_assets
node_api -->|"exports client"| node_api_transport
node_api_transport -->|"sends HTTP requests"| node_server
node_api_transport -->|"reads and writes token"| node_browser_store

click node_app "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/application/App.jsx"
click node_session "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/hooks/useSession.js"
click node_auth "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/authentication/Auth.jsx"
click node_account "https://github.com/haizdwng/animalrestaurantshop/tree/main/src/features/account"
click node_api "https://github.com/haizdwng/animalrestaurantshop/tree/main/src/shared/library/api"
click node_api_transport "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/library/api/client.js"
click node_shop_state "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/hooks/useShop.js"
click node_shop "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/shop/Shop.jsx"
click node_purchase "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/shop/BuyDialog.jsx"
click node_topup "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/components/payment/TopUp.jsx"
click node_payment "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/components/payment/PaymentDialog.jsx"
click node_avatar "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/Avatar.jsx"
click node_avatar_stage "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/AvatarStage.jsx"
click node_avatar_state "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/avatarEditorState.js"
click node_avatar_render "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/avatarRendering.js"
click node_avatar_assets "https://github.com/haizdwng/animalrestaurantshop/tree/main/src/features/avatar"
click node_admin "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/AdminPanel.jsx"
click node_giftcodes "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/GiftCodes.jsx"
click node_players "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/Players.jsx"
click node_users "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/Users.jsx"
click node_shop_admin "https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/ShopEditor.jsx"

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_app,node_api,node_api_transport toneBlue
class node_session,node_auth,node_account,node_browser_store toneAmber
class node_shop_state,node_shop,node_purchase,node_topup,node_payment,node_server toneMint
class node_avatar,node_avatar_stage,node_avatar_state,node_avatar_render,node_avatar_assets toneRose
class node_admin,node_giftcodes,node_players,node_users,node_shop_admin,node_visitor toneIndigo
```

## Components

### Application shell

- [App and navigation](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/application/App.jsx): `src/application/App.jsx`
- [API client and services](https://github.com/haizdwng/animalrestaurantshop/tree/main/src/shared/library/api): `src/shared/library/api`
- [HTTP transport](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/library/api/client.js): `src/shared/library/api/client.js`

### Identity and account

- [Session lifecycle](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/hooks/useSession.js): `src/shared/hooks/useSession.js`
- [Sign-in and registration](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/authentication/Auth.jsx): `src/features/authentication/Auth.jsx`
- [Account and transactions](https://github.com/haizdwng/animalrestaurantshop/tree/main/src/features/account): `src/features/account`

### Shop and payments

- [Shop data loader](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/hooks/useShop.js): `src/shared/hooks/useShop.js`
- [Shop catalogue](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/shop/Shop.jsx): `src/features/shop/Shop.jsx`
- [Item purchase](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/shop/BuyDialog.jsx): `src/features/shop/BuyDialog.jsx`
- [Coin top-up](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/components/payment/TopUp.jsx): `src/shared/components/payment/TopUp.jsx`
- [Payment tracking](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/shared/components/payment/PaymentDialog.jsx): `src/shared/components/payment/PaymentDialog.jsx`

### Avatar editor

- [Avatar editor](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/Avatar.jsx): `src/features/avatar/Avatar.jsx`
- [Avatar rendering stage](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/AvatarStage.jsx): `src/features/avatar/AvatarStage.jsx`
- [Editor state](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/avatarEditorState.js): `src/features/avatar/avatarEditorState.js`
- [Rendering utilities](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/avatar/avatarRendering.js): `src/features/avatar/avatarRendering.js`
- [Asset manifest and geometry](https://github.com/haizdwng/animalrestaurantshop/tree/main/src/features/avatar): `src/features/avatar`

### Administration

- [Admin console](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/AdminPanel.jsx): `src/features/administration/AdminPanel.jsx`
- [Gift-code management](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/GiftCodes.jsx): `src/features/administration/GiftCodes.jsx`
- [Player management](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/Players.jsx): `src/features/administration/Players.jsx`
- [User management](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/Users.jsx): `src/features/administration/Users.jsx`
- [Shop editor](https://github.com/haizdwng/animalrestaurantshop/blob/main/src/features/administration/ShopEditor.jsx): `src/features/administration/ShopEditor.jsx`

### Other components

- **Visitor**
- **Backend API**
- **Browser local storage**

## Connections

- Visitor → App and navigation: opens (evidence: `src/application/App.jsx`)
- App and navigation → Session lifecycle: checks session (evidence: `src/application/App.jsx`)
- App and navigation → Sign-in and registration: shows for guests (evidence: `src/application/App.jsx`)
- Sign-in and registration → App and navigation: reports sign-in (evidence: `src/application/App.jsx`)
- Session lifecycle → API client and services: requests identity (evidence: `src/shared/hooks/useSession.js`)
- App and navigation → Shop data loader: loads when active (evidence: `src/application/App.jsx`)
- App and navigation → Shop catalogue: renders shop (evidence: `src/application/App.jsx`)
- App and navigation → Account and transactions: renders account (evidence: `src/application/App.jsx`)
- App and navigation → Avatar editor: renders editor (evidence: `src/application/App.jsx`)
- App and navigation → Admin console: renders admin (evidence: `src/application/App.jsx`)
- Shop data loader → API client and services: checks and fetches (evidence: `src/shared/hooks/useShop.js`)
- Shop catalogue → Coin top-up: shows top-up (evidence: `src/features/shop/Shop.jsx`)
- Shop catalogue → Item purchase: opens purchase (evidence: `src/features/shop/Shop.jsx`)
- Coin top-up → Payment tracking: opens payment (evidence: `src/shared/components/payment/TopUp.jsx`)
- Payment tracking → API client and services: checks transaction (evidence: `src/shared/components/payment/PaymentDialog.jsx`)
- Admin console → Gift-code management: includes management
- Admin console → Player management: includes management
- Admin console → User management: includes management
- Admin console → Shop editor: includes editor
- Avatar editor → Avatar rendering stage: renders stage (evidence: `src/features/avatar/AvatarStage.jsx`)
- Avatar rendering stage → Rendering utilities: uses rendering (evidence: `src/features/avatar/AvatarStage.jsx`)
- Rendering utilities → Asset manifest and geometry: uses geometry and assets (evidence: `src/features/avatar/avatarRendering.js`)
- Editor state → Asset manifest and geometry: uses manifest and config (evidence: `src/features/avatar/avatarEditorState.js`)
- Avatar rendering stage → Asset manifest and geometry: uses geometry and loading (evidence: `src/features/avatar/AvatarStage.jsx`)
- API client and services → HTTP transport: exports client (evidence: `src/shared/library/api/index.js`)
- HTTP transport → Backend API: sends HTTP requests (evidence: `src/shared/library/api/client.js`)
- HTTP transport → Browser local storage: reads and writes token (evidence: `src/shared/library/api/client.js`)
