# spinhobby/spin-hobby architecture

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

- Interactive diagram: https://gitdiagram.com/spinhobby/spin-hobby
- Repository: https://github.com/spinhobby/spin-hobby

## Overview

Spin Hobby is a React storefront and commerce frontend, with customer and Square/merchant authentication, product discovery, cart and checkout, account features, and admin/cashier pages. The principal flow starts at the routed app, proceeds through catalog/search and product selection, then cart and checkout to payment and success. Redux reducers and sagas provide an internal state/async layer. The README only describes the app scaffold and deployment; unsampled page and API internals are represented by their exact tree paths, with uncertain connections omitted.

Main entry points: [`src/App.tsx`](https://github.com/spinhobby/spin-hobby/blob/master/src/App.tsx) (Router and shell), [`src/store.ts`](https://github.com/spinhobby/spin-hobby/blob/master/src/store.ts) (Redux store and reducers), [`src/api/square.ts`](https://github.com/spinhobby/spin-hobby/blob/master/src/api/square.ts) (Square commerce API), [`src/view/pages/Home/index.tsx`](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Home/index.tsx) (Home storefront)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["Router and shell<br/>[App.tsx]"]
end

subgraph group_shop["Storefront"]
  node_home["Home storefront<br/>[index.tsx]"]
  node_search["Search results<br/>[index.tsx]"]
  node_navsearch["Navigation search<br/>[Search.tsx]"]
  node_product["Product browsing<br/>[index.tsx]"]
  node_detail["Product detail<br/>[index.tsx]"]
  node_events["Events<br/>[index.tsx]"]
  node_square["Square commerce API<br/>[square.ts]"]
  node_homepageapi["Homepage API<br/>[homepage.ts]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Shopping cart<br/>[index.tsx]"]
  node_checkout["Checkout<br/>[index.tsx]"]
  node_payment["Square payments<br/>[square.ts]"]
  node_paypal["PayPal checkout support<br/>[index.tsx]"]
  node_success["Checkout success<br/>[index.tsx]"]
end

subgraph group_identity["Identity and state"]
  node_authinit["Auth initialization<br/>[useAuthInit.ts]"]
  node_customerapi["Customer auth API<br/>[customerAuth.ts]"]
  node_squareauth["Square auth service<br/>[squareAuth.ts]"]
  node_wishlist["Wishlist hook and API<br/>[useWishlist.ts]"]
  node_state["Redux store and reducers<br/>[store.ts]"]
  node_reducers["Domain reducers<br/>[cartReducer.ts]"]
  node_searchsaga["Search saga<br/>[searchSaga.ts]"]
end

subgraph group_operations["Admin and content"]
  node_api["Application API<br/>[index.ts]"]
  node_account["Account and orders<br/>[index.tsx]"]
  node_cashier["Cashier<br/>[index.tsx]"]
  node_admin["Homepage administration<br/>[index.tsx]"]
  node_eventsapi["Events API<br/>[events.ts]"]
end

node_customer(("Shopper"))
node_external[("Commerce backend")]

node_customer -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_product
node_app -->|"routes to"| node_detail
node_app -->|"routes to"| node_cart
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_success
node_app -->|"routes to"| node_events
node_app -->|"routes to"| node_account
node_app -->|"routes to"| node_cashier
node_app -->|"routes to"| node_admin
node_app -->|"initializes"| node_authinit
node_app -->|"reads state"| node_state
node_home -->|"loads catalog"| node_square
node_home -->|"loads content"| node_homepageapi
node_home -->|"uses"| node_wishlist
node_navsearch -->|"searches catalog"| node_square
node_search -->|"uses"| node_wishlist
node_cart -->|"loads commerce data"| node_square
node_checkout -->|"creates payment"| node_payment
node_payment -->|"sends payment request"| node_external
node_checkout -.->|"offers payment UI"| node_paypal
node_authinit -->|"checks merchant session"| node_squareauth
node_authinit -->|"checks customer session"| node_customerapi
node_authinit -->|"dispatches auth state"| node_state
node_wishlist -->|"reads user state"| node_state
node_wishlist -.->|"loads and updates"| node_external
node_state -->|"combines reducers"| node_reducers
node_state -->|"runs sagas"| node_searchsaga
node_searchsaga -->|"fetches search results"| node_api
node_searchsaga -->|"loads inventory"| node_square
node_searchsaga -->|"dispatches results"| node_reducers
node_api -->|"delegates catalog lookup"| node_square

click node_app "https://github.com/spinhobby/spin-hobby/blob/master/src/App.tsx"
click node_home "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Home/index.tsx"
click node_search "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Search/index.tsx"
click node_navsearch "https://github.com/spinhobby/spin-hobby/blob/master/src/view/components/NavBarV2/Search.tsx"
click node_product "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Product/index.tsx"
click node_detail "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/ProductDetail/index.tsx"
click node_events "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Events/index.tsx"
click node_cart "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Cart/index.tsx"
click node_checkout "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/CheckOut/index.tsx"
click node_payment "https://github.com/spinhobby/spin-hobby/blob/master/src/api/square.ts"
click node_paypal "https://github.com/spinhobby/spin-hobby/blob/master/src/view/components/Paypal/index.tsx"
click node_success "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/CheckoutSuccess/index.tsx"
click node_square "https://github.com/spinhobby/spin-hobby/blob/master/src/api/square.ts"
click node_homepageapi "https://github.com/spinhobby/spin-hobby/blob/master/src/api/homepage.ts"
click node_authinit "https://github.com/spinhobby/spin-hobby/blob/master/src/hooks/useAuthInit.ts"
click node_customerapi "https://github.com/spinhobby/spin-hobby/blob/master/src/api/customerAuth.ts"
click node_squareauth "https://github.com/spinhobby/spin-hobby/blob/master/src/api/squareAuth.ts"
click node_wishlist "https://github.com/spinhobby/spin-hobby/blob/master/src/hooks/useWishlist.ts"
click node_state "https://github.com/spinhobby/spin-hobby/blob/master/src/store.ts"
click node_reducers "https://github.com/spinhobby/spin-hobby/blob/master/src/reducers/cartReducer.ts"
click node_searchsaga "https://github.com/spinhobby/spin-hobby/blob/master/src/saga/searchSaga.ts"
click node_api "https://github.com/spinhobby/spin-hobby/blob/master/src/api/index.ts"
click node_account "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Account/index.tsx"
click node_cashier "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Cashier/index.tsx"
click node_admin "https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/HomepageAdmin/index.tsx"
click node_eventsapi "https://github.com/spinhobby/spin-hobby/blob/master/src/api/events.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_app toneBlue
class node_home,node_search,node_navsearch,node_product,node_detail,node_events,node_square,node_homepageapi,node_external toneAmber
class node_cart,node_checkout,node_payment,node_paypal,node_success toneMint
class node_authinit,node_customerapi,node_squareauth,node_wishlist,node_state,node_reducers,node_searchsaga toneRose
class node_api,node_account,node_cashier,node_admin,node_eventsapi,node_customer toneIndigo
```

## Components

### Application shell

- [Router and shell](https://github.com/spinhobby/spin-hobby/blob/master/src/App.tsx): `src/App.tsx`

### Storefront

- [Home storefront](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Home/index.tsx): `src/view/pages/Home/index.tsx`
- [Search results](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Search/index.tsx): `src/view/pages/Search/index.tsx`
- [Navigation search](https://github.com/spinhobby/spin-hobby/blob/master/src/view/components/NavBarV2/Search.tsx): `src/view/components/NavBarV2/Search.tsx`
- [Product browsing](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Product/index.tsx): `src/view/pages/Product/index.tsx`
- [Product detail](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/ProductDetail/index.tsx): `src/view/pages/ProductDetail/index.tsx`
- [Events](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Events/index.tsx): `src/view/pages/Events/index.tsx`
- [Square commerce API](https://github.com/spinhobby/spin-hobby/blob/master/src/api/square.ts): `src/api/square.ts`
- [Homepage API](https://github.com/spinhobby/spin-hobby/blob/master/src/api/homepage.ts): `src/api/homepage.ts`

### Commerce

- [Shopping cart](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Cart/index.tsx): `src/view/pages/Cart/index.tsx`
- [Checkout](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/CheckOut/index.tsx): `src/view/pages/CheckOut/index.tsx`
- [Square payments](https://github.com/spinhobby/spin-hobby/blob/master/src/api/square.ts): `src/api/square.ts`
- [PayPal checkout support](https://github.com/spinhobby/spin-hobby/blob/master/src/view/components/Paypal/index.tsx): `src/view/components/Paypal/index.tsx`
- [Checkout success](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/CheckoutSuccess/index.tsx): `src/view/pages/CheckoutSuccess/index.tsx`

### Identity and state

- [Auth initialization](https://github.com/spinhobby/spin-hobby/blob/master/src/hooks/useAuthInit.ts): `src/hooks/useAuthInit.ts`
- [Customer auth API](https://github.com/spinhobby/spin-hobby/blob/master/src/api/customerAuth.ts): `src/api/customerAuth.ts`
- [Square auth service](https://github.com/spinhobby/spin-hobby/blob/master/src/api/squareAuth.ts): `src/api/squareAuth.ts`
- [Wishlist hook and API](https://github.com/spinhobby/spin-hobby/blob/master/src/hooks/useWishlist.ts): `src/hooks/useWishlist.ts`
- [Redux store and reducers](https://github.com/spinhobby/spin-hobby/blob/master/src/store.ts): `src/store.ts`
- [Domain reducers](https://github.com/spinhobby/spin-hobby/blob/master/src/reducers/cartReducer.ts): `src/reducers/cartReducer.ts`
- [Search saga](https://github.com/spinhobby/spin-hobby/blob/master/src/saga/searchSaga.ts): `src/saga/searchSaga.ts`

### Admin and content

- [Application API](https://github.com/spinhobby/spin-hobby/blob/master/src/api/index.ts): `src/api/index.ts`
- [Account and orders](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Account/index.tsx): `src/view/pages/Account/index.tsx`
- [Cashier](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/Cashier/index.tsx): `src/view/pages/Cashier/index.tsx`
- [Homepage administration](https://github.com/spinhobby/spin-hobby/blob/master/src/view/pages/HomepageAdmin/index.tsx): `src/view/pages/HomepageAdmin/index.tsx`
- [Events API](https://github.com/spinhobby/spin-hobby/blob/master/src/api/events.ts): `src/api/events.ts`

### Other components

- **Shopper**
- **Commerce backend**

## Connections

- Shopper → Router and shell: opens (evidence: `src/App.tsx`)
- Router and shell → Home storefront: routes to (evidence: `src/App.tsx`)
- Router and shell → Search results: routes to (evidence: `src/App.tsx`)
- Router and shell → Product browsing: routes to (evidence: `src/App.tsx`)
- Router and shell → Product detail: routes to (evidence: `src/App.tsx`)
- Router and shell → Shopping cart: routes to (evidence: `src/App.tsx`)
- Router and shell → Checkout: routes to (evidence: `src/App.tsx`)
- Router and shell → Checkout success: routes to (evidence: `src/App.tsx`)
- Router and shell → Events: routes to (evidence: `src/App.tsx`)
- Router and shell → Account and orders: routes to (evidence: `src/App.tsx`)
- Router and shell → Cashier: routes to (evidence: `src/App.tsx`)
- Router and shell → Homepage administration: routes to (evidence: `src/App.tsx`)
- Router and shell → Auth initialization: initializes (evidence: `src/App.tsx`)
- Router and shell → Redux store and reducers: reads state (evidence: `src/App.tsx`)
- Home storefront → Square commerce API: loads catalog (evidence: `src/view/pages/Home/index.tsx`)
- Home storefront → Homepage API: loads content (evidence: `src/view/pages/Home/index.tsx`)
- Home storefront → Wishlist hook and API: uses (evidence: `src/view/pages/Home/index.tsx`)
- Navigation search → Square commerce API: searches catalog (evidence: `src/view/components/NavBarV2/Search.tsx`)
- Search results → Wishlist hook and API: uses (evidence: `src/view/pages/Search/index.tsx`)
- Shopping cart → Square commerce API: loads commerce data (evidence: `src/view/pages/Cart/index.tsx`)
- Checkout → Square payments: creates payment (evidence: `src/view/pages/CheckOut/index.tsx`)
- Square payments → Commerce backend: sends payment request (evidence: `src/api/square.ts`)
- Checkout → PayPal checkout support: offers payment UI
- Auth initialization → Square auth service: checks merchant session (evidence: `src/hooks/useAuthInit.ts`)
- Auth initialization → Customer auth API: checks customer session (evidence: `src/hooks/useAuthInit.ts`)
- Auth initialization → Redux store and reducers: dispatches auth state (evidence: `src/hooks/useAuthInit.ts`)
- Wishlist hook and API → Redux store and reducers: reads user state (evidence: `src/hooks/useWishlist.ts`)
- Wishlist hook and API → Commerce backend: loads and updates
- Redux store and reducers → Domain reducers: combines reducers (evidence: `src/store.ts`)
- Redux store and reducers → Search saga: runs sagas (evidence: `src/store.ts`)
- Search saga → Application API: fetches search results (evidence: `src/saga/searchSaga.ts`)
- Search saga → Square commerce API: loads inventory (evidence: `src/saga/searchSaga.ts`)
- Search saga → Domain reducers: dispatches results (evidence: `src/saga/searchSaga.ts`)
- Application API → Square commerce API: delegates catalog lookup (evidence: `src/api/index.ts`)
