# decseung/peach_market architecture

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

- Interactive diagram: https://gitdiagram.com/decseung/peach_market
- Repository: https://github.com/decseung/peach_market

## Overview

#### Purpose and Runtime
PeachMarket-React is a React single-page client for a social/community product with posts, profiles, chat, search, and account onboarding. The browser entry point is `src/index.js`, which mounts the root application in `src/App.js`; global styling is split across `src/index.css` and `src/styles/global.js`.

#### Application Composition and Navigation
`src/App.js` is the primary composition and routing boundary. Page-level features are organized by route/domain: home (`src/pages/home/home.js`), authentication (`src/pages/login/login.js`, `src/pages/signup/signup.js`), profile (`src/pages/profile/profile.js`), content authoring (`src/pages/write/write.js`), search (`src/pages/search/searh.js`), and chat (`src/pages/chat/ChatLayout.js`).

#### Responsive Shells and View Transitions
The UI has explicit desktop and mobile navigation structures. Desktop rendering is composed through `src/components/desktop/DesktopLayout.js`, `src/components/desktop/DesktopLeftSidebar.js`, and `src/components/desktop/DesktopRightSidebar.js`; mobile navigation is isolated in `src/components/MobileNavbarWrapper.js`. `src/components/PageTransition.js` and `src/components/PeachLoader.js` provide cross-page loading/transition presentation rather than feature-specific logic.

#### Authentication and User State
Authentication is a cross-cutting boundary centered on `src/controllers/auth.js` and client state in `src/store/authStore.js`. Firebase authentication integration is isolated under `src/services/firebase/auth.js`, with configuration in `src/utils/firebase-config.js`. Login, signup, and profile setup pages consume this identity flow through `src/pages/login/login.js`, `src/pages/signup/signup.js`, and `src/pages/profile/setprofile.js`.

#### API and Backend Boundary
Remote application operations are centralized in `src/services/api.js` and domain API modules: account (`src/services/api/account.js`), posts (`src/services/api/post.js`), comments (`src/services/api/comment.js`), chat (`src/services/api/chat.js`), and storage/bucket operations (`src/services/api/bucket.js`). This separation keeps page and component layers dependent on client service interfaces rather than direct transport details. `src/utils/dio.js` is a likely shared HTTP/client utility boundary.

#### Social Content and Profiles
The core social-content flow is: user identity → post retrieval/creation → preview/detail rendering → profile relationships. Home presentation begins at `src/pages/home/home.js`; reusable post views live in `src/components/post/preview.js` and `src/components/post/postdetail.js`. Profile screens and relationship lists are represented by `src/pages/profile/profile.js`, `src/pages/profile/followers.js`, and `src/pages/profile/followings.js`. Data model definitions are represented by `src/models/user.js`.

#### Realtime Chat
Chat has a separate layout and route decomposition: `src/pages/chat/ChatLayout.js` hosts list and room views in `src/pages/chat/list.js` and `src/pages/chat/room.js`. Reusable conversation rendering is in `src/components/chat/chatroom-tile.js`, while chat data/contracts are in `src/models/chat.js` and `src/services/api/chat.js`. `src/services/ws.js` is the websocket boundary, distinguishing realtime transport from request/response APIs.

#### Infrastructure and External Services
The client is built with the Node/npm ecosystem (`package.json`) and uses PostCSS/Tailwind configuration (`postcss.config.js`, `tailwind.config.js`). Static deployable assets and browser metadata reside under `public/`, including `public/index.html`, `public/manifest.json`, and `public/robots.txt`. Firebase is the explicitly evidenced external identity service; the API, bucket, and websocket modules indicate additional backend HTTP, object-storage, and realtime endpoints whose implementations are outside this repository.

