# 123onlywork/backend-stroymat architecture

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

- Interactive diagram: https://gitdiagram.com/123onlywork/backend-stroymat
- Repository: https://github.com/123onlywork/backend-stroymat

## Overview

This is a NestJS e-commerce API, not the generic starter described by the README: its source tree implements authentication, product and category catalogues, user profiles and favorites, orders, reviews, and statistics. The primary customer workflow is browsing and filtering products, then using authenticated account features; admins manage catalogue data, while users can submit reviews. Controllers dispatch to services, which perform domain logic and, where shown, use Prisma persistence. The order subsystem is included from the source index, but its runtime wiring and persistence calls are not shown in the excerpts.

Main entry points: [`src/product/product.service.ts`](https://github.com/123onlywork/backend-stroymat/blob/main/src/product/product.service.ts) (Product service), [`src/prisma.service.ts`](https://github.com/123onlywork/backend-stroymat/blob/main/src/prisma.service.ts) (Prisma database access), [`src/auth/auth.service.ts`](https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/auth.service.ts) (Auth service), [`src/review/review.service.ts`](https://github.com/123onlywork/backend-stroymat/blob/main/src/review/review.service.ts) (Review service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Product catalogue"]
  node_product_api["Product API"]
  node_product_logic["Product service<br/>[product.service.ts]"]
  node_category_api["Category API"]
  node_category_logic["Category service"]
end

subgraph group_accounts["Accounts and access"]
  node_auth_api["Auth API<br/>[auth.controller.ts]"]
  node_auth_logic["Auth service<br/>[auth.service.ts]"]
  node_auth_guards["Auth guards<br/>[auth.decorator.ts]"]
  node_user_api["User API<br/>[user.controller.ts]"]
  node_user_logic["User service<br/>[user.service.ts]"]
end

subgraph group_commerce["Commerce and feedback"]
  node_order_api["Order API"]
  node_order_logic["Order service<br/>[order.service.ts]"]
  node_review_api["Review API"]
  node_review_logic["Review service<br/>[review.service.ts]"]
end

subgraph group_insights["Insights"]
  node_stats_api["Statistics API"]
  node_stats_logic["Statistics service"]
end

subgraph group_platform["Shared infrastructure"]
  node_pagination["Pagination"]
  node_prisma[("Prisma database access<br/>[prisma.service.ts]")]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))

node_shopper -->|"browses"| node_product_api
node_admin -->|"manages"| node_product_api
node_shopper -->|"browses"| node_category_api
node_admin -->|"manages"| node_category_api
node_product_api -->|"dispatches"| node_product_logic
node_product_logic -->|"gets paging"| node_pagination
node_product_logic -->|"checks category"| node_category_logic
node_product_logic -->|"queries"| node_prisma
node_category_api -->|"dispatches"| node_category_logic
node_category_logic -->|"queries"| node_prisma
node_shopper -->|"authenticates"| node_auth_api
node_auth_api -->|"dispatches"| node_auth_logic
node_auth_logic -->|"reads users"| node_prisma
node_auth_logic -->|"loads user"| node_user_logic
node_shopper -->|"manages profile"| node_user_api
node_user_api -->|"dispatches"| node_user_logic
node_user_logic -->|"reads and writes"| node_prisma
node_shopper -.->|"places orders"| node_order_api
node_order_api -->|"dispatches"| node_order_logic
node_shopper -->|"submits review"| node_review_api
node_admin -->|"reviews entries"| node_review_api
node_review_api -->|"dispatches"| node_review_logic
node_review_logic -->|"checks product"| node_product_logic
node_review_logic -->|"reads and writes"| node_prisma
node_admin -.->|"requests stats"| node_stats_api
node_stats_api -->|"dispatches"| node_stats_logic
node_auth_guards -.->|"protects routes"| node_auth_api

