# teymurkhanlinurhan/petfeedapp architecture

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

- Interactive diagram: https://gitdiagram.com/teymurkhanlinurhan/petfeedapp
- Repository: https://github.com/teymurkhanlinurhan/petfeedapp

## Overview

PetApp is a full-stack pet-care manager. Users sign in, then manage pets, feeding records and schedules, food inventory, and feeding machines; they can also browse dog and cat breeds. The backend exposes NestJS controllers backed by services and repositories, with PostgreSQL persistence and external breed APIs. The README documents the frontend and product capabilities, but sampled frontend source does not establish its API-call wiring, so those links are not inferred. Several backend subsystem links rely on SOURCE INDEX references rather than inspected implementation excerpts.

Main entry points: [`backend/src/food-stock/food-stock.service.ts`](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.service.ts) (Food inventory), [`backend/src/breed/breed.service.ts`](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/breed/breed.service.ts) (Breed lookup and cache), [`backend/src/pet/pet.service.ts`](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.service.ts) (Pet management), [`backend/src/pet/pet.repository.ts`](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.repository.ts) (Pet repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_login_ui["Sign-in page<br/>[page.tsx]"]
  node_dashboard_ui["Dashboard<br/>[page.tsx]"]
  node_pets_ui["Pet pages<br/>[page.tsx]"]
  node_machine_ui["Machine page<br/>[page.tsx]"]
  node_stock_ui["Stock page<br/>[page.tsx]"]
  node_breed_ui["Breed pages<br/>[page.tsx]"]
end

subgraph group_identity["Authentication"]
  node_auth_api["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_logic["Login and profile<br/>[auth.service.ts]"]
end

subgraph group_petcare["Pet care"]
  node_pet_api["Pet endpoints<br/>[pet.controller.ts]"]
  node_pet_logic["Pet management<br/>[pet.service.ts]"]
  node_pet_store[("Pet repository<br/>[pet.repository.ts]")]
end

subgraph group_inventory["Feeding and inventory"]
  node_feeding_api["Feeding endpoints"]
  node_feeding_logic["Feeding records<br/>[feeding.service.ts]"]
  node_schedule_api["Schedule endpoints"]
  node_schedule_logic["Feeding schedules"]
  node_stock_api["Stock endpoints"]
  node_stock_logic["Food inventory"]
  node_stock_store[("Stock repository")]
end

subgraph group_machine["Feeding machines"]
  node_machine_api["Machine endpoints"]
  node_machine_logic["Machine operations<br/>[machine.service.ts]"]
end

subgraph group_discovery["Breed discovery"]
  node_breed_api["Breed endpoint"]
  node_breed_logic["Breed lookup and cache<br/>[breed.service.ts]"]
  node_dog_api["The Dog API"]
  node_cat_api["The Cat API"]
end

node_user(("Pet owner"))
node_postgres[("PostgreSQL")]

node_user -->|"signs in"| node_login_ui
node_user -->|"manages pets"| node_dashboard_ui
node_user -->|"manages pets"| node_pets_ui
node_user -->|"manages machines"| node_machine_ui
node_user -->|"manages stock"| node_stock_ui
node_user -->|"browses breeds"| node_breed_ui
node_auth_api -->|"delegates to"| node_auth_logic
node_pet_api -->|"delegates to"| node_pet_logic
node_pet_logic -->|"uses"| node_pet_store
node_feeding_api -->|"delegates to"| node_feeding_logic
node_feeding_logic -->|"adjusts stock"| node_stock_logic
node_schedule_api -->|"delegates to"| node_schedule_logic
node_schedule_logic -->|"uses"| node_stock_logic
node_stock_api -->|"delegates to"| node_stock_logic
node_stock_logic -->|"uses"| node_stock_store
node_machine_api -->|"delegates to"| node_machine_logic
node_machine_logic -->|"uses"| node_stock_logic
node_breed_api -->|"delegates to"| node_breed_logic
node_breed_logic -->|"queries"| node_dog_api
node_breed_logic -->|"queries"| node_cat_api
node_pet_store -.->|"persists data"| node_postgres
node_stock_store -.->|"persists data"| node_postgres

click node_login_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/login/page.tsx"
click node_dashboard_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/page.tsx"
click node_pets_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/pets/page.tsx"
click node_machine_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/machine/page.tsx"
click node_stock_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/stock/page.tsx"
click node_breed_ui "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/breeds/page.tsx"
click node_auth_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/auth/auth.controller.ts"
click node_auth_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/auth/auth.service.ts"
click node_pet_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.controller.ts"
click node_pet_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.service.ts"
click node_pet_store "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.repository.ts"
click node_feeding_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding/feeding.controller.ts"
click node_feeding_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding/feeding.service.ts"
click node_schedule_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding-schedule/feeding-schedule.controller.ts"
click node_schedule_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding-schedule/feeding-schedule.service.ts"
click node_stock_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.controller.ts"
click node_stock_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.service.ts"
click node_stock_store "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.repository.ts"
click node_machine_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/machine/machine.controller.ts"
click node_machine_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/machine/machine.service.ts"
click node_breed_api "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/breed/breed.controller.ts"
click node_breed_logic "https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/breed/breed.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_login_ui,node_dashboard_ui,node_pets_ui,node_machine_ui,node_stock_ui,node_breed_ui toneBlue
class node_auth_api,node_auth_logic,node_postgres toneAmber
class node_pet_api,node_pet_logic,node_pet_store toneMint
class node_feeding_api,node_feeding_logic,node_schedule_api,node_schedule_logic,node_stock_api,node_stock_logic,node_stock_store toneRose
class node_machine_api,node_machine_logic,node_user toneIndigo
class node_breed_api,node_breed_logic,node_dog_api,node_cat_api toneTeal
```

## Components

### Web application

- [Sign-in page](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/login/page.tsx): `frontend/src/app/login/page.tsx`
- [Dashboard](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/page.tsx): `frontend/src/app/(app)/page.tsx`
- [Pet pages](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/pets/page.tsx): `frontend/src/app/(app)/pets/page.tsx`
- [Machine page](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/machine/page.tsx): `frontend/src/app/(app)/machine/page.tsx`
- [Stock page](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/stock/page.tsx): `frontend/src/app/(app)/stock/page.tsx`
- [Breed pages](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/frontend/src/app/(app)/breeds/page.tsx): `frontend/src/app/(app)/breeds/page.tsx`

### Authentication

- [Auth endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Login and profile](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`

### Pet care

- [Pet endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.controller.ts): `backend/src/pet/pet.controller.ts`
- [Pet management](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.service.ts): `backend/src/pet/pet.service.ts`
- [Pet repository](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/pet/pet.repository.ts): `backend/src/pet/pet.repository.ts`

### Feeding and inventory

- [Feeding endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding/feeding.controller.ts): `backend/src/feeding/feeding.controller.ts`
- [Feeding records](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding/feeding.service.ts): `backend/src/feeding/feeding.service.ts`
- [Schedule endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding-schedule/feeding-schedule.controller.ts): `backend/src/feeding-schedule/feeding-schedule.controller.ts`
- [Feeding schedules](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/feeding-schedule/feeding-schedule.service.ts): `backend/src/feeding-schedule/feeding-schedule.service.ts`
- [Stock endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.controller.ts): `backend/src/food-stock/food-stock.controller.ts`
- [Food inventory](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.service.ts): `backend/src/food-stock/food-stock.service.ts`
- [Stock repository](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/food-stock/food-stock.repository.ts): `backend/src/food-stock/food-stock.repository.ts`

### Feeding machines

- [Machine endpoints](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/machine/machine.controller.ts): `backend/src/machine/machine.controller.ts`
- [Machine operations](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/machine/machine.service.ts): `backend/src/machine/machine.service.ts`

### Breed discovery

- [Breed endpoint](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/breed/breed.controller.ts): `backend/src/breed/breed.controller.ts`
- [Breed lookup and cache](https://github.com/teymurkhanlinurhan/petfeedapp/blob/main/backend/src/breed/breed.service.ts): `backend/src/breed/breed.service.ts`
- **The Dog API**
- **The Cat API**

### Other components

- **Pet owner**
- **PostgreSQL**

## Connections

- Pet owner → Sign-in page: signs in
- Pet owner → Dashboard: manages pets
- Pet owner → Pet pages: manages pets
- Pet owner → Machine page: manages machines
- Pet owner → Stock page: manages stock
- Pet owner → Breed pages: browses breeds
- Auth endpoints → Login and profile: delegates to (evidence: `backend/src/auth/auth.controller.ts`)
- Pet endpoints → Pet management: delegates to (evidence: `backend/src/pet/pet.controller.ts`)
- Pet management → Pet repository: uses (evidence: `backend/src/pet/pet.service.ts`)
- Feeding endpoints → Feeding records: delegates to (evidence: `backend/src/feeding/feeding.controller.ts`)
- Feeding records → Food inventory: adjusts stock (evidence: `backend/src/feeding/feeding.service.ts`)
- Schedule endpoints → Feeding schedules: delegates to (evidence: `backend/src/feeding-schedule/feeding-schedule.controller.ts`)
- Feeding schedules → Food inventory: uses (evidence: `backend/src/feeding-schedule/feeding-schedule.service.ts`)
- Stock endpoints → Food inventory: delegates to (evidence: `backend/src/food-stock/food-stock.controller.ts`)
- Food inventory → Stock repository: uses (evidence: `backend/src/food-stock/food-stock.service.ts`)
- Machine endpoints → Machine operations: delegates to (evidence: `backend/src/machine/machine.controller.ts`)
- Machine operations → Food inventory: uses (evidence: `backend/src/machine/machine.service.ts`)
- Breed endpoint → Breed lookup and cache: delegates to (evidence: `backend/src/breed/breed.controller.ts`)
- Breed lookup and cache → The Dog API: queries (evidence: `backend/src/breed/breed.service.ts`)
- Breed lookup and cache → The Cat API: queries (evidence: `backend/src/breed/breed.service.ts`)
- Pet repository → PostgreSQL: persists data
- Stock repository → PostgreSQL: persists data
