# daniilsapielkin01/nodejs_food-app architecture

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

- Interactive diagram: https://gitdiagram.com/daniilsapielkin01/nodejs_food-app
- Repository: https://github.com/daniilsapielkin01/nodejs_food-app

## Overview

This is a TypeScript/Express food-marketplace backend, with separate marketplace and payment app directories. The principal workflow is a customer request entering the marketplace API, passing through role-aware order routes, and creating or retrieving an order; order creation also checks the store and its products. Other major capabilities include authentication, user roles, store and product management, and vouchers. The source index supports many controller-to-repository links, but does not expose repository internals or database wiring, so those details are not inferred.

Main entry points: [`apps/marketplace/src/app.ts`](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/app.ts) (Marketplace API), [`packages/errors/src/index.ts`](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/errors/src/index.ts) (Application errors), [`apps/marketplace/src/modules/orders/orders.controller.ts`](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.controller.ts) (Order dispatch), [`apps/marketplace/src/modules/vouchers/vouchers.controller.ts`](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/vouchers/vouchers.controller.ts) (Voucher management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API runtime"]
  node_marketplace["Marketplace API<br/>[app.ts]"]
end

subgraph group_identity["Identity"]
  node_user_api["User profiles"]
  node_user_data["User data access"]
  node_auth_api["Authentication<br/>[auth.controller.ts]"]
  node_auth_data["Auth data access<br/>[auth.repository.ts]"]
end

subgraph group_commerce["Marketplace domains"]
  node_order_routes["Order routes<br/>[orders.routes.ts]"]
  node_order_dispatch["Order dispatch"]
  node_customer_orders["Customer orders"]
  node_courier_orders["Courier orders"]
  node_owner_orders["Owner orders"]
  node_order_data["Order data access"]
  node_store_api["Store management"]
  node_store_data["Store data access"]
  node_product_api["Product management"]
  node_product_data["Product data access"]
  node_voucher_api["Voucher management"]
  node_voucher_data["Voucher data access"]
end

subgraph group_shared["Shared packages"]
  node_shared_errors["Application errors<br/>[index.ts]"]
  node_prisma_errors["Prisma error mapping<br/>[prisma.errors.ts]"]
  node_http_status["HTTP statuses<br/>[statuses.ts]"]
end

node_customer(("Customer"))

node_customer -->|"sends requests"| node_marketplace
node_marketplace -->|"mounts orders"| node_order_routes
node_marketplace -->|"mounts auth routes"| node_auth_api
node_marketplace -->|"mounts user routes"| node_user_api
node_marketplace -->|"mounts store routes"| node_store_api
node_marketplace -->|"mounts product routes"| node_product_api
node_marketplace -->|"mounts voucher routes"| node_voucher_api
node_order_routes -->|"dispatches handlers"| node_order_dispatch
node_order_dispatch -->|"dispatches customer"| node_customer_orders
node_order_dispatch -->|"dispatches courier"| node_courier_orders
node_order_dispatch -->|"dispatches owner"| node_owner_orders
node_customer_orders -->|"reads and writes"| node_order_data
node_customer_orders -->|"looks up store"| node_store_data
node_courier_orders -->|"reads and writes"| node_order_data
node_store_api -->|"reads and writes"| node_store_data
node_product_api -->|"reads and writes"| node_product_data
node_voucher_api -->|"reads and writes"| node_voucher_data
node_voucher_api -->|"checks owner profile"| node_user_data
node_user_api -->|"reads and writes"| node_user_data
node_auth_api -->|"authenticates users"| node_auth_data
node_auth_api -->|"raises errors"| node_shared_errors
node_user_api -->|"raises errors"| node_shared_errors
node_voucher_api -->|"raises errors"| node_shared_errors
node_shared_errors -->|"uses status codes"| node_http_status
node_prisma_errors -->|"exports mapper"| node_shared_errors

click node_marketplace "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/app.ts"
click node_order_routes "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.routes.ts"
click node_order_dispatch "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.controller.ts"
click node_customer_orders "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/customer.controllers.ts"
click node_courier_orders "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/courier.controllers.ts"
click node_owner_orders "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/owner.controllers.ts"
click node_order_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.repository.ts"
click node_store_api "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/stores/stores.controller.ts"
click node_store_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/stores/stores.repository.ts"
click node_product_api "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/products/products.controller.ts"
click node_product_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/products/products.repository.ts"
click node_voucher_api "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/vouchers/vouchers.controller.ts"
click node_voucher_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/vouchers/vouchers.repository.ts"
click node_user_api "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/users/users.controller.ts"
click node_user_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/users/users.repository.ts"
click node_auth_api "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/auth/auth.controller.ts"
click node_auth_data "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/auth/auth.repository.ts"
click node_shared_errors "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/errors/src/index.ts"
click node_prisma_errors "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/errors/src/prisma.errors.ts"
click node_http_status "https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/constants/src/statuses.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_marketplace toneBlue
class node_user_api,node_user_data,node_auth_api,node_auth_data toneAmber
class node_order_routes,node_order_dispatch,node_customer_orders,node_courier_orders,node_owner_orders,node_order_data,node_store_api,node_store_data,node_product_api,node_product_data,node_voucher_api,node_voucher_data toneMint
class node_shared_errors,node_prisma_errors,node_http_status toneRose
class node_customer toneIndigo
```

## Components

### API runtime

- [Marketplace API](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/app.ts): `apps/marketplace/src/app.ts`

### Identity

- [User profiles](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/users/users.controller.ts): `apps/marketplace/src/modules/users/users.controller.ts`
- [User data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/users/users.repository.ts): `apps/marketplace/src/modules/users/users.repository.ts`
- [Authentication](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/auth/auth.controller.ts): `apps/marketplace/src/modules/auth/auth.controller.ts`
- [Auth data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/auth/auth.repository.ts): `apps/marketplace/src/modules/auth/auth.repository.ts`

### Marketplace domains

- [Order routes](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.routes.ts): `apps/marketplace/src/modules/orders/orders.routes.ts`
- [Order dispatch](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.controller.ts): `apps/marketplace/src/modules/orders/orders.controller.ts`
- [Customer orders](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/customer.controllers.ts): `apps/marketplace/src/modules/orders/controllers/customer.controllers.ts`
- [Courier orders](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/courier.controllers.ts): `apps/marketplace/src/modules/orders/controllers/courier.controllers.ts`
- [Owner orders](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/controllers/owner.controllers.ts): `apps/marketplace/src/modules/orders/controllers/owner.controllers.ts`
- [Order data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/orders/orders.repository.ts): `apps/marketplace/src/modules/orders/orders.repository.ts`
- [Store management](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/stores/stores.controller.ts): `apps/marketplace/src/modules/stores/stores.controller.ts`
- [Store data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/stores/stores.repository.ts): `apps/marketplace/src/modules/stores/stores.repository.ts`
- [Product management](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/products/products.controller.ts): `apps/marketplace/src/modules/products/products.controller.ts`
- [Product data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/products/products.repository.ts): `apps/marketplace/src/modules/products/products.repository.ts`
- [Voucher management](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/vouchers/vouchers.controller.ts): `apps/marketplace/src/modules/vouchers/vouchers.controller.ts`
- [Voucher data access](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/apps/marketplace/src/modules/vouchers/vouchers.repository.ts): `apps/marketplace/src/modules/vouchers/vouchers.repository.ts`

### Shared packages

- [Application errors](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/errors/src/index.ts): `packages/errors/src/index.ts`
- [Prisma error mapping](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/errors/src/prisma.errors.ts): `packages/errors/src/prisma.errors.ts`
- [HTTP statuses](https://github.com/daniilsapielkin01/nodejs_food-app/blob/main/packages/constants/src/statuses.ts): `packages/constants/src/statuses.ts`

### Other components

- **Customer**

## Connections

- Customer → Marketplace API: sends requests
- Marketplace API → Order routes: mounts orders (evidence: `apps/marketplace/src/app.ts`)
- Marketplace API → Authentication: mounts auth routes (evidence: `apps/marketplace/src/app.ts`)
- Marketplace API → User profiles: mounts user routes (evidence: `apps/marketplace/src/app.ts`)
- Marketplace API → Store management: mounts store routes (evidence: `apps/marketplace/src/app.ts`)
- Marketplace API → Product management: mounts product routes (evidence: `apps/marketplace/src/app.ts`)
- Marketplace API → Voucher management: mounts voucher routes (evidence: `apps/marketplace/src/app.ts`)
- Order routes → Order dispatch: dispatches handlers (evidence: `apps/marketplace/src/modules/orders/orders.routes.ts`)
- Order dispatch → Customer orders: dispatches customer (evidence: `apps/marketplace/src/modules/orders/orders.controller.ts`)
- Order dispatch → Courier orders: dispatches courier (evidence: `apps/marketplace/src/modules/orders/orders.controller.ts`)
- Order dispatch → Owner orders: dispatches owner (evidence: `apps/marketplace/src/modules/orders/orders.controller.ts`)
- Customer orders → Order data access: reads and writes (evidence: `apps/marketplace/src/modules/orders/controllers/customer.controllers.ts`)
- Customer orders → Store data access: looks up store (evidence: `apps/marketplace/src/modules/orders/controllers/customer.controllers.ts`)
- Courier orders → Order data access: reads and writes (evidence: `apps/marketplace/src/modules/orders/controllers/courier.controllers.ts`)
- Store management → Store data access: reads and writes (evidence: `apps/marketplace/src/modules/stores/stores.controller.ts`)
- Product management → Product data access: reads and writes (evidence: `apps/marketplace/src/modules/products/products.controller.ts`)
- Voucher management → Voucher data access: reads and writes (evidence: `apps/marketplace/src/modules/vouchers/vouchers.controller.ts`)
- Voucher management → User data access: checks owner profile (evidence: `apps/marketplace/src/modules/vouchers/vouchers.controller.ts`)
- User profiles → User data access: reads and writes (evidence: `apps/marketplace/src/modules/users/users.controller.ts`)
- Authentication → Auth data access: authenticates users (evidence: `apps/marketplace/src/modules/auth/auth.controller.ts`)
- Authentication → Application errors: raises errors (evidence: `apps/marketplace/src/modules/auth/auth.controller.ts`)
- User profiles → Application errors: raises errors (evidence: `apps/marketplace/src/modules/users/users.controller.ts`)
- Voucher management → Application errors: raises errors (evidence: `apps/marketplace/src/modules/vouchers/vouchers.controller.ts`)
- Application errors → HTTP statuses: uses status codes (evidence: `packages/errors/src/index.ts`)
- Prisma error mapping → Application errors: exports mapper (evidence: `packages/errors/src/index.ts`)
