# iscarvalho/recipes-api architecture

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

- Interactive diagram: https://gitdiagram.com/iscarvalho/recipes-api
- Repository: https://github.com/iscarvalho/recipes-api

## Overview

Recipes API is a NestJS REST service for browsing recipes, with optional category filtering and single-recipe lookup. The principal flow validates requests, routes them through the recipes controller and service, and queries the Supabase-backed Postgres store; the database migrations define the recipe schema and privileges. Swagger exposes API documentation. The sampled source confirms these calls and the Supabase client setup; unsampled module details are represented only where supported by the README or file tree.

Main entry points: [`src/main.ts`](https://github.com/iscarvalho/recipes-api/blob/main/src/main.ts) (App bootstrap), [`src/recipes/recipes.controller.ts`](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.controller.ts) (Recipes controller), [`src/recipes/recipes.service.ts`](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.service.ts) (Recipes service), [`src/supabase/supabase.service.ts`](https://github.com/iscarvalho/recipes-api/blob/main/src/supabase/supabase.service.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_bootstrap["App bootstrap<br/>[main.ts]"]
  node_recipes_controller["Recipes controller"]
  node_swagger["Swagger docs<br/>[main.ts]"]
end

subgraph group_recipes["Recipe domain"]
  node_request_dto["List filter DTO"]
  node_recipe_service["Recipes service<br/>[recipes.service.ts]"]
  node_recipe_model["Recipe model<br/>[recipe.entity.ts]"]
end

subgraph group_persistence["Persistence"]
  node_supabase_service["Supabase client"]
  node_config["App configuration<br/>[app.module.ts]"]
  node_recipe_db[("Recipes database")]
  node_privileges["DB privileges"]
end

node_client(("API client"))

node_client -->|"sends request"| node_bootstrap
node_bootstrap -->|"routes request"| node_recipes_controller
node_bootstrap -->|"validates query"| node_request_dto
node_recipes_controller -->|"calls lookup"| node_recipe_service
node_recipes_controller -->|"accepts filter"| node_request_dto
node_recipes_controller -->|"returns recipes"| node_recipe_model
node_recipe_service -->|"gets client"| node_supabase_service
node_recipe_service -->|"queries recipes"| node_recipe_db
node_supabase_service -->|"reads settings"| node_config
node_recipe_db -->|"grants access"| node_privileges
node_bootstrap -->|"serves docs"| node_swagger
node_client -.->|"views docs"| node_swagger

click node_bootstrap "https://github.com/iscarvalho/recipes-api/blob/main/src/main.ts"
click node_recipes_controller "https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.controller.ts"
click node_request_dto "https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/dto/list-recipes.dto.ts"
click node_recipe_service "https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.service.ts"
click node_recipe_model "https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/entities/recipe.entity.ts"
click node_supabase_service "https://github.com/iscarvalho/recipes-api/blob/main/src/supabase/supabase.service.ts"
click node_config "https://github.com/iscarvalho/recipes-api/blob/main/src/app.module.ts"
click node_recipe_db "https://github.com/iscarvalho/recipes-api/blob/main/supabase/migrations/20260915120000_create_recipes.sql"
click node_privileges "https://github.com/iscarvalho/recipes-api/blob/main/supabase/migrations/20260915140000_grant_recipes_privileges.sql"
click node_swagger "https://github.com/iscarvalho/recipes-api/blob/main/src/main.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_bootstrap,node_recipes_controller,node_swagger,node_client toneBlue
class node_request_dto,node_recipe_service,node_recipe_model toneAmber
class node_supabase_service,node_config,node_recipe_db,node_privileges toneMint
```

## Components

### API surface

- [App bootstrap](https://github.com/iscarvalho/recipes-api/blob/main/src/main.ts): `src/main.ts`
- [Recipes controller](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.controller.ts): `src/recipes/recipes.controller.ts`
- [Swagger docs](https://github.com/iscarvalho/recipes-api/blob/main/src/main.ts): `src/main.ts`

### Recipe domain

- [List filter DTO](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/dto/list-recipes.dto.ts): `src/recipes/dto/list-recipes.dto.ts`
- [Recipes service](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/recipes.service.ts): `src/recipes/recipes.service.ts`
- [Recipe model](https://github.com/iscarvalho/recipes-api/blob/main/src/recipes/entities/recipe.entity.ts): `src/recipes/entities/recipe.entity.ts`

### Persistence

- [Supabase client](https://github.com/iscarvalho/recipes-api/blob/main/src/supabase/supabase.service.ts): `src/supabase/supabase.service.ts`
- [App configuration](https://github.com/iscarvalho/recipes-api/blob/main/src/app.module.ts): `src/app.module.ts`
- [Recipes database](https://github.com/iscarvalho/recipes-api/blob/main/supabase/migrations/20260915120000_create_recipes.sql): `supabase/migrations/20260915120000_create_recipes.sql`
- [DB privileges](https://github.com/iscarvalho/recipes-api/blob/main/supabase/migrations/20260915140000_grant_recipes_privileges.sql): `supabase/migrations/20260915140000_grant_recipes_privileges.sql`

### Other components

- **API client**

## Connections

- API client → App bootstrap: sends request
- App bootstrap → Recipes controller: routes request
- App bootstrap → List filter DTO: validates query
- Recipes controller → Recipes service: calls lookup
- Recipes controller → List filter DTO: accepts filter
- Recipes controller → Recipe model: returns recipes
- Recipes service → Supabase client: gets client
- Recipes service → Recipes database: queries recipes
- Supabase client → App configuration: reads settings
- Recipes database → DB privileges: grants access
- App bootstrap → Swagger docs: serves docs
- API client → Swagger docs: views docs
