# moneykita/e-shop architecture

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

- Interactive diagram: https://gitdiagram.com/moneykita/e-shop
- Repository: https://github.com/moneykita/e-shop

## Overview

Moneykita is a Lithuanian ecommerce shop: a Next.js storefront backed by Medusa for catalog, carts, orders, and payments. The shopper journey runs from browsing/searching products through cart and checkout to payment and order confirmation; guest order access is a separate protected return path. The graph also preserves the documented backend payment, shipping, email, and refund capabilities. Some backend subsystems are represented from README descriptions and tree paths; their internal calls were not sampled, so uncertain links are omitted.

Main entry points: [`app/(store)/paieska/page.tsx`](https://github.com/moneykita/e-shop/blob/master/app/(store)/paieska/page.tsx) (Search Results), [`app/(checkout)/checkout/page.tsx`](https://github.com/moneykita/e-shop/blob/master/app/(checkout)/checkout/page.tsx) (Checkout Flow), [`lib/store/search.ts`](https://github.com/moneykita/e-shop/blob/master/lib/store/search.ts) (Search Logic), [`medusa/apps/backend/src/lib/refund-watch/watch.ts`](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/lib/refund-watch/watch.ts) (Refund Monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home Page<br/>[page.tsx]"]
  node_content["Content Pages<br/>[content-page.tsx]"]
  node_seo["SEO Identity<br/>[site.ts]"]
end

subgraph group_catalog["Catalog"]
  node_searchpage["Search Results<br/>[page.tsx]"]
  node_searchapi["Search API<br/>[route.ts]"]
  node_searchlogic["Search Logic<br/>[search.ts]"]
  node_categories["Categories<br/>[categories.ts]"]
  node_productmap["Product Mapping<br/>[product-mapper.ts]"]
end

subgraph group_purchase["Purchase"]
  node_cartpage["Cart Page<br/>[page.tsx]"]
  node_cartlogic["Cart Logic<br/>[cart.ts]"]
  node_checkoutpage["Checkout Flow<br/>[page.tsx]"]
  node_checkoutlogic["Checkout Logic<br/>[checkout.ts]"]
  node_payment["Payment Step<br/>[PaymentStep.tsx]"]
  node_order["Order Confirmation"]
  node_orderexchange["Guest Access Exchange<br/>[route.ts]"]
end

subgraph group_backend["Commerce Backend"]
  node_medusa["Medusa SDK<br/>[medusa.ts]"]
  node_backendexchange["Order Capability Exchange<br/>[route.ts]"]
  node_payments["Payment Providers<br/>[service.ts]"]
  node_shipping["Shipping<br/>[service.ts]"]
  node_notifications["Order Emails<br/>[service.ts]"]
end

subgraph group_operations["Backend Operations"]
  node_refundwatch["Refund Monitoring<br/>[watch.ts]"]
  node_telegram["Alerts<br/>[telegram.ts]"]
end

node_shopper(("Shopper"))
node_database[("Postgres")]
node_redis[("Redis")]
node_stripe["Stripe"]
node_resend["Resend"]

node_shopper -->|"browses"| node_home
node_home -->|"uses identity"| node_seo
node_shopper -->|"searches"| node_searchpage
node_searchpage -->|"queries"| node_searchlogic
node_searchpage -->|"loads categories"| node_categories
node_searchpage -.->|"renders products"| node_productmap
node_shopper -->|"uses overlay"| node_searchapi
node_searchapi -->|"queries"| node_searchlogic
node_searchapi -->|"loads categories"| node_categories
node_searchlogic -->|"queries catalog"| node_medusa
node_searchlogic -->|"maps results"| node_productmap
node_shopper -->|"manages cart"| node_cartpage
node_cartpage -->|"reads cart"| node_cartlogic
node_shopper -->|"checks out"| node_checkoutpage
node_checkoutpage -->|"loads cart"| node_cartlogic
node_checkoutpage -->|"updates checkout"| node_checkoutlogic
node_checkoutpage -->|"renders step"| node_payment
node_payment -->|"starts payment"| node_checkoutlogic
node_shopper -->|"requests access"| node_orderexchange
node_orderexchange -->|"exchanges capability"| node_backendexchange
node_shopper -->|"views order"| node_order
node_medusa -->|"persists commerce data"| node_database
node_payments -->|"uses"| node_stripe
node_shipping -.->|"uses commerce data"| node_database
node_notifications -->|"sends email"| node_resend
node_refundwatch -->|"reads refund events"| node_stripe
node_refundwatch -->|"deduplicates"| node_redis
node_refundwatch -->|"requests email"| node_notifications
node_payments -->|"alerts"| node_telegram

click node_home "https://github.com/moneykita/e-shop/blob/master/app/page.tsx"
click node_content "https://github.com/moneykita/e-shop/blob/master/components/storefront/content-page.tsx"
click node_seo "https://github.com/moneykita/e-shop/blob/master/lib/seo/site.ts"
click node_searchpage "https://github.com/moneykita/e-shop/blob/master/app/(store)/paieska/page.tsx"
click node_searchapi "https://github.com/moneykita/e-shop/blob/master/app/api/search/route.ts"
click node_searchlogic "https://github.com/moneykita/e-shop/blob/master/lib/store/search.ts"
click node_categories "https://github.com/moneykita/e-shop/blob/master/lib/store/categories.ts"
click node_productmap "https://github.com/moneykita/e-shop/blob/master/lib/store/product-mapper.ts"
click node_medusa "https://github.com/moneykita/e-shop/blob/master/lib/medusa.ts"
click node_cartpage "https://github.com/moneykita/e-shop/blob/master/app/(store)/cart/page.tsx"
click node_cartlogic "https://github.com/moneykita/e-shop/blob/master/lib/store/cart.ts"
click node_checkoutpage "https://github.com/moneykita/e-shop/blob/master/app/(checkout)/checkout/page.tsx"
click node_checkoutlogic "https://github.com/moneykita/e-shop/blob/master/lib/store/checkout.ts"
click node_payment "https://github.com/moneykita/e-shop/blob/master/components/checkout/PaymentStep.tsx"
click node_order "https://github.com/moneykita/e-shop/blob/master/components/order/order-confirmation.tsx"
click node_orderexchange "https://github.com/moneykita/e-shop/blob/master/app/api/order-access/exchange/route.ts"
click node_backendexchange "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/api/store/order-access/exchange/route.ts"
click node_payments "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/stripe-observed/service.ts"
click node_shipping "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/fulfillment-lt/service.ts"
click node_notifications "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/notification-resend/service.ts"
click node_refundwatch "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/lib/refund-watch/watch.ts"
click node_telegram "https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/lib/alert/telegram.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_home,node_content,node_seo toneBlue
class node_searchpage,node_searchapi,node_searchlogic,node_categories,node_productmap,node_database,node_redis toneAmber
class node_cartpage,node_cartlogic,node_checkoutpage,node_checkoutlogic,node_payment,node_order,node_orderexchange toneMint
class node_medusa,node_backendexchange,node_payments,node_shipping,node_notifications toneRose
class node_refundwatch,node_telegram,node_shopper,node_stripe,node_resend toneIndigo
```

## Components

### Storefront

- [Home Page](https://github.com/moneykita/e-shop/blob/master/app/page.tsx): `app/page.tsx`
- [Content Pages](https://github.com/moneykita/e-shop/blob/master/components/storefront/content-page.tsx): `components/storefront/content-page.tsx`
- [SEO Identity](https://github.com/moneykita/e-shop/blob/master/lib/seo/site.ts): `lib/seo/site.ts`

### Catalog

- [Search Results](https://github.com/moneykita/e-shop/blob/master/app/(store)/paieska/page.tsx): `app/(store)/paieska/page.tsx`
- [Search API](https://github.com/moneykita/e-shop/blob/master/app/api/search/route.ts): `app/api/search/route.ts`
- [Search Logic](https://github.com/moneykita/e-shop/blob/master/lib/store/search.ts): `lib/store/search.ts`
- [Categories](https://github.com/moneykita/e-shop/blob/master/lib/store/categories.ts): `lib/store/categories.ts`
- [Product Mapping](https://github.com/moneykita/e-shop/blob/master/lib/store/product-mapper.ts): `lib/store/product-mapper.ts`

### Purchase

- [Cart Page](https://github.com/moneykita/e-shop/blob/master/app/(store)/cart/page.tsx): `app/(store)/cart/page.tsx`
- [Cart Logic](https://github.com/moneykita/e-shop/blob/master/lib/store/cart.ts): `lib/store/cart.ts`
- [Checkout Flow](https://github.com/moneykita/e-shop/blob/master/app/(checkout)/checkout/page.tsx): `app/(checkout)/checkout/page.tsx`
- [Checkout Logic](https://github.com/moneykita/e-shop/blob/master/lib/store/checkout.ts): `lib/store/checkout.ts`
- [Payment Step](https://github.com/moneykita/e-shop/blob/master/components/checkout/PaymentStep.tsx): `components/checkout/PaymentStep.tsx`
- [Order Confirmation](https://github.com/moneykita/e-shop/blob/master/components/order/order-confirmation.tsx): `components/order/order-confirmation.tsx`
- [Guest Access Exchange](https://github.com/moneykita/e-shop/blob/master/app/api/order-access/exchange/route.ts): `app/api/order-access/exchange/route.ts`

### Commerce Backend

- [Medusa SDK](https://github.com/moneykita/e-shop/blob/master/lib/medusa.ts): `lib/medusa.ts`
- [Order Capability Exchange](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/api/store/order-access/exchange/route.ts): `medusa/apps/backend/src/api/store/order-access/exchange/route.ts`
- [Payment Providers](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/stripe-observed/service.ts): `medusa/apps/backend/src/modules/stripe-observed/service.ts`
- [Shipping](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/fulfillment-lt/service.ts): `medusa/apps/backend/src/modules/fulfillment-lt/service.ts`
- [Order Emails](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/modules/notification-resend/service.ts): `medusa/apps/backend/src/modules/notification-resend/service.ts`

### Backend Operations

- [Refund Monitoring](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/lib/refund-watch/watch.ts): `medusa/apps/backend/src/lib/refund-watch/watch.ts`
- [Alerts](https://github.com/moneykita/e-shop/blob/master/medusa/apps/backend/src/lib/alert/telegram.ts): `medusa/apps/backend/src/lib/alert/telegram.ts`

### Other components

- **Shopper**
- **Postgres**
- **Redis**
- **Stripe**
- **Resend**

## Connections

- Shopper → Home Page: browses
- Home Page → SEO Identity: uses identity (evidence: `app/page.tsx`)
- Shopper → Search Results: searches
- Search Results → Search Logic: queries (evidence: `app/(store)/paieska/page.tsx`)
- Search Results → Categories: loads categories (evidence: `app/(store)/paieska/page.tsx`)
- Search Results → Product Mapping: renders products
- Shopper → Search API: uses overlay
- Search API → Search Logic: queries (evidence: `app/api/search/route.ts`)
- Search API → Categories: loads categories (evidence: `app/api/search/route.ts`)
- Search Logic → Medusa SDK: queries catalog (evidence: `lib/store/search.ts`)
- Search Logic → Product Mapping: maps results (evidence: `lib/store/search.ts`)
- Shopper → Cart Page: manages cart
- Cart Page → Cart Logic: reads cart (evidence: `app/(store)/cart/page.tsx`)
- Shopper → Checkout Flow: checks out
- Checkout Flow → Cart Logic: loads cart (evidence: `app/(checkout)/checkout/page.tsx`)
- Checkout Flow → Checkout Logic: updates checkout (evidence: `app/(checkout)/checkout/page.tsx`)
- Checkout Flow → Payment Step: renders step (evidence: `app/(checkout)/checkout/page.tsx`)
- Payment Step → Checkout Logic: starts payment (evidence: `components/checkout/PaymentStep.tsx`)
- Shopper → Guest Access Exchange: requests access
- Guest Access Exchange → Order Capability Exchange: exchanges capability
- Shopper → Order Confirmation: views order
- Medusa SDK → Postgres: persists commerce data
- Payment Providers → Stripe: uses
- Shipping → Postgres: uses commerce data
- Order Emails → Resend: sends email
- Refund Monitoring → Stripe: reads refund events
- Refund Monitoring → Redis: deduplicates
- Refund Monitoring → Order Emails: requests email
- Payment Providers → Alerts: alerts (evidence: `medusa/apps/backend/src/modules/stripe-observed/service.ts`)