click node_product_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/product/product.controller.ts"
click node_product_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/product/product.service.ts"
click node_category_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/category/category.controller.ts"
click node_category_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/category/category.service.ts"
click node_auth_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/auth.controller.ts"
click node_auth_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/auth.service.ts"
click node_auth_guards "https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/decorators/auth.decorator.ts"
click node_user_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/user/user.controller.ts"
click node_user_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/user/user.service.ts"
click node_order_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/order/order.controller.ts"
click node_order_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/order/order.service.ts"
click node_review_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/review/review.controller.ts"
click node_review_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/review/review.service.ts"
click node_stats_api "https://github.com/123onlywork/backend-stroymat/blob/main/src/statistics/statistics.controller.ts"
click node_stats_logic "https://github.com/123onlywork/backend-stroymat/blob/main/src/statistics/statistics.service.ts"
click node_pagination "https://github.com/123onlywork/backend-stroymat/blob/main/src/pagination/pagination.service.ts"
click node_prisma "https://github.com/123onlywork/backend-stroymat/blob/main/src/prisma.service.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_product_api,node_product_logic,node_category_api,node_category_logic toneBlue
class node_auth_api,node_auth_logic,node_auth_guards,node_user_api,node_user_logic toneAmber
class node_order_api,node_order_logic,node_review_api,node_review_logic toneMint
class node_stats_api,node_stats_logic toneRose
class node_pagination,node_prisma,node_shopper,node_admin toneIndigo
```

## Components

### Product catalogue

- [Product API](https://github.com/123onlywork/backend-stroymat/blob/main/src/product/product.controller.ts): `src/product/product.controller.ts`
- [Product service](https://github.com/123onlywork/backend-stroymat/blob/main/src/product/product.service.ts): `src/product/product.service.ts`
- [Category API](https://github.com/123onlywork/backend-stroymat/blob/main/src/category/category.controller.ts): `src/category/category.controller.ts`
- [Category service](https://github.com/123onlywork/backend-stroymat/blob/main/src/category/category.service.ts): `src/category/category.service.ts`

### Accounts and access

- [Auth API](https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Auth service](https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [Auth guards](https://github.com/123onlywork/backend-stroymat/blob/main/src/auth/decorators/auth.decorator.ts): `src/auth/decorators/auth.decorator.ts`
- [User API](https://github.com/123onlywork/backend-stroymat/blob/main/src/user/user.controller.ts): `src/user/user.controller.ts`
- [User service](https://github.com/123onlywork/backend-stroymat/blob/main/src/user/user.service.ts): `src/user/user.service.ts`

### Commerce and feedback

- [Order API](https://github.com/123onlywork/backend-stroymat/blob/main/src/order/order.controller.ts): `src/order/order.controller.ts`
- [Order service](https://github.com/123onlywork/backend-stroymat/blob/main/src/order/order.service.ts): `src/order/order.service.ts`
- [Review API](https://github.com/123onlywork/backend-stroymat/blob/main/src/review/review.controller.ts): `src/review/review.controller.ts`
- [Review service](https://github.com/123onlywork/backend-stroymat/blob/main/src/review/review.service.ts): `src/review/review.service.ts`

### Insights

- [Statistics API](https://github.com/123onlywork/backend-stroymat/blob/main/src/statistics/statistics.controller.ts): `src/statistics/statistics.controller.ts`
- [Statistics service](https://github.com/123onlywork/backend-stroymat/blob/main/src/statistics/statistics.service.ts): `src/statistics/statistics.service.ts`

### Shared infrastructure

- [Pagination](https://github.com/123onlywork/backend-stroymat/blob/main/src/pagination/pagination.service.ts): `src/pagination/pagination.service.ts`
- [Prisma database access](https://github.com/123onlywork/backend-stroymat/blob/main/src/prisma.service.ts): `src/prisma.service.ts`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Product API: browses (evidence: `src/product/product.controller.ts`)
- Administrator → Product API: manages (evidence: `src/product/product.controller.ts`)
- Shopper → Category API: browses (evidence: `src/category/category.controller.ts`)
- Administrator → Category API: manages (evidence: `src/category/category.controller.ts`)
- Product API → Product service: dispatches (evidence: `src/product/product.controller.ts`)
- Product service → Pagination: gets paging (evidence: `src/product/product.service.ts`)
- Product service → Category service: checks category (evidence: `src/product/product.service.ts`)
- Product service → Prisma database access: queries (evidence: `src/product/product.service.ts`)
- Category API → Category service: dispatches (evidence: `src/category/category.controller.ts`)
- Category service → Prisma database access: queries (evidence: `src/category/category.service.ts`)
- Shopper → Auth API: authenticates (evidence: `src/auth/auth.controller.ts`)
- Auth API → Auth service: dispatches (evidence: `src/auth/auth.controller.ts`)
- Auth service → Prisma database access: reads users (evidence: `src/auth/auth.service.ts`)
- Auth service → User service: loads user (evidence: `src/auth/auth.service.ts`)
- Shopper → User API: manages profile (evidence: `src/user/user.controller.ts`)
- User API → User service: dispatches (evidence: `src/user/user.controller.ts`)
- User service → Prisma database access: reads and writes (evidence: `src/user/user.service.ts`)
- Shopper → Order API: places orders
- Order API → Order service: dispatches (evidence: `src/order/order.controller.ts`)
- Shopper → Review API: submits review (evidence: `src/review/review.controller.ts`)
- Administrator → Review API: reviews entries (evidence: `src/review/review.controller.ts`)
- Review API → Review service: dispatches (evidence: `src/review/review.controller.ts`)
- Review service → Product service: checks product (evidence: `src/review/review.service.ts`)
- Review service → Prisma database access: reads and writes (evidence: `src/review/review.service.ts`)
- Administrator → Statistics API: requests stats
- Statistics API → Statistics service: dispatches (evidence: `src/statistics/statistics.controller.ts`)
- Auth guards → Auth API: protects routes
