# skillblogwebdev/rostelecom-shop architecture

> Architecture diagram of the GitHub repository skillblogwebdev/rostelecom-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/skillblogwebdev/rostelecom-shop
- Repository: https://github.com/skillblogwebdev/rostelecom-shop

## Overview

This is a Next.js storefront: shoppers browse and search goods, manage cart/favorites/comparisons, authenticate, and proceed through delivery and payment. The architecture separates page/template presentation, Effector client state and effects, HTTP route handlers, and MongoDB-backed utilities. Sampled context effects show several client-to-route calls; the index confirms selected route-to-database dependencies. Many page and route implementations were not sampled, so their internal wiring is intentionally not inferred.

Main entry points: [`api/apiInstance.ts`](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/api/apiInstance.ts) (HTTP client), [`lib/utils/api-routes.ts`](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/utils/api-routes.ts) (Route utilities), [`lib/mongodb/index.ts`](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/mongodb/index.ts) (MongoDB), [`components/templates/ProductsPage/ProductsPage.tsx`](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProductsPage/ProductsPage.tsx) (Catalog pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Storefront UI"]
  node_catalogui["Catalog pages<br/>[ProductsPage.tsx]"]
  node_productui["Product pages<br/>[ProductPage.tsx]"]
  node_mainui["Home page<br/>[MainPage.tsx]"]
  node_cartui["Cart and order<br/>[CartPage.tsx]"]
  node_profileui["Profile pages<br/>[ProfilePage.tsx]"]
  node_listui["Saved lists<br/>[FavoritesPage.tsx]"]
end

subgraph group_client["Client state"]
  node_goodsstate["Goods state<br/>[index.ts]"]
  node_authstate["Authentication<br/>[index.ts]"]
  node_userstate["User state<br/>[index.ts]"]
  node_cartstate["Cart state<br/>[index.ts]"]
  node_comparisonstate["Comparison state<br/>[index.ts]"]
  node_favoritestate["Favorites state<br/>[index.ts]"]
  node_orderstate["Order state<br/>[index.ts]"]
  node_profilestate["Profile state<br/>[index.ts]"]
  node_api["HTTP client<br/>[apiInstance.ts]"]
end

subgraph group_server["API services"]
  node_productroutes["Goods routes<br/>[route.ts]"]
  node_cartroutes["Cart routes<br/>[route.ts]"]
  node_favouriteroutes["Favorites routes<br/>[route.ts]"]
  node_paymentroutes["Payment routes<br/>[route.ts]"]
  node_userroutes["User routes<br/>[route.ts]"]
  node_routeutils["Route utilities<br/>[api-routes.ts]"]
end

subgraph group_data["Persistence"]
  node_mongodb[("MongoDB<br/>[index.ts]")]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_catalogui
node_shopper -.->|"manages cart"| node_cartui
node_shopper -.->|"manages account"| node_profileui
node_catalogui -->|"loads products"| node_goodsstate
node_catalogui -.->|"opens product"| node_productui
node_goodsstate -->|"requests goods"| node_api
node_authstate -->|"sends auth requests"| node_api
node_cartstate -->|"sends cart requests"| node_api
node_comparisonstate -->|"sends list requests"| node_api
node_favoritestate -->|"sends list requests"| node_api
node_orderstate -->|"sends payment requests"| node_api
node_profilestate -->|"sends profile requests"| node_api
node_userstate -->|"checks login"| node_api
node_api -->|"requests goods"| node_productroutes
node_api -->|"requests user service"| node_userroutes
node_api -->|"creates payment"| node_paymentroutes
node_productroutes -->|"queries goods"| node_mongodb
node_cartroutes -->|"uses database"| node_mongodb
node_favouriteroutes -->|"uses database"| node_mongodb
node_paymentroutes -->|"uses database"| node_mongodb
node_userroutes -->|"uses database"| node_mongodb
node_productroutes -->|"uses helpers"| node_routeutils
node_cartroutes -->|"uses helpers"| node_routeutils
node_favouriteroutes -->|"uses helpers"| node_routeutils
node_paymentroutes -->|"uses helpers"| node_routeutils
node_userroutes -->|"uses helpers"| node_routeutils

click node_catalogui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProductsPage/ProductsPage.tsx"
click node_productui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProductPage/ProductPage.tsx"
click node_mainui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/MainPage/MainPage.tsx"
click node_cartui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/CartPage/CartPage.tsx"
click node_profileui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProfilePage/ProfilePage.tsx"
click node_listui "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/FavoritesPage/FavoritesPage.tsx"
click node_goodsstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/goods/index.ts"
click node_authstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/auth/index.ts"
click node_userstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/user/index.ts"
click node_cartstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/cart/index.ts"
click node_comparisonstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/comparison/index.ts"
click node_favoritestate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/favorites/index.ts"
click node_orderstate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/order/index.ts"
click node_profilestate "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/profile/index.ts"
click node_api "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/api/apiInstance.ts"
click node_productroutes "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/goods/filter/route.ts"
click node_cartroutes "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/cart/add/route.ts"
click node_favouriteroutes "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/favorites/add/route.ts"
click node_paymentroutes "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/payment/route.ts"
click node_userroutes "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/users/refresh/route.ts"
click node_routeutils "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/utils/api-routes.ts"
click node_mongodb "https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/mongodb/index.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_catalogui,node_productui,node_mainui,node_cartui,node_profileui,node_listui toneBlue
class node_goodsstate,node_authstate,node_userstate,node_cartstate,node_comparisonstate,node_favoritestate,node_orderstate,node_profilestate,node_api toneAmber
class node_productroutes,node_cartroutes,node_favouriteroutes,node_paymentroutes,node_userroutes,node_routeutils toneMint
class node_mongodb toneRose
class node_shopper toneIndigo
```

## Components

### Storefront UI

- [Catalog pages](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProductsPage/ProductsPage.tsx): `components/templates/ProductsPage/ProductsPage.tsx`
- [Product pages](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProductPage/ProductPage.tsx): `components/templates/ProductPage/ProductPage.tsx`
- [Home page](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/MainPage/MainPage.tsx): `components/templates/MainPage/MainPage.tsx`
- [Cart and order](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/CartPage/CartPage.tsx): `components/templates/CartPage/CartPage.tsx`
- [Profile pages](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/ProfilePage/ProfilePage.tsx): `components/templates/ProfilePage/ProfilePage.tsx`
- [Saved lists](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/components/templates/FavoritesPage/FavoritesPage.tsx): `components/templates/FavoritesPage/FavoritesPage.tsx`

### Client state

- [Goods state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/goods/index.ts): `context/goods/index.ts`
- [Authentication](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/auth/index.ts): `context/auth/index.ts`
- [User state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/user/index.ts): `context/user/index.ts`
- [Cart state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/cart/index.ts): `context/cart/index.ts`
- [Comparison state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/comparison/index.ts): `context/comparison/index.ts`
- [Favorites state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/favorites/index.ts): `context/favorites/index.ts`
- [Order state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/order/index.ts): `context/order/index.ts`
- [Profile state](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/context/profile/index.ts): `context/profile/index.ts`
- [HTTP client](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/api/apiInstance.ts): `api/apiInstance.ts`

### API services

- [Goods routes](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/goods/filter/route.ts): `app/api/goods/filter/route.ts`
- [Cart routes](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/cart/add/route.ts): `app/api/cart/add/route.ts`
- [Favorites routes](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/favorites/add/route.ts): `app/api/favorites/add/route.ts`
- [Payment routes](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/payment/route.ts): `app/api/payment/route.ts`
- [User routes](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/app/api/users/refresh/route.ts): `app/api/users/refresh/route.ts`
- [Route utilities](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/utils/api-routes.ts): `lib/utils/api-routes.ts`

### Persistence

- [MongoDB](https://github.com/skillblogwebdev/rostelecom-shop/blob/main/lib/mongodb/index.ts): `lib/mongodb/index.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Catalog pages: browses
- Shopper → Cart and order: manages cart
- Shopper → Profile pages: manages account
- Catalog pages → Goods state: loads products (evidence: `components/templates/ProductsPage/ProductsPage.tsx`)
- Catalog pages → Product pages: opens product
- Goods state → HTTP client: requests goods (evidence: `context/goods/index.ts`)
- Authentication → HTTP client: sends auth requests (evidence: `context/auth/index.ts`)
- Cart state → HTTP client: sends cart requests (evidence: `context/cart/index.ts`)
- Comparison state → HTTP client: sends list requests (evidence: `context/comparison/index.ts`)
- Favorites state → HTTP client: sends list requests (evidence: `context/favorites/index.ts`)
- Order state → HTTP client: sends payment requests (evidence: `context/order/index.ts`)
- Profile state → HTTP client: sends profile requests (evidence: `context/profile/index.ts`)
- User state → HTTP client: checks login (evidence: `context/user/index.ts`)
- HTTP client → Goods routes: requests goods
- HTTP client → User routes: requests user service
- HTTP client → Payment routes: creates payment
- Goods routes → MongoDB: queries goods (evidence: `app/api/goods/filter/route.ts`)
- Cart routes → MongoDB: uses database (evidence: `app/api/cart/add/route.ts`)
- Favorites routes → MongoDB: uses database (evidence: `app/api/favorites/add/route.ts`)
- Payment routes → MongoDB: uses database (evidence: `app/api/payment/route.ts`)
- User routes → MongoDB: uses database (evidence: `app/api/users/refresh/route.ts`)
- Goods routes → Route utilities: uses helpers (evidence: `app/api/goods/filter/route.ts`)
- Cart routes → Route utilities: uses helpers (evidence: `app/api/cart/add/route.ts`)
- Favorites routes → Route utilities: uses helpers (evidence: `app/api/favorites/add/route.ts`)
- Payment routes → Route utilities: uses helpers (evidence: `app/api/payment/route.ts`)
- User routes → Route utilities: uses helpers (evidence: `app/api/users/refresh/route.ts`)
