# drotyk/recipe-hub architecture

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

- Interactive diagram: https://gitdiagram.com/drotyk/recipe-hub
- Repository: https://github.com/drotyk/recipe-hub

## Overview

Recipe Hub is a recipe-sharing web app: people browse and search recipes, inspect details, and—when authenticated—manage recipes, ingredients, recipe-ingredient links, profiles, and comments. The React client routes pages through a shared API layer to a NestJS API; authentication supports passwords and Google OAuth, with JWT-protected operations. Backend services apply domain logic and use TypeORM repositories for PostgreSQL persistence. The README documents additional capabilities such as ownership/admin rules and Swagger; source excerpts are sampled, so uncertain internal links are omitted.

Main entry points: [`apps/backend/src/repositories/recipe-ingredients.repository.ts`](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/repositories/recipe-ingredients.repository.ts) (TypeORM repositories), [`apps/backend/src/controllers/recipe.controller.ts`](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/controllers/recipe.controller.ts) (REST controllers), [`apps/backend/src/business-logic/auth/auth.service.ts`](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/auth/auth.service.ts) (Authentication), [`apps/frontend/src/api.ts`](https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App and routes<br/>[App.tsx]"]
  node_pages["Feature pages<br/>[recipes-pages.tsx]"]
  node_authctx["Auth provider<br/>[auth.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["NestJS API"]
  node_controllers["REST controllers"]
  node_auth_controller["Auth endpoints<br/>[auth.controller.ts]"]
  node_guard{{"JWT guard<br/>[jwt-auth.guard.ts]"}}
  node_swagger["Swagger API<br/>[main.ts]"]
end

subgraph group_logic["Business logic"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_recipe_service["Recipe management<br/>[recipe.service.ts]"]
  node_ingredient_service["Ingredient catalog"]
  node_link_service["Recipe ingredients"]
  node_comment_service["Comments<br/>[comment.service.ts]"]
  node_user_service["User profiles<br/>[user.service.ts]"]
end

subgraph group_data["Persistence"]
  node_repositories["TypeORM repositories"]
  node_entities["Domain entities<br/>[recipe.entity.ts]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_integrations["External services"]
  node_google["Google OAuth"]
end

node_person(("User"))

node_person -->|"uses"| node_app
node_app -->|"routes to"| node_pages
node_pages -->|"requests data"| node_api_client
node_authctx -->|"calls"| node_api_client
node_api_client -->|"sends API requests"| node_guard
node_guard -->|"admits requests"| node_controllers
node_controllers -->|"calls"| node_recipe_service
node_controllers -->|"calls"| node_ingredient_service
node_controllers -->|"calls"| node_link_service
node_controllers -->|"calls"| node_comment_service
node_controllers -->|"calls"| node_user_service
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"looks up users"| node_user_service
node_recipe_service -->|"persists recipes"| node_repositories
node_ingredient_service -->|"persists ingredients"| node_repositories
node_link_service -->|"reads and writes"| node_repositories
node_comment_service -->|"persists comments"| node_repositories
node_user_service -->|"persists users"| node_repositories
node_repositories -->|"uses mappings"| node_entities
node_repositories -->|"reads and writes"| node_postgres
node_auth_service -.->|"verifies OAuth"| node_google
node_person -.->|"explores API"| node_swagger

click node_app "https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/App.tsx"
click node_pages "https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/pages/recipes-pages.tsx"
click node_authctx "https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/auth.tsx"
click node_api_client "https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/api.ts"
click node_controllers "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/controllers/recipe.controller.ts"
click node_auth_controller "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/controllers/auth.controller.ts"
click node_guard "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/common/guards/jwt-auth.guard.ts"
click node_swagger "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/main.ts"
click node_auth_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/auth/auth.service.ts"
click node_recipe_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/recipe.service.ts"
click node_ingredient_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/ingredient.service.ts"
click node_link_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/recipe-ingredient.service.ts"
click node_comment_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/comment.service.ts"
click node_user_service "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/user.service.ts"
click node_repositories "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/repositories/recipe-ingredients.repository.ts"
click node_entities "https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/domains/entities/recipe.entity.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_app,node_pages,node_authctx,node_api_client,node_person toneBlue
class node_controllers,node_auth_controller,node_guard,node_swagger toneAmber
class node_auth_service,node_recipe_service,node_ingredient_service,node_link_service,node_comment_service,node_user_service toneMint
class node_repositories,node_entities,node_postgres toneRose
class node_google toneIndigo
```

## Components

### React client

- [App and routes](https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/App.tsx): `apps/frontend/src/App.tsx`
- [Feature pages](https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/pages/recipes-pages.tsx): `apps/frontend/src/pages/recipes-pages.tsx`
- [Auth provider](https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/auth.tsx): `apps/frontend/src/auth.tsx`
- [API client](https://github.com/drotyk/recipe-hub/blob/main/apps/frontend/src/api.ts): `apps/frontend/src/api.ts`

### NestJS API

- [REST controllers](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/controllers/recipe.controller.ts): `apps/backend/src/controllers/recipe.controller.ts`
- [Auth endpoints](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/controllers/auth.controller.ts): `apps/backend/src/controllers/auth.controller.ts`
- [JWT guard](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/common/guards/jwt-auth.guard.ts): `apps/backend/src/common/guards/jwt-auth.guard.ts`
- [Swagger API](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/main.ts): `apps/backend/src/main.ts`

### Business logic

- [Authentication](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/auth/auth.service.ts): `apps/backend/src/business-logic/auth/auth.service.ts`
- [Recipe management](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/recipe.service.ts): `apps/backend/src/business-logic/recipe.service.ts`
- [Ingredient catalog](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/ingredient.service.ts): `apps/backend/src/business-logic/ingredient.service.ts`
- [Recipe ingredients](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/recipe-ingredient.service.ts): `apps/backend/src/business-logic/recipe-ingredient.service.ts`
- [Comments](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/comment.service.ts): `apps/backend/src/business-logic/comment.service.ts`
- [User profiles](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/business-logic/user.service.ts): `apps/backend/src/business-logic/user.service.ts`

### Persistence

- [TypeORM repositories](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/repositories/recipe-ingredients.repository.ts): `apps/backend/src/repositories/recipe-ingredients.repository.ts`
- [Domain entities](https://github.com/drotyk/recipe-hub/blob/main/apps/backend/src/domains/entities/recipe.entity.ts): `apps/backend/src/domains/entities/recipe.entity.ts`
- **PostgreSQL**

### External services

- **Google OAuth**

### Other components

- **User**

## Connections

- User → App and routes: uses
- App and routes → Feature pages: routes to
- Feature pages → API client: requests data
- Auth provider → API client: calls
- API client → JWT guard: sends API requests
- JWT guard → REST controllers: admits requests
- REST controllers → Recipe management: calls
- REST controllers → Ingredient catalog: calls
- REST controllers → Recipe ingredients: calls
- REST controllers → Comments: calls
- REST controllers → User profiles: calls
- Auth endpoints → Authentication: calls
- Authentication → User profiles: looks up users
- Recipe management → TypeORM repositories: persists recipes
- Ingredient catalog → TypeORM repositories: persists ingredients
- Recipe ingredients → TypeORM repositories: reads and writes
- Comments → TypeORM repositories: persists comments
- User profiles → TypeORM repositories: persists users
- TypeORM repositories → Domain entities: uses mappings
- TypeORM repositories → PostgreSQL: reads and writes
- Authentication → Google OAuth: verifies OAuth
- User → Swagger API: explores API
