# chel12/nextproject architecture

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

- Interactive diagram: https://gitdiagram.com/chel12/nextproject
- Repository: https://github.com/chel12/nextproject

## Overview

This is a Next.js storefront for browsing and purchasing game-related products, with account, order-history, and administrative features. The main customer flow is catalog browsing and filtering, adding configured items to a token-based cart, submitting checkout, and completing payment through a callback that updates the order and emails the customer. The graph separates storefront, commerce, identity/admin, and persistence concerns. Evidence is limited to the README, file tree, SOURCE INDEX references, and supplied excerpts; some unsampled links are therefore omitted.

Main entry points: [`prisma/prisma-client.ts`](https://github.com/chel12/nextproject/blob/main/prisma/prisma-client.ts) (Application Database), [`app/actions.ts`](https://github.com/chel12/nextproject/blob/main/app/actions.ts) (Order Actions), [`app/api/checkout/callback/route.ts`](https://github.com/chel12/nextproject/blob/main/app/api/checkout/callback/route.ts) (Payment Callback), [`app/(root)/page.tsx`](https://github.com/chel12/nextproject/blob/main/app/(root)/page.tsx) (Product Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog["Product Catalog<br/>[page.tsx]"]
  node_catalog_search["Catalog Search<br/>[search-input.tsx]"]
  node_filter_state["Filter State<br/>[use-filters.ts]"]
  node_product_detail["Product Detail<br/>[page.tsx]"]
end

subgraph group_commerce["Cart and Checkout"]
  node_cart_ui["Cart UI<br/>[cart-drawer.tsx]"]
  node_cart_endpoint["Cart API<br/>[route.ts]"]
  node_cart_store["Cart Store<br/>[cart.ts]"]
  node_checkout_page["Checkout<br/>[page.tsx]"]
  node_order_actions["Order Actions<br/>[actions.ts]"]
  node_payment_service["Payment Creation<br/>[creat-payments.ts]"]
  node_payment_callback["Payment Callback<br/>[route.ts]"]
  node_email_service["Email Delivery<br/>[send-email.ts]"]
end

subgraph group_identity["Identity and Admin"]
  node_auth_config["Authentication<br/>[auth-options.ts]"]
  node_session["Session Lookup"]
  node_profile["Profile and Orders<br/>[page.tsx]"]
  node_admin_orders["Order Management"]
  node_admin_users["User Management"]
end

subgraph group_data["Persistence and Services"]
  node_database[("Application Database<br/>[prisma-client.ts]")]
  node_api_client["Client API Facade<br/>[api-client.ts]"]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"browses"| node_catalog
node_catalog -->|"uses filters"| node_filter_state
node_customer -.->|"searches"| node_catalog_search
node_catalog -.->|"opens product"| node_product_detail
node_customer -.->|"adds items"| node_cart_ui
node_cart_ui -.->|"requests cart"| node_cart_endpoint
node_cart_endpoint -->|"reads and writes"| node_database
node_cart_endpoint -.->|"updates client state"| node_cart_store
node_customer -->|"checks out"| node_checkout_page
node_checkout_page -->|"submits order"| node_order_actions
node_checkout_page -->|"uses services"| node_api_client
node_order_actions -->|"creates order"| node_database
node_order_actions -->|"creates payment"| node_payment_service
node_order_actions -->|"sends payment email"| node_email_service
node_payment_callback -->|"updates order"| node_database
node_payment_callback -->|"sends confirmation"| node_email_service
node_payment_callback -.->|"payment status"| node_customer
node_customer -.->|"authenticates"| node_auth_config
node_auth_config -->|"checks user"| node_database
node_session -->|"resolves session"| node_auth_config
node_profile -->|"loads profile"| node_database
node_admin -->|"manages orders"| node_admin_orders
node_admin -->|"manages users"| node_admin_users
node_admin_orders -->|"invokes actions"| node_order_actions
node_admin_users -->|"invokes actions"| node_order_actions
node_admin_orders -->|"loads orders"| node_database
node_admin_users -->|"loads users"| node_database

click node_catalog "https://github.com/chel12/nextproject/blob/main/app/(root)/page.tsx"
click node_catalog_search "https://github.com/chel12/nextproject/blob/main/shared/components/shared/search-input.tsx"
click node_filter_state "https://github.com/chel12/nextproject/blob/main/shared/hooks/use-filters.ts"
click node_product_detail "https://github.com/chel12/nextproject/blob/main/app/(root)/product/%5Bid%5D/page.tsx"
click node_cart_ui "https://github.com/chel12/nextproject/blob/main/shared/components/shared/cart-drawer.tsx"
click node_cart_endpoint "https://github.com/chel12/nextproject/blob/main/app/api/cart/route.ts"
click node_cart_store "https://github.com/chel12/nextproject/blob/main/shared/store/cart.ts"
click node_checkout_page "https://github.com/chel12/nextproject/blob/main/app/(checkout)/checkout/page.tsx"
click node_order_actions "https://github.com/chel12/nextproject/blob/main/app/actions.ts"
click node_payment_service "https://github.com/chel12/nextproject/blob/main/shared/lib/creat-payments.ts"
click node_payment_callback "https://github.com/chel12/nextproject/blob/main/app/api/checkout/callback/route.ts"
click node_email_service "https://github.com/chel12/nextproject/blob/main/shared/lib/send-email.ts"
click node_auth_config "https://github.com/chel12/nextproject/blob/main/shared/constants/auth-options.ts"
click node_session "https://github.com/chel12/nextproject/blob/main/shared/lib/get-user-session.ts"
click node_profile "https://github.com/chel12/nextproject/blob/main/app/(root)/profile/page.tsx"
click node_admin_orders "https://github.com/chel12/nextproject/blob/main/shared/components/shared/admin-orders-panel.tsx"
click node_admin_users "https://github.com/chel12/nextproject/blob/main/shared/components/shared/admin-users-panel.tsx"
click node_database "https://github.com/chel12/nextproject/blob/main/prisma/prisma-client.ts"
click node_api_client "https://github.com/chel12/nextproject/blob/main/shared/services/api-client.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_catalog,node_catalog_search,node_filter_state,node_product_detail toneBlue
class node_cart_ui,node_cart_endpoint,node_cart_store,node_checkout_page,node_order_actions,node_payment_service,node_payment_callback,node_email_service toneAmber
class node_auth_config,node_session,node_profile,node_admin_orders,node_admin_users toneMint
class node_database,node_api_client toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Storefront

- [Product Catalog](https://github.com/chel12/nextproject/blob/main/app/(root)/page.tsx): `app/(root)/page.tsx`
- [Catalog Search](https://github.com/chel12/nextproject/blob/main/shared/components/shared/search-input.tsx): `shared/components/shared/search-input.tsx`
- [Filter State](https://github.com/chel12/nextproject/blob/main/shared/hooks/use-filters.ts): `shared/hooks/use-filters.ts`
- [Product Detail](https://github.com/chel12/nextproject/blob/main/app/(root)/product/%5Bid%5D/page.tsx): `app/(root)/product/[id]/page.tsx`

### Cart and Checkout

- [Cart UI](https://github.com/chel12/nextproject/blob/main/shared/components/shared/cart-drawer.tsx): `shared/components/shared/cart-drawer.tsx`
- [Cart API](https://github.com/chel12/nextproject/blob/main/app/api/cart/route.ts): `app/api/cart/route.ts`
- [Cart Store](https://github.com/chel12/nextproject/blob/main/shared/store/cart.ts): `shared/store/cart.ts`
- [Checkout](https://github.com/chel12/nextproject/blob/main/app/(checkout)/checkout/page.tsx): `app/(checkout)/checkout/page.tsx`
- [Order Actions](https://github.com/chel12/nextproject/blob/main/app/actions.ts): `app/actions.ts`
- [Payment Creation](https://github.com/chel12/nextproject/blob/main/shared/lib/creat-payments.ts): `shared/lib/creat-payments.ts`
- [Payment Callback](https://github.com/chel12/nextproject/blob/main/app/api/checkout/callback/route.ts): `app/api/checkout/callback/route.ts`
- [Email Delivery](https://github.com/chel12/nextproject/blob/main/shared/lib/send-email.ts): `shared/lib/send-email.ts`

### Identity and Admin

- [Authentication](https://github.com/chel12/nextproject/blob/main/shared/constants/auth-options.ts): `shared/constants/auth-options.ts`
- [Session Lookup](https://github.com/chel12/nextproject/blob/main/shared/lib/get-user-session.ts): `shared/lib/get-user-session.ts`
- [Profile and Orders](https://github.com/chel12/nextproject/blob/main/app/(root)/profile/page.tsx): `app/(root)/profile/page.tsx`
- [Order Management](https://github.com/chel12/nextproject/blob/main/shared/components/shared/admin-orders-panel.tsx): `shared/components/shared/admin-orders-panel.tsx`
- [User Management](https://github.com/chel12/nextproject/blob/main/shared/components/shared/admin-users-panel.tsx): `shared/components/shared/admin-users-panel.tsx`

### Persistence and Services

- [Application Database](https://github.com/chel12/nextproject/blob/main/prisma/prisma-client.ts): `prisma/prisma-client.ts`
- [Client API Facade](https://github.com/chel12/nextproject/blob/main/shared/services/api-client.ts): `shared/services/api-client.ts`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Product Catalog: browses (evidence: `app/(root)/page.tsx`)
- Product Catalog → Filter State: uses filters
- Customer → Catalog Search: searches
- Product Catalog → Product Detail: opens product
- Customer → Cart UI: adds items
- Cart UI → Cart API: requests cart
- Cart API → Application Database: reads and writes (evidence: `app/api/cart/route.ts`)
- Cart API → Cart Store: updates client state
- Customer → Checkout: checks out (evidence: `app/(checkout)/checkout/page.tsx`)
- Checkout → Order Actions: submits order (evidence: `app/(checkout)/checkout/page.tsx`)
- Checkout → Client API Facade: uses services (evidence: `app/(checkout)/checkout/page.tsx`)
- Order Actions → Application Database: creates order (evidence: `app/actions.ts`)
- Order Actions → Payment Creation: creates payment (evidence: `app/actions.ts`)
- Order Actions → Email Delivery: sends payment email (evidence: `app/actions.ts`)
- Payment Callback → Application Database: updates order (evidence: `app/api/checkout/callback/route.ts`)
- Payment Callback → Email Delivery: sends confirmation (evidence: `app/api/checkout/callback/route.ts`)
- Payment Callback → Customer: payment status
- Customer → Authentication: authenticates
- Authentication → Application Database: checks user (evidence: `shared/constants/auth-options.ts`)
- Session Lookup → Authentication: resolves session (evidence: `shared/lib/get-user-session.ts`)
- Profile and Orders → Application Database: loads profile (evidence: `app/(root)/profile/page.tsx`)
- Administrator → Order Management: manages orders
- Administrator → User Management: manages users
- Order Management → Order Actions: invokes actions (evidence: `shared/components/shared/admin-orders-panel.tsx`)
- User Management → Order Actions: invokes actions (evidence: `shared/components/shared/admin-users-panel.tsx`)
- Order Management → Application Database: loads orders (evidence: `app/(root)/admin/orders/page.tsx`)
- User Management → Application Database: loads users (evidence: `app/(root)/admin/users/page.tsx`)
