# geovanesv/ecommerce-backend architecture

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

- Interactive diagram: https://gitdiagram.com/geovanesv/ecommerce-backend
- Repository: https://github.com/geovanesv/ecommerce-backend

## Overview

This is a NestJS e-commerce API. Clients authenticate or create accounts, then use endpoints for user profiles, product and category catalog operations, and purchases; administrators have additional management operations. Authentication supports access-token protection and refresh-token rotation, while product endpoints include image uploads. The excerpts show several controller-to-service calls and service access to Prisma; README documents additional capabilities such as category and user CRUD. Unsampled modules are represented only where the README or source index supports them.

Main entry points: [`src/app.module.ts`](https://github.com/geovanesv/ecommerce-backend/blob/main/src/app.module.ts) (App Wiring), [`src/prisma/prisma.service.ts`](https://github.com/geovanesv/ecommerce-backend/blob/main/src/prisma/prisma.service.ts) (Prisma Access), [`src/main.ts`](https://github.com/geovanesv/ecommerce-backend/blob/main/src/main.ts) (HTTP Server), [`src/auth/auth.service.ts`](https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/auth.service.ts) (Token Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API Runtime"]
  node_api["HTTP Server<br/>[main.ts]"]
  node_app["App Wiring<br/>[app.module.ts]"]
end

subgraph group_identity["Identity and Access"]
  node_authguard["JWT Guard"]
  node_authcontroller["Auth Endpoints<br/>[auth.controller.ts]"]
  node_authservice["Token Service<br/>[auth.service.ts]"]
  node_usercontroller["User Endpoints<br/>[user.controller.ts]"]
  node_userservice["User Service<br/>[user.service.ts]"]
end

subgraph group_catalog["Catalog"]
  node_productcontroller["Product Endpoints"]
  node_productservice["Product Service<br/>[product.service.ts]"]
  node_imageupload["Image Upload"]
  node_categorycontroller["Category Endpoints"]
  node_categoryservice["Category Service"]
end

subgraph group_commerce["Commerce"]
  node_purchasecontroller["Purchase Endpoints"]
  node_purchaseservice["Purchase Service"]
end

subgraph group_data["Persistence and Errors"]
  node_prisma["Prisma Access<br/>[prisma.service.ts]"]
  node_database[("Application Database")]
  node_exceptions["Exception Mapping"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_api
node_api -->|"starts"| node_app
node_api -->|"registers"| node_exceptions
node_app -->|"registers guard"| node_authguard
node_app -->|"loads auth module"| node_authcontroller
node_app -->|"loads user module"| node_usercontroller
node_app -->|"loads product module"| node_productcontroller
node_app -->|"loads category module"| node_categorycontroller
node_app -->|"loads purchase module"| node_purchasecontroller
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"looks up user"| node_userservice
node_authservice -->|"stores token state"| node_prisma
node_usercontroller -->|"calls"| node_userservice
node_userservice -->|"reads and writes"| node_prisma
node_productcontroller -->|"calls"| node_productservice
node_productcontroller -->|"configures upload"| node_imageupload
node_categorycontroller -->|"calls"| node_categoryservice
node_purchasecontroller -->|"calls"| node_purchaseservice
node_purchaseservice -->|"reads and writes"| node_prisma
node_prisma -.->|"persists data"| node_database
node_exceptions -.->|"normalizes errors"| node_app

click node_api "https://github.com/geovanesv/ecommerce-backend/blob/main/src/main.ts"
click node_app "https://github.com/geovanesv/ecommerce-backend/blob/main/src/app.module.ts"
click node_authguard "https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/access-jwt-auth.guard.ts"
click node_authcontroller "https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/auth.controller.ts"
click node_authservice "https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/auth.service.ts"
click node_usercontroller "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/user/user.controller.ts"
click node_userservice "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/user/user.service.ts"
click node_productcontroller "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/product/product.controller.ts"
click node_productservice "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/product/product.service.ts"
click node_imageupload "https://github.com/geovanesv/ecommerce-backend/blob/main/src/common/decorators/file-upload.decorator.ts"
click node_categorycontroller "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/category/category.controller.ts"
click node_categoryservice "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/category/category.service.ts"
click node_purchasecontroller "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/purchase/purchase.controller.ts"
click node_purchaseservice "https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/purchase/purchase.service.ts"
click node_prisma "https://github.com/geovanesv/ecommerce-backend/blob/main/src/prisma/prisma.service.ts"
click node_exceptions "https://github.com/geovanesv/ecommerce-backend/blob/main/src/common/interceptors/exception.interceptor.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_api,node_app,node_client toneBlue
class node_authguard,node_authcontroller,node_authservice,node_usercontroller,node_userservice toneAmber
class node_productcontroller,node_productservice,node_imageupload,node_categorycontroller,node_categoryservice toneMint
class node_purchasecontroller,node_purchaseservice toneRose
class node_prisma,node_database,node_exceptions toneIndigo
```

## Components

### API Runtime

- [HTTP Server](https://github.com/geovanesv/ecommerce-backend/blob/main/src/main.ts): `src/main.ts`
- [App Wiring](https://github.com/geovanesv/ecommerce-backend/blob/main/src/app.module.ts): `src/app.module.ts`

### Identity and Access

- [JWT Guard](https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/access-jwt-auth.guard.ts): `src/auth/access-jwt-auth.guard.ts`
- [Auth Endpoints](https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Token Service](https://github.com/geovanesv/ecommerce-backend/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [User Endpoints](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/user/user.controller.ts): `src/models/user/user.controller.ts`
- [User Service](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/user/user.service.ts): `src/models/user/user.service.ts`

### Catalog

- [Product Endpoints](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/product/product.controller.ts): `src/models/product/product.controller.ts`
- [Product Service](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/product/product.service.ts): `src/models/product/product.service.ts`
- [Image Upload](https://github.com/geovanesv/ecommerce-backend/blob/main/src/common/decorators/file-upload.decorator.ts): `src/common/decorators/file-upload.decorator.ts`
- [Category Endpoints](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/category/category.controller.ts): `src/models/category/category.controller.ts`
- [Category Service](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/category/category.service.ts): `src/models/category/category.service.ts`

### Commerce

- [Purchase Endpoints](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/purchase/purchase.controller.ts): `src/models/purchase/purchase.controller.ts`
- [Purchase Service](https://github.com/geovanesv/ecommerce-backend/blob/main/src/models/purchase/purchase.service.ts): `src/models/purchase/purchase.service.ts`

### Persistence and Errors

- [Prisma Access](https://github.com/geovanesv/ecommerce-backend/blob/main/src/prisma/prisma.service.ts): `src/prisma/prisma.service.ts`
- **Application Database**
- [Exception Mapping](https://github.com/geovanesv/ecommerce-backend/blob/main/src/common/interceptors/exception.interceptor.ts): `src/common/interceptors/exception.interceptor.ts`

### Other components

- **API Client**

## Connections

- API Client → HTTP Server: sends requests (evidence: `src/main.ts`)
- HTTP Server → App Wiring: starts (evidence: `src/main.ts`)
- HTTP Server → Exception Mapping: registers (evidence: `src/main.ts`)
- App Wiring → JWT Guard: registers guard (evidence: `src/app.module.ts`)
- App Wiring → Auth Endpoints: loads auth module (evidence: `src/app.module.ts`)
- App Wiring → User Endpoints: loads user module (evidence: `src/app.module.ts`)
- App Wiring → Product Endpoints: loads product module (evidence: `src/app.module.ts`)
- App Wiring → Category Endpoints: loads category module (evidence: `src/app.module.ts`)
- App Wiring → Purchase Endpoints: loads purchase module (evidence: `src/app.module.ts`)
- Auth Endpoints → Token Service: calls (evidence: `src/auth/auth.controller.ts`)
- Token Service → User Service: looks up user (evidence: `src/auth/auth.service.ts`)
- Token Service → Prisma Access: stores token state (evidence: `src/auth/auth.service.ts`)
- User Endpoints → User Service: calls (evidence: `src/models/user/user.controller.ts`)
- User Service → Prisma Access: reads and writes (evidence: `src/models/user/user.service.ts`)
- Product Endpoints → Product Service: calls (evidence: `src/models/product/product.controller.ts`)
- Product Endpoints → Image Upload: configures upload (evidence: `src/models/product/product.controller.ts`)
- Category Endpoints → Category Service: calls (evidence: `src/models/category/category.controller.ts`)
- Purchase Endpoints → Purchase Service: calls (evidence: `src/models/purchase/purchase.controller.ts`)
- Purchase Service → Prisma Access: reads and writes (evidence: `src/models/purchase/purchase.service.ts`)
- Prisma Access → Application Database: persists data
- Exception Mapping → App Wiring: normalizes errors
