# jdamour12/umurarashop-be architecture

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

- Interactive diagram: https://gitdiagram.com/jdamour12/umurarashop-be
- Repository: https://github.com/jdamour12/umurarashop-be

## Overview

UmuraraShop is an e-commerce API. Clients use the registered routes to manage accounts, browse products and categories, maintain a cart, and place or manage orders; authentication and admin checks protect applicable routes. Controllers coordinate persistence and side effects, including product-image uploads and email notifications. The graph preserves the documented category, product, cart, order, and account capabilities. Some router/controller and infrastructure details are unsampled, so only relationships supported by excerpts, the source index, or explicit API documentation are shown.

Main entry points: [`server/src/server.ts`](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/server.ts) (Express server), [`server/src/controllers/order.controller.ts`](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/order.controller.ts) (Order lifecycle), [`server/src/services/emailService.ts`](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/services/emailService.ts) (Email delivery), [`server/src/routers/product.router.ts`](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/product.router.ts) (Product routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API routing"]
  node_server["Express server<br/>[server.ts]"]
  node_auth_routes["Auth routes<br/>[auth.router.ts]"]
  node_category_routes["Category routes<br/>[category.router.ts]"]
  node_product_routes["Product routes<br/>[product.router.ts]"]
  node_cart_routes["Cart routes<br/>[cart.router.ts]"]
  node_order_routes["Order routes<br/>[order.router.ts]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_controller["Account workflows<br/>[auth.controller.ts]"]
  node_auth_middleware["Token verification<br/>[auth.middleware.ts]"]
  node_admin_middleware["Admin authorization"]
  node_user_model[("User records<br/>[User.ts]")]
end

subgraph group_commerce["Shop operations"]
  node_category_controller["Category management"]
  node_category_model[("Category records<br/>[Category.ts]")]
  node_product_controller["Product management"]
  node_product_model[("Product records<br/>[Product.ts]")]
  node_upload_middleware["Image upload parsing"]
  node_cart_controller["Cart management<br/>[cart.controller.ts]"]
  node_cart_model[("Cart records<br/>[Cart.ts]")]
  node_order_controller["Order lifecycle"]
  node_order_model[("Order records<br/>[Order.ts]")]
end

subgraph group_integrations["External services"]
  node_cloudinary_config["Image hosting config<br/>[cloudinary.ts]"]
  node_cloudinary["Cloudinary"]
  node_email_service["Email delivery<br/>[emailService.ts]"]
  node_mail_config["Mail provider config<br/>[mail.ts]"]
  node_welcome_template["Welcome email template"]
  node_reset_template["Reset email template"]
  node_order_template["Order email template<br/>[orders.template.ts]"]
end

node_client(("API client"))

node_client -->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_auth_routes
node_server -->|"mounts routes"| node_category_routes
node_server -->|"mounts routes"| node_product_routes
node_server -->|"mounts routes"| node_cart_routes
node_server -->|"mounts routes"| node_order_routes
node_auth_routes -->|"dispatches requests"| node_auth_controller
node_category_routes -->|"dispatches requests"| node_category_controller
node_product_routes -->|"dispatches requests"| node_product_controller
node_cart_routes -->|"dispatches requests"| node_cart_controller
node_order_routes -->|"dispatches requests"| node_order_controller
node_category_routes -->|"checks tokens"| node_auth_middleware
node_product_routes -->|"checks tokens"| node_auth_middleware
node_cart_routes -->|"checks tokens"| node_auth_middleware
node_order_routes -->|"checks tokens"| node_auth_middleware
node_category_routes -->|"checks admin role"| node_admin_middleware
node_product_routes -->|"checks admin role"| node_admin_middleware
node_order_routes -->|"checks admin role"| node_admin_middleware
node_auth_controller -->|"reads and writes"| node_user_model
node_order_controller -->|"reads user"| node_user_model
node_category_controller -->|"manages records"| node_category_model
node_product_controller -->|"manages records"| node_product_model
node_product_controller -->|"validates category"| node_category_model
node_cart_controller -->|"manages cart"| node_cart_model
node_cart_controller -->|"looks up products"| node_product_model
node_order_controller -->|"reads cart"| node_cart_model
node_order_controller -->|"checks and adjusts stock"| node_product_model
node_order_controller -->|"creates and updates orders"| node_order_model
node_product_routes -->|"parses image"| node_upload_middleware
node_product_controller -->|"uses image service"| node_cloudinary_config
node_cloudinary_config -.->|"configures access"| node_cloudinary
node_auth_controller -->|"sends account emails"| node_email_service
node_order_controller -->|"sends order email"| node_email_service
node_email_service -->|"uses provider config"| node_mail_config
node_email_service -->|"renders message"| node_welcome_template
node_email_service -->|"renders message"| node_reset_template
node_email_service -->|"renders message"| node_order_template

click node_server "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/server.ts"
click node_auth_routes "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/auth.router.ts"
click node_category_routes "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/category.router.ts"
click node_product_routes "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/product.router.ts"
click node_cart_routes "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/cart.router.ts"
click node_order_routes "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/order.router.ts"
click node_auth_controller "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/auth.controller.ts"
click node_auth_middleware "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/auth.middleware.ts"
click node_admin_middleware "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/isAdmin.middleware.ts"
click node_user_model "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/User.ts"
click node_category_controller "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/category.controller.ts"
click node_category_model "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Category.ts"
click node_product_controller "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/product.controller.ts"
click node_product_model "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Product.ts"
click node_upload_middleware "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/upload.middleware.ts"
click node_cart_controller "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/cart.controller.ts"
click node_cart_model "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Cart.ts"
click node_order_controller "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/order.controller.ts"
click node_order_model "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Order.ts"
click node_cloudinary_config "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/config/cloudinary.ts"
click node_email_service "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/services/emailService.ts"
click node_mail_config "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/config/mail.ts"
click node_welcome_template "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/welcome.template.ts"
click node_reset_template "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/resetEmail.template.ts"
click node_order_template "https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/orders.template.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_server,node_auth_routes,node_category_routes,node_product_routes,node_cart_routes,node_order_routes,node_client toneBlue
class node_auth_controller,node_auth_middleware,node_admin_middleware,node_user_model toneAmber
class node_category_controller,node_category_model,node_product_controller,node_product_model,node_upload_middleware,node_cart_controller,node_cart_model,node_order_controller,node_order_model toneMint
class node_cloudinary_config,node_cloudinary,node_email_service,node_mail_config,node_welcome_template,node_reset_template,node_order_template toneRose
```

## Components

### API routing

- [Express server](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/server.ts): `server/src/server.ts`
- [Auth routes](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/auth.router.ts): `server/src/routers/auth.router.ts`
- [Category routes](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/category.router.ts): `server/src/routers/category.router.ts`
- [Product routes](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/product.router.ts): `server/src/routers/product.router.ts`
- [Cart routes](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/cart.router.ts): `server/src/routers/cart.router.ts`
- [Order routes](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/routers/order.router.ts): `server/src/routers/order.router.ts`

### Accounts and access

- [Account workflows](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/auth.controller.ts): `server/src/controllers/auth.controller.ts`
- [Token verification](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/auth.middleware.ts): `server/src/middlewares/auth.middleware.ts`
- [Admin authorization](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/isAdmin.middleware.ts): `server/src/middlewares/isAdmin.middleware.ts`
- [User records](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/User.ts): `server/src/models/User.ts`

### Shop operations

- [Category management](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/category.controller.ts): `server/src/controllers/category.controller.ts`
- [Category records](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Category.ts): `server/src/models/Category.ts`
- [Product management](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/product.controller.ts): `server/src/controllers/product.controller.ts`
- [Product records](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Product.ts): `server/src/models/Product.ts`
- [Image upload parsing](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/middlewares/upload.middleware.ts): `server/src/middlewares/upload.middleware.ts`
- [Cart management](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/cart.controller.ts): `server/src/controllers/cart.controller.ts`
- [Cart records](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Cart.ts): `server/src/models/Cart.ts`
- [Order lifecycle](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/controllers/order.controller.ts): `server/src/controllers/order.controller.ts`
- [Order records](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/models/Order.ts): `server/src/models/Order.ts`

### External services

- [Image hosting config](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/config/cloudinary.ts): `server/src/config/cloudinary.ts`
- **Cloudinary**
- [Email delivery](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/services/emailService.ts): `server/src/services/emailService.ts`
- [Mail provider config](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/config/mail.ts): `server/src/config/mail.ts`
- [Welcome email template](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/welcome.template.ts): `server/src/templates/welcome.template.ts`
- [Reset email template](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/resetEmail.template.ts): `server/src/templates/resetEmail.template.ts`
- [Order email template](https://github.com/jdamour12/umurarashop-be/blob/main/server/src/templates/orders.template.ts): `server/src/templates/orders.template.ts`

### Other components

- **API client**

## Connections

- API client → Express server: sends API requests (evidence: `server/src/server.ts`)
- Express server → Auth routes: mounts routes (evidence: `server/src/server.ts`)
- Express server → Category routes: mounts routes (evidence: `server/src/server.ts`)
- Express server → Product routes: mounts routes (evidence: `server/src/server.ts`)
- Express server → Cart routes: mounts routes (evidence: `server/src/server.ts`)
- Express server → Order routes: mounts routes (evidence: `server/src/server.ts`)
- Auth routes → Account workflows: dispatches requests (evidence: `server/src/routers/auth.router.ts`)
- Category routes → Category management: dispatches requests (evidence: `server/src/routers/category.router.ts`)
- Product routes → Product management: dispatches requests (evidence: `server/src/routers/product.router.ts`)
- Cart routes → Cart management: dispatches requests (evidence: `server/src/routers/cart.router.ts`)
- Order routes → Order lifecycle: dispatches requests (evidence: `server/src/routers/order.router.ts`)
- Category routes → Token verification: checks tokens (evidence: `server/src/routers/category.router.ts`)
- Product routes → Token verification: checks tokens (evidence: `server/src/routers/product.router.ts`)
- Cart routes → Token verification: checks tokens (evidence: `server/src/routers/cart.router.ts`)
- Order routes → Token verification: checks tokens (evidence: `server/src/routers/order.router.ts`)
- Category routes → Admin authorization: checks admin role (evidence: `server/src/routers/category.router.ts`)
- Product routes → Admin authorization: checks admin role (evidence: `server/src/routers/product.router.ts`)
- Order routes → Admin authorization: checks admin role (evidence: `server/src/routers/order.router.ts`)
- Account workflows → User records: reads and writes (evidence: `server/src/controllers/auth.controller.ts`)
- Order lifecycle → User records: reads user (evidence: `server/src/controllers/order.controller.ts`)
- Category management → Category records: manages records (evidence: `server/src/controllers/category.controller.ts`)
- Product management → Product records: manages records (evidence: `server/src/controllers/product.controller.ts`)
- Product management → Category records: validates category (evidence: `server/src/controllers/product.controller.ts`)
- Cart management → Cart records: manages cart (evidence: `server/src/controllers/cart.controller.ts`)
- Cart management → Product records: looks up products (evidence: `server/src/controllers/cart.controller.ts`)
- Order lifecycle → Cart records: reads cart (evidence: `server/src/controllers/order.controller.ts`)
- Order lifecycle → Product records: checks and adjusts stock (evidence: `server/src/controllers/order.controller.ts`)
- Order lifecycle → Order records: creates and updates orders (evidence: `server/src/controllers/order.controller.ts`)
- Product routes → Image upload parsing: parses image (evidence: `server/src/routers/product.router.ts`)
- Product management → Image hosting config: uses image service (evidence: `server/src/controllers/product.controller.ts`)
- Image hosting config → Cloudinary: configures access
- Account workflows → Email delivery: sends account emails (evidence: `server/src/controllers/auth.controller.ts`)
- Order lifecycle → Email delivery: sends order email (evidence: `server/src/controllers/order.controller.ts`)
- Email delivery → Mail provider config: uses provider config (evidence: `server/src/services/emailService.ts`)
- Email delivery → Welcome email template: renders message (evidence: `server/src/services/emailService.ts`)
- Email delivery → Reset email template: renders message (evidence: `server/src/services/emailService.ts`)
- Email delivery → Order email template: renders message (evidence: `server/src/services/emailService.ts`)