Main entry points: [`src/App.js`](https://github.com/decseung/peach_market/blob/main/src/App.js) (App Router), [`src/services/api.js`](https://github.com/decseung/peach_market/blob/main/src/services/api.js) (API Client), [`src/pages/chat/ChatLayout.js`](https://github.com/decseung/peach_market/blob/main/src/pages/chat/ChatLayout.js) (Chat UI), [`src/controllers/auth.js`](https://github.com/decseung/peach_market/blob/main/src/controllers/auth.js) (Auth Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI &amp; Routes"]
  node_entry(("Browser Entry<br/>React bootstrap<br/>[index.js]"))
  node_app["App Router<br/>application composition<br/>[App.js]"]
  node_shells["Responsive Shells<br/>desktop/mobile navigation<br/>[DesktopLayout.js]"]
  node_transitions["Transition UI<br/>loading presentation<br/>[PageTransition.js]"]
  node_social["Home &amp; Posts<br/>social content feature<br/>[home.js]"]
  node_authoring["Post Authoring<br/>write route<br/>[write.js]"]
  node_profiles["Profiles &amp; Relationships<br/>profile feature<br/>[profile.js]"]
  node_search["Search<br/>[searh.js]"]
  node_chat["Chat UI<br/>chat route layout<br/>[ChatLayout.js]"]
  node_auth_pages["Login &amp; Signup<br/>authentication routes<br/>[login.js]"]
  node_onboarding["Profile Setup<br/>onboarding route<br/>[setprofile.js]"]
end

subgraph group_identity["Identity"]
  node_auth_controller["Auth Controller<br/>identity orchestration<br/>[auth.js]"]
  node_auth_store[("Auth Store<br/>client state<br/>[authStore.js]")]
  node_firebase_auth{{"Firebase Auth<br/>external identity adapter<br/>[auth.js]"}}
end

subgraph group_data["Data &amp; Realtime"]
  node_api["API Client<br/>remote service facade<br/>[api.js]"]
  node_http["HTTP Utility<br/>transport client<br/>[dio.js]"]
  node_ws{{"WebSocket Client<br/>realtime transport<br/>[ws.js]"}}
  node_user_model["User Model<br/>client data model<br/>[user.js]"]
  node_chat_model["Chat Model<br/>client data model<br/>[chat.js]"]
  node_backend{{"Backend Services"}}
end

node_entry -->|"mounts"| node_app
node_app -->|"composes"| node_shells
node_app -->|"uses"| node_transitions
node_app -->|"routes to"| node_social
node_app -->|"routes to"| node_authoring
node_app -->|"routes to"| node_profiles
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_chat
node_app -->|"routes to"| node_auth_pages
node_auth_pages -->|"authenticates through"| node_auth_controller
node_onboarding -->|"uses identity"| node_auth_controller
node_auth_controller -->|"updates"| node_auth_store
node_auth_controller -->|"delegates to"| node_firebase_auth
node_social -->|"loads posts"| node_api
node_authoring -->|"creates posts"| node_api
node_profiles -->|"loads accounts"| node_api
node_profiles -->|"uses"| node_user_model
node_search -->|"queries"| node_api
node_chat -->|"loads conversations"| node_api
node_chat -->|"receives realtime events"| node_ws
node_chat -->|"uses"| node_chat_model
node_api -->|"uses"| node_http
node_http -->|"HTTP requests"| node_backend
node_ws -->|"websocket connection"| node_backend
node_firebase_auth -.->|"identity state"| node_auth_store

click node_entry "https://github.com/decseung/peach_market/blob/main/src/index.js"
click node_app "https://github.com/decseung/peach_market/blob/main/src/App.js"
click node_shells "https://github.com/decseung/peach_market/blob/main/src/components/desktop/DesktopLayout.js"
click node_transitions "https://github.com/decseung/peach_market/blob/main/src/components/PageTransition.js"
click node_social "https://github.com/decseung/peach_market/blob/main/src/pages/home/home.js"
click node_authoring "https://github.com/decseung/peach_market/blob/main/src/pages/write/write.js"
click node_profiles "https://github.com/decseung/peach_market/blob/main/src/pages/profile/profile.js"
click node_search "https://github.com/decseung/peach_market/blob/main/src/pages/search/searh.js"
click node_chat "https://github.com/decseung/peach_market/blob/main/src/pages/chat/ChatLayout.js"
click node_auth_pages "https://github.com/decseung/peach_market/blob/main/src/pages/login/login.js"
click node_onboarding "https://github.com/decseung/peach_market/blob/main/src/pages/profile/setprofile.js"
click node_auth_controller "https://github.com/decseung/peach_market/blob/main/src/controllers/auth.js"
click node_auth_store "https://github.com/decseung/peach_market/blob/main/src/store/authStore.js"
click node_firebase_auth "https://github.com/decseung/peach_market/blob/main/src/services/firebase/auth.js"
click node_api "https://github.com/decseung/peach_market/blob/main/src/services/api.js"
click node_http "https://github.com/decseung/peach_market/blob/main/src/utils/dio.js"
click node_ws "https://github.com/decseung/peach_market/blob/main/src/services/ws.js"
click node_user_model "https://github.com/decseung/peach_market/blob/main/src/models/user.js"
click node_chat_model "https://github.com/decseung/peach_market/blob/main/src/models/chat.js"

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_entry,node_app,node_shells,node_transitions,node_social,node_authoring,node_profiles,node_search,node_chat,node_auth_pages,node_onboarding toneBlue
class node_auth_controller,node_auth_store,node_firebase_auth toneAmber
class node_api,node_http,node_ws,node_user_model,node_chat_model,node_backend toneMint
```

## Components

### UI & Routes

- [Browser Entry](https://github.com/decseung/peach_market/blob/main/src/index.js): React bootstrap · `src/index.js`
- [App Router](https://github.com/decseung/peach_market/blob/main/src/App.js): application composition · `src/App.js`
- [Responsive Shells](https://github.com/decseung/peach_market/blob/main/src/components/desktop/DesktopLayout.js): desktop/mobile navigation · Desktop layouts and mobile navigation wrapper. · `src/components/desktop/DesktopLayout.js`
- [Transition UI](https://github.com/decseung/peach_market/blob/main/src/components/PageTransition.js): loading presentation · `src/components/PageTransition.js`
- [Home & Posts](https://github.com/decseung/peach_market/blob/main/src/pages/home/home.js): social content feature · Home route and reusable post preview/detail views. · `src/pages/home/home.js`
- [Post Authoring](https://github.com/decseung/peach_market/blob/main/src/pages/write/write.js): write route · `src/pages/write/write.js`
- [Profiles & Relationships](https://github.com/decseung/peach_market/blob/main/src/pages/profile/profile.js): profile feature · Profile, followers, and following routes. · `src/pages/profile/profile.js`
- [Search](https://github.com/decseung/peach_market/blob/main/src/pages/search/searh.js): search route · `src/pages/search/searh.js`
- [Chat UI](https://github.com/decseung/peach_market/blob/main/src/pages/chat/ChatLayout.js): chat route layout · Hosts conversation list and room views. · `src/pages/chat/ChatLayout.js`
- [Login & Signup](https://github.com/decseung/peach_market/blob/main/src/pages/login/login.js): authentication routes · `src/pages/login/login.js`
- [Profile Setup](https://github.com/decseung/peach_market/blob/main/src/pages/profile/setprofile.js): onboarding route · `src/pages/profile/setprofile.js`

### Identity

- [Auth Controller](https://github.com/decseung/peach_market/blob/main/src/controllers/auth.js): identity orchestration · `src/controllers/auth.js`
- [Auth Store](https://github.com/decseung/peach_market/blob/main/src/store/authStore.js): client state · `src/store/authStore.js`
- [Firebase Auth](https://github.com/decseung/peach_market/blob/main/src/services/firebase/auth.js): external identity adapter · `src/services/firebase/auth.js`

### Data & Realtime

- [API Client](https://github.com/decseung/peach_market/blob/main/src/services/api.js): remote service facade · Central API and account, post, comment, chat, and bucket modules. · `src/services/api.js`
- [HTTP Utility](https://github.com/decseung/peach_market/blob/main/src/utils/dio.js): transport client · `src/utils/dio.js`
- [WebSocket Client](https://github.com/decseung/peach_market/blob/main/src/services/ws.js): realtime transport · `src/services/ws.js`
- [User Model](https://github.com/decseung/peach_market/blob/main/src/models/user.js): client data model · `src/models/user.js`
- [Chat Model](https://github.com/decseung/peach_market/blob/main/src/models/chat.js): client data model · `src/models/chat.js`
- **Backend Services**: external HTTP, storage & realtime · Remote API, object storage, and websocket endpoints are outside this repository.

## Connections

- Browser Entry → App Router: mounts
- App Router → Responsive Shells: composes
- App Router → Transition UI: uses
- App Router → Home & Posts: routes to
- App Router → Post Authoring: routes to
- App Router → Profiles & Relationships: routes to
- App Router → Search: routes to
- App Router → Chat UI: routes to
- App Router → Login & Signup: routes to
- Login & Signup → Auth Controller: authenticates through
- Profile Setup → Auth Controller: uses identity
- Auth Controller → Auth Store: updates
- Auth Controller → Firebase Auth: delegates to
- Home & Posts → API Client: loads posts
- Post Authoring → API Client: creates posts
- Profiles & Relationships → API Client: loads accounts
- Profiles & Relationships → User Model: uses
- Search → API Client: queries
- Chat UI → API Client: loads conversations
- Chat UI → WebSocket Client: receives realtime events
- Chat UI → Chat Model: uses
- API Client → HTTP Utility: uses
- HTTP Utility → Backend Services: HTTP requests
- WebSocket Client → Backend Services: websocket connection
- Firebase Auth → Auth Store: identity state
