# llmeajinll/nextgacha architecture

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

- Interactive diagram: https://gitdiagram.com/llmeajinll/nextgacha
- Repository: https://github.com/llmeajinll/nextgacha

## Overview

Next Gacha is a commerce site designed to limit bulk buying: users browse and search products, adjust cart quantities, pay with points through TossPayments, and track orders; administrators manage catalog content and fulfillment. The README documents a five-unit-per-person policy checked at cart, API, and payment stages, plus transactional payment processing. The payment-confirmation route excerpt shows the server-side validation, Toss approval, and MongoDB transaction calls. Other feature links below reflect documented capabilities; unsampled route implementations were not inspected.

Main entry points: [`src/app/api/postPaymentsConfirm/route.ts`](https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postPaymentsConfirm/route.ts) (Payment confirmation), [`src/app/(router)/manager/page.tsx`](https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/manager/page.tsx) (Admin workspace), [`src/app/api/postCheckToSending/route.ts`](https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postCheckToSending/route.ts) (Order fulfillment), [`src/shared/api/mongodb.ts`](https://github.com/llmeajinll/nextgacha/blob/main/src/shared/api/mongodb.ts) (MongoDB collections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Shopfront"]
  node_storefront["Storefront pages<br/>[page.tsx]"]
  node_catalog["Catalog and detail<br/>[DetailPage.tsx]"]
  node_search["Product search<br/>[SearchPage.tsx]"]
end

subgraph group_purchase["Purchase and fulfillment"]
  node_cart["Cart<br/>[Cart.tsx]"]
  node_quantity["Quantity policy<br/>[checkCartLimit.ts]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_payment_api["Payment confirmation<br/>[route.ts]"]
  node_payment_rules["Order validation<br/>[verifyOrder.ts]"]
  node_stock["Stock validation<br/>[validateStock.ts]"]
  node_toss["TossPayments<br/>[toss.ts]"]
  node_order_write["Order transaction<br/>[addOrder.ts]"]
end

subgraph group_account["Customer account"]
  node_history["Order history<br/>[getHistory.ts]"]
  node_reviews_qna["Reviews and Q&amp;A<br/>[ReviewModal.tsx]"]
end

subgraph group_admin["Administration"]
  node_manager["Admin workspace<br/>[page.tsx]"]
  node_product_admin["Product management"]
  node_order_admin["Order fulfillment<br/>[route.ts]"]
  node_content_admin["Store content management<br/>[BannerManager.tsx]"]
  node_member_admin["Member management<br/>[UserManager.tsx]"]
end

subgraph group_platform["Identity and data"]
  node_signin["Kakao sign-in<br/>[auth.ts]"]
  node_database[("MongoDB collections<br/>[mongodb.ts]")]
end

node_customer(("Customer"))

node_customer -->|"browses"| node_storefront
node_storefront -.->|"opens products"| node_catalog
node_customer -->|"searches"| node_search
node_customer -->|"manages cart"| node_cart
node_cart -->|"checks limits"| node_quantity
node_customer -->|"checks out"| node_checkout
node_checkout -.->|"confirms payment"| node_payment_api
node_payment_api -->|"validates stock"| node_stock
node_payment_api -->|"verifies order"| node_payment_rules
node_payment_api -->|"confirms charge"| node_toss
node_payment_api -->|"creates order"| node_order_write
node_payment_api -->|"runs transaction"| node_database
node_customer -->|"views orders"| node_history
node_customer -->|"writes feedback"| node_reviews_qna
node_customer -->|"signs in"| node_signin
node_signin -->|"creates user"| node_database
node_manager -->|"manages products"| node_product_admin
node_manager -->|"processes orders"| node_order_admin
node_manager -->|"manages banners"| node_content_admin
node_manager -->|"manages members"| node_member_admin
node_order_admin -->|"cancels payment"| node_toss
node_order_admin -->|"updates fulfillment"| node_database

click node_storefront "https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/main/page.tsx"
click node_catalog "https://github.com/llmeajinll/nextgacha/blob/main/src/views/DetailPage.tsx"
click node_search "https://github.com/llmeajinll/nextgacha/blob/main/src/views/SearchPage.tsx"
click node_cart "https://github.com/llmeajinll/nextgacha/blob/main/src/features/cart/ui/Cart.tsx"
click node_quantity "https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/checkCartLimit.ts"
click node_checkout "https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/(payment)/checkout/%5BorderId%5D/page.tsx"
click node_payment_api "https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postPaymentsConfirm/route.ts"
click node_payment_rules "https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/verifyOrder.ts"
click node_stock "https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/validateStock.ts"
click node_toss "https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/toss.ts"
click node_order_write "https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/addOrder.ts"
click node_history "https://github.com/llmeajinll/nextgacha/blob/main/src/entities/order/api/getHistory.ts"
click node_reviews_qna "https://github.com/llmeajinll/nextgacha/blob/main/src/features/review-write/ui/ReviewModal.tsx"
click node_signin "https://github.com/llmeajinll/nextgacha/blob/main/src/auth.ts"
click node_database "https://github.com/llmeajinll/nextgacha/blob/main/src/shared/api/mongodb.ts"
click node_manager "https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/manager/page.tsx"
click node_product_admin "https://github.com/llmeajinll/nextgacha/blob/main/src/features/product-manage/ui/ProductManageRow.tsx"
click node_order_admin "https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postCheckToSending/route.ts"
click node_content_admin "https://github.com/llmeajinll/nextgacha/blob/main/src/features/banner-manage/ui/BannerManager.tsx"
click node_member_admin "https://github.com/llmeajinll/nextgacha/blob/main/src/features/user-manage/ui/UserManager.tsx"

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_storefront,node_catalog,node_search toneBlue
class node_cart,node_quantity,node_checkout,node_payment_api,node_payment_rules,node_stock,node_toss,node_order_write toneAmber
class node_history,node_reviews_qna toneMint
class node_manager,node_product_admin,node_order_admin,node_content_admin,node_member_admin toneRose
class node_signin,node_database,node_customer toneIndigo
```

## Components

### Shopfront

- [Storefront pages](https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/main/page.tsx): `src/app/(router)/main/page.tsx`
- [Catalog and detail](https://github.com/llmeajinll/nextgacha/blob/main/src/views/DetailPage.tsx): `src/views/DetailPage.tsx`
- [Product search](https://github.com/llmeajinll/nextgacha/blob/main/src/views/SearchPage.tsx): `src/views/SearchPage.tsx`

### Purchase and fulfillment

- [Cart](https://github.com/llmeajinll/nextgacha/blob/main/src/features/cart/ui/Cart.tsx): `src/features/cart/ui/Cart.tsx`
- [Quantity policy](https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/checkCartLimit.ts): `src/features/purchase/lib/checkCartLimit.ts`
- [Checkout](https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/(payment)/checkout/%5BorderId%5D/page.tsx): `src/app/(router)/(payment)/checkout/[orderId]/page.tsx`
- [Payment confirmation](https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postPaymentsConfirm/route.ts): `src/app/api/postPaymentsConfirm/route.ts`
- [Order validation](https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/verifyOrder.ts): `src/features/purchase/lib/verifyOrder.ts`
- [Stock validation](https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/validateStock.ts): `src/features/purchase/lib/validateStock.ts`
- [TossPayments](https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/toss.ts): `src/features/purchase/lib/toss.ts`
- [Order transaction](https://github.com/llmeajinll/nextgacha/blob/main/src/features/purchase/lib/addOrder.ts): `src/features/purchase/lib/addOrder.ts`

### Customer account

- [Order history](https://github.com/llmeajinll/nextgacha/blob/main/src/entities/order/api/getHistory.ts): `src/entities/order/api/getHistory.ts`
- [Reviews and Q&A](https://github.com/llmeajinll/nextgacha/blob/main/src/features/review-write/ui/ReviewModal.tsx): `src/features/review-write/ui/ReviewModal.tsx`

### Administration

- [Admin workspace](https://github.com/llmeajinll/nextgacha/blob/main/src/app/(router)/manager/page.tsx): `src/app/(router)/manager/page.tsx`
- [Product management](https://github.com/llmeajinll/nextgacha/blob/main/src/features/product-manage/ui/ProductManageRow.tsx): `src/features/product-manage/ui/ProductManageRow.tsx`
- [Order fulfillment](https://github.com/llmeajinll/nextgacha/blob/main/src/app/api/postCheckToSending/route.ts): `src/app/api/postCheckToSending/route.ts`
- [Store content management](https://github.com/llmeajinll/nextgacha/blob/main/src/features/banner-manage/ui/BannerManager.tsx): `src/features/banner-manage/ui/BannerManager.tsx`
- [Member management](https://github.com/llmeajinll/nextgacha/blob/main/src/features/user-manage/ui/UserManager.tsx): `src/features/user-manage/ui/UserManager.tsx`

### Identity and data

- [Kakao sign-in](https://github.com/llmeajinll/nextgacha/blob/main/src/auth.ts): `src/auth.ts`
- [MongoDB collections](https://github.com/llmeajinll/nextgacha/blob/main/src/shared/api/mongodb.ts): `src/shared/api/mongodb.ts`

### Other components

- **Customer**

## Connections

- Customer → Storefront pages: browses
- Storefront pages → Catalog and detail: opens products
- Customer → Product search: searches
- Customer → Cart: manages cart
- Cart → Quantity policy: checks limits
- Customer → Checkout: checks out
- Checkout → Payment confirmation: confirms payment
- Payment confirmation → Stock validation: validates stock (evidence: `src/app/api/postPaymentsConfirm/route.ts`)
- Payment confirmation → Order validation: verifies order (evidence: `src/app/api/postPaymentsConfirm/route.ts`)
- Payment confirmation → TossPayments: confirms charge (evidence: `src/app/api/postPaymentsConfirm/route.ts`)
- Payment confirmation → Order transaction: creates order (evidence: `src/app/api/postPaymentsConfirm/route.ts`)
- Payment confirmation → MongoDB collections: runs transaction (evidence: `src/app/api/postPaymentsConfirm/route.ts`)
- Customer → Order history: views orders
- Customer → Reviews and Q&A: writes feedback
- Customer → Kakao sign-in: signs in
- Kakao sign-in → MongoDB collections: creates user (evidence: `src/auth.ts`)
- Admin workspace → Product management: manages products
- Admin workspace → Order fulfillment: processes orders
- Admin workspace → Store content management: manages banners
- Admin workspace → Member management: manages members
- Order fulfillment → TossPayments: cancels payment (evidence: `src/app/api/postCheckToSending/route.ts`)
- Order fulfillment → MongoDB collections: updates fulfillment (evidence: `src/app/api/postCheckToSending/route.ts`)
