# andresdelossantos99/tagpets architecture

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

- Interactive diagram: https://gitdiagram.com/andresdelossantos99/tagpets
- Repository: https://github.com/andresdelossantos99/tagpets

## Overview

PetTag is a planned mobile-first storefront for personalized pet tags, with a NestJS API and PostgreSQL. The documented customer journey is browse categories, personalize a tag, keep the cart in the frontend, then checkout; checkout revalidates products, stock, personalization and totals, obtains shipping, creates an order and payment preference, and payment is confirmed by webhook. Admins manage categories and orders. The tree contains only a small NestJS categories implementation; frontend, checkout, orders, payments and shipping are documented capabilities, not sampled code. Their wiring below reflects README documentation, not inspected implementation.

Main entry points: [`backend/src/categories/categories.controller.ts`](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.controller.ts) (Category endpoints), [`backend/src/categories/categories.service.ts`](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.service.ts) (Category operations), [`backend/src/app.module.ts`](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/app.module.ts) (API composition), [`backend/src/prisma/prisma.service.ts`](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/prisma/prisma.service.ts) (Prisma service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_frontend["Storefront and cart"]
end

subgraph group_commerce["Commerce workflow"]
  node_checkout["Checkout validation"]
  node_products["Product and stock"]
  node_shipping["Shipping quote"]
  node_orders["Order creation"]
  node_payments["Payment preference"]
  node_webhook["Payment webhook"]
end

subgraph group_backend["NestJS API"]
  node_categories_api["Category endpoints"]
  node_categories_service["Category operations"]
  node_app_module["API composition<br/>[app.module.ts]"]
  node_main["API bootstrap<br/>[main.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma service<br/>[prisma.service.ts]"]
  node_postgres[("PostgreSQL<br/>[schema.prisma]")]
end

node_customer(("Customer"))
node_admin(("Administrator"))
node_mp["Mercado Pago"]
node_shipping_provider["Shipping provider"]

node_customer -->|"browses and configures"| node_frontend
node_frontend -->|"requests categories"| node_categories_api
node_frontend -->|"submits cart"| node_checkout
node_admin -->|"manages categories"| node_categories_api
node_main -->|"starts"| node_app_module
node_app_module -->|"registers"| node_categories_api
node_categories_api -->|"calls"| node_categories_service
node_categories_service -->|"queries categories"| node_prisma
node_prisma -->|"reads and writes"| node_postgres
node_checkout -->|"validates items and stock"| node_products
node_checkout -->|"requests quote"| node_shipping
node_checkout -->|"creates order"| node_orders
node_checkout -->|"creates preference"| node_payments
node_shipping -.->|"requests quote"| node_shipping_provider
node_payments -.->|"creates preference"| node_mp
node_mp -.->|"sends payment event"| node_webhook
node_webhook -->|"confirms payment state"| node_orders

click node_categories_api "https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.controller.ts"
click node_categories_service "https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.service.ts"
click node_app_module "https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/app.module.ts"
click node_main "https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/main.ts"
click node_prisma "https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/prisma/prisma.service.ts"
click node_postgres "https://github.com/andresdelossantos99/tagpets/blob/main/backend/prisma/schema.prisma"

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_frontend toneBlue
class node_checkout,node_products,node_shipping,node_orders,node_payments,node_webhook toneAmber
class node_categories_api,node_categories_service,node_app_module,node_main toneMint
class node_prisma,node_postgres toneRose
class node_customer,node_admin,node_mp,node_shipping_provider toneIndigo
```

## Components

### Storefront

- **Storefront and cart**

### Commerce workflow

- **Checkout validation**
- **Product and stock**
- **Shipping quote**
- **Order creation**
- **Payment preference**
- **Payment webhook**

### NestJS API

- [Category endpoints](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.controller.ts): `backend/src/categories/categories.controller.ts`
- [Category operations](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/categories/categories.service.ts): `backend/src/categories/categories.service.ts`
- [API composition](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/app.module.ts): `backend/src/app.module.ts`
- [API bootstrap](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/main.ts): `backend/src/main.ts`

### Persistence

- [Prisma service](https://github.com/andresdelossantos99/tagpets/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`
- [PostgreSQL](https://github.com/andresdelossantos99/tagpets/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Customer**
- **Administrator**
- **Mercado Pago**
- **Shipping provider**

## Connections

- Customer → Storefront and cart: browses and configures
- Storefront and cart → Category endpoints: requests categories
- Storefront and cart → Checkout validation: submits cart
- Administrator → Category endpoints: manages categories
- API bootstrap → API composition: starts
- API composition → Category endpoints: registers
- Category endpoints → Category operations: calls
- Category operations → Prisma service: queries categories
- Prisma service → PostgreSQL: reads and writes
- Checkout validation → Product and stock: validates items and stock
- Checkout validation → Shipping quote: requests quote
- Checkout validation → Order creation: creates order
- Checkout validation → Payment preference: creates preference
- Shipping quote → Shipping provider: requests quote
- Payment preference → Mercado Pago: creates preference
- Mercado Pago → Payment webhook: sends payment event
- Payment webhook → Order creation: confirms payment state
