# hankyung-toss-delta/sallae-malrae architecture

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

- Interactive diagram: https://gitdiagram.com/hankyung-toss-delta/sallae-malrae
- Repository: https://github.com/hankyung-toss-delta/sallae-malrae

## Overview

살래말래 is an impulse-purchase “cooling-off” service: users register a contemplated purchase, wait through a chosen cooling-off period, then decide whether to buy or pass. Passing updates savings statistics and the user’s level; the repository also includes account/session flows, a dashboard, and share views. The README provides only a brief product description, so some UI-to-API and dashboard data links are shown as unverified rather than asserted as inspected calls.

Main entry points: [`src/lib/db.js`](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/db.js) (MariaDB access), [`src/app/coolingoff/page.jsx`](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/coolingoff/page.jsx) (Cooling-off list), [`src/app/api/items/route.js`](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/route.js) (Item registration and listing), [`src/lib/auth.js`](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/auth.js) (Session verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User experience"]
  node_landing["Landing experience<br/>[page.jsx]"]
  node_landingday["Landing day state"]
  node_header["Navigation and logout<br/>[Header.jsx]"]
end

subgraph group_identity["Accounts and sessions"]
  node_signup["Signup screen<br/>[page.jsx]"]
  node_login["Login screen<br/>[page.jsx]"]
  node_authcontext["Client auth state<br/>[AuthContext.jsx]"]
  node_signupapi["Account creation<br/>[route.js]"]
  node_loginapi["Login and tokens<br/>[route.js]"]
  node_refreshapi["Token refresh<br/>[route.js]"]
  node_logoutapi["Logout<br/>[route.js]"]
  node_tokenmiddleware["Token middleware<br/>[middleware.js]"]
end

subgraph group_cooling["Cooling-off lifecycle"]
  node_itemform["New purchase entry<br/>[page.jsx]"]
  node_itemlist["Cooling-off list<br/>[page.jsx]"]
  node_itemcomponents["Entry and decision UI"]
  node_pendingsection["Pending items UI"]
  node_itemapi["Item registration and listing<br/>[route.js]"]
  node_itemdelete["Item deletion<br/>[route.js]"]
  node_itemdecision["Purchase decision<br/>[route.js]"]
end

subgraph group_insights["Progress and sharing"]
  node_dashboard["Progress dashboard<br/>[page.jsx]"]
  node_dashboardcontent["Dashboard content"]
  node_shareapi["Share token creation<br/>[route.js]"]
  node_sharepage["Shared progress view<br/>[page.jsx]"]
  node_shareview["Share presentation<br/>[ShareView.jsx]"]
end

subgraph group_runtime["Application services"]
  node_status["Item status definitions<br/>[status.js]"]
  node_level["Level calculation<br/>[level.js]"]
  node_authlib["Session verification<br/>[auth.js]"]
  node_jwt["JWT operations<br/>[jwt.js]"]
  node_database[("MariaDB access<br/>[db.js]")]
  node_gcs["Image upload adapter<br/>[gcs.js]"]
end

node_visitor(("Visitor"))
node_member(("Signed-in user"))
node_mariadb[("MariaDB")]
node_cloudstorage[("Google Cloud Storage")]

node_visitor -->|"opens"| node_landing
node_landing -->|"uses state"| node_landingday
node_landing -->|"renders"| node_header
node_member -.->|"creates account"| node_signup
node_member -.->|"signs in"| node_login
node_signup -.->|"submits signup"| node_signupapi
node_login -.->|"submits credentials"| node_loginapi
node_loginapi -->|"reads and writes"| node_database
node_loginapi -->|"issues tokens"| node_jwt
node_signupapi -->|"creates account"| node_database
node_signupapi -->|"validates inputs"| node_authlib
node_refreshapi -->|"rotates token"| node_database
node_refreshapi -->|"verifies and issues"| node_jwt
node_logoutapi -->|"clears session"| node_database
node_header -->|"calls logout"| node_authcontext
node_tokenmiddleware -->|"verifies token"| node_jwt
node_member -.->|"registers purchase"| node_itemform
node_itemform -.->|"submits item"| node_itemapi
node_member -.->|"reviews items"| node_itemlist
node_itemlist -->|"renders"| node_pendingsection
node_itemlist -->|"renders"| node_itemcomponents
node_itemlist -->|"uses level data"| node_level
node_itemlist -.->|"loads items"| node_itemapi
node_itemapi -->|"checks session"| node_authlib
node_itemapi -->|"reads and writes"| node_database
node_itemapi -->|"uploads image"| node_gcs
node_gcs -.->|"stores image"| node_cloudstorage
node_itemdelete -->|"checks session"| node_authlib
node_itemdelete -->|"deletes item"| node_database
node_itemdecision -->|"checks session"| node_authlib
node_itemdecision -->|"updates transaction"| node_database
node_itemdecision -->|"calculates level"| node_level
node_itemdecision -->|"checks status"| node_status
node_member -.->|"views progress"| node_dashboard
node_dashboard -.->|"renders"| node_dashboardcontent
node_member -.->|"requests share link"| node_shareapi
node_shareapi -->|"checks session"| node_authlib
node_shareapi -->|"reads and writes"| node_database
node_visitor -.->|"opens shared view"| node_sharepage
node_sharepage -.->|"renders"| node_shareview
node_shareview -->|"uses level data"| node_level
node_database -->|"queries"| node_mariadb

click node_landing "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/page.jsx"
click node_landingday "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/contexts/LandingDayContext.jsx"
click node_header "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/layout/Header.jsx"
click node_signup "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/auth/signup/page.jsx"
click node_login "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/auth/login/page.jsx"
click node_authcontext "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/contexts/AuthContext.jsx"
click node_signupapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/signup/route.js"
click node_loginapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/login/route.js"
click node_refreshapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/refresh/route.js"
click node_logoutapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/logout/route.js"
click node_tokenmiddleware "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/middleware.js"
click node_itemform "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/coolingoff/new/page.jsx"
click node_itemlist "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/coolingoff/page.jsx"
click node_itemcomponents "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/coolingoff/list/CoolingOffDetailPanel.jsx"
click node_pendingsection "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/coolingoff/list/PendingItemsSection.jsx"
click node_itemapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/route.js"
click node_itemdelete "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/%5Bid%5D/route.js"
click node_itemdecision "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/%5Bid%5D/status/route.js"
click node_status "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/constants/status.js"
click node_dashboard "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/dashboard/page.jsx"
click node_dashboardcontent "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/dashboard/DashboardContent.jsx"
click node_shareapi "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/share/token/route.js"
click node_sharepage "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/share/%5BshareToken%5D/page.jsx"
click node_shareview "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/share/ShareView.jsx"
click node_level "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/level.js"
click node_authlib "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/auth.js"
click node_jwt "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/jwt.js"
click node_database "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/db.js"
click node_gcs "https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/gcs.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_landing,node_landingday,node_header,node_member toneBlue
class node_signup,node_login,node_authcontext,node_signupapi,node_loginapi,node_refreshapi,node_logoutapi,node_tokenmiddleware,node_mariadb,node_cloudstorage toneAmber
class node_itemform,node_itemlist,node_itemcomponents,node_pendingsection,node_itemapi,node_itemdelete,node_itemdecision toneMint
class node_dashboard,node_dashboardcontent,node_shareapi,node_sharepage,node_shareview toneRose
class node_status,node_level,node_authlib,node_jwt,node_database,node_gcs,node_visitor toneIndigo
```

## Components

### User experience

- [Landing experience](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/page.jsx): `src/app/page.jsx`
- [Landing day state](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/contexts/LandingDayContext.jsx): `src/contexts/LandingDayContext.jsx`
- [Navigation and logout](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/layout/Header.jsx): `src/components/layout/Header.jsx`

### Accounts and sessions

- [Signup screen](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/auth/signup/page.jsx): `src/app/auth/signup/page.jsx`
- [Login screen](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/auth/login/page.jsx): `src/app/auth/login/page.jsx`
- [Client auth state](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/contexts/AuthContext.jsx): `src/contexts/AuthContext.jsx`
- [Account creation](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/signup/route.js): `src/app/api/auth/signup/route.js`
- [Login and tokens](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/login/route.js): `src/app/api/auth/login/route.js`
- [Token refresh](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/refresh/route.js): `src/app/api/auth/refresh/route.js`
- [Logout](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/auth/logout/route.js): `src/app/api/auth/logout/route.js`
- [Token middleware](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/middleware.js): `src/middleware.js`

### Cooling-off lifecycle

- [New purchase entry](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/coolingoff/new/page.jsx): `src/app/coolingoff/new/page.jsx`
- [Cooling-off list](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/coolingoff/page.jsx): `src/app/coolingoff/page.jsx`
- [Entry and decision UI](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/coolingoff/list/CoolingOffDetailPanel.jsx): `src/components/coolingoff/list/CoolingOffDetailPanel.jsx`
- [Pending items UI](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/coolingoff/list/PendingItemsSection.jsx): `src/components/coolingoff/list/PendingItemsSection.jsx`
- [Item registration and listing](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/route.js): `src/app/api/items/route.js`
- [Item deletion](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/%5Bid%5D/route.js): `src/app/api/items/[id]/route.js`
- [Purchase decision](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/items/%5Bid%5D/status/route.js): `src/app/api/items/[id]/status/route.js`

### Progress and sharing

- [Progress dashboard](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/dashboard/page.jsx): `src/app/dashboard/page.jsx`
- [Dashboard content](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/dashboard/DashboardContent.jsx): `src/components/dashboard/DashboardContent.jsx`
- [Share token creation](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/api/share/token/route.js): `src/app/api/share/token/route.js`
- [Shared progress view](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/app/share/%5BshareToken%5D/page.jsx): `src/app/share/[shareToken]/page.jsx`
- [Share presentation](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/components/share/ShareView.jsx): `src/components/share/ShareView.jsx`

### Application services

- [Item status definitions](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/constants/status.js): `src/constants/status.js`
- [Level calculation](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/level.js): `src/lib/level.js`
- [Session verification](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/auth.js): `src/lib/auth.js`
- [JWT operations](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/jwt.js): `src/lib/jwt.js`
- [MariaDB access](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/db.js): `src/lib/db.js`
- [Image upload adapter](https://github.com/hankyung-toss-delta/sallae-malrae/blob/main/src/lib/gcs.js): `src/lib/gcs.js`

### Other components

- **Visitor**
- **Signed-in user**
- **MariaDB**
- **Google Cloud Storage**

## Connections

- Visitor → Landing experience: opens (evidence: `src/app/page.jsx`)
- Landing experience → Landing day state: uses state (evidence: `src/app/page.jsx`)
- Landing experience → Navigation and logout: renders (evidence: `src/app/page.jsx`)
- Signed-in user → Signup screen: creates account
- Signed-in user → Login screen: signs in
- Signup screen → Account creation: submits signup
- Login screen → Login and tokens: submits credentials
- Login and tokens → MariaDB access: reads and writes (evidence: `src/app/api/auth/login/route.js`)
- Login and tokens → JWT operations: issues tokens (evidence: `src/app/api/auth/login/route.js`)
- Account creation → MariaDB access: creates account (evidence: `src/app/api/auth/signup/route.js`)
- Account creation → Session verification: validates inputs (evidence: `src/app/api/auth/signup/route.js`)
- Token refresh → MariaDB access: rotates token (evidence: `src/app/api/auth/refresh/route.js`)
- Token refresh → JWT operations: verifies and issues (evidence: `src/app/api/auth/refresh/route.js`)
- Logout → MariaDB access: clears session (evidence: `src/app/api/auth/logout/route.js`)
- Navigation and logout → Client auth state: calls logout (evidence: `src/components/layout/Header.jsx`)
- Token middleware → JWT operations: verifies token (evidence: `src/middleware.js`)
- Signed-in user → New purchase entry: registers purchase
- New purchase entry → Item registration and listing: submits item
- Signed-in user → Cooling-off list: reviews items
- Cooling-off list → Pending items UI: renders (evidence: `src/app/coolingoff/page.jsx`)
- Cooling-off list → Entry and decision UI: renders (evidence: `src/app/coolingoff/page.jsx`)
- Cooling-off list → Level calculation: uses level data (evidence: `src/app/coolingoff/page.jsx`)
- Cooling-off list → Item registration and listing: loads items
- Item registration and listing → Session verification: checks session (evidence: `src/app/api/items/route.js`)
- Item registration and listing → MariaDB access: reads and writes (evidence: `src/app/api/items/route.js`)
- Item registration and listing → Image upload adapter: uploads image (evidence: `src/app/api/items/route.js`)
- Image upload adapter → Google Cloud Storage: stores image
- Item deletion → Session verification: checks session (evidence: `src/app/api/items/[id]/route.js`)
- Item deletion → MariaDB access: deletes item (evidence: `src/app/api/items/[id]/route.js`)
- Purchase decision → Session verification: checks session (evidence: `src/app/api/items/[id]/status/route.js`)
- Purchase decision → MariaDB access: updates transaction (evidence: `src/app/api/items/[id]/status/route.js`)
- Purchase decision → Level calculation: calculates level (evidence: `src/app/api/items/[id]/status/route.js`)
- Purchase decision → Item status definitions: checks status (evidence: `src/app/api/items/[id]/status/route.js`)
- Signed-in user → Progress dashboard: views progress
- Progress dashboard → Dashboard content: renders
- Signed-in user → Share token creation: requests share link
- Share token creation → Session verification: checks session (evidence: `src/app/api/share/token/route.js`)
- Share token creation → MariaDB access: reads and writes (evidence: `src/app/api/share/token/route.js`)
- Visitor → Shared progress view: opens shared view
- Shared progress view → Share presentation: renders
- Share presentation → Level calculation: uses level data (evidence: `src/components/share/ShareView.jsx`)
- MariaDB access → MariaDB: queries (evidence: `src/lib/db.js`)
