# sato13san/tech0-running_app architecture

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

- Interactive diagram: https://gitdiagram.com/sato13san/tech0-running_app
- Repository: https://github.com/sato13san/tech0-running_app

## Overview

Giftia is a gift-search web app: users enter search conditions in a Next.js interface, which calls a FastAPI backend to query Azure MySQL and display ranked gift results. The main workflow includes condition validation and filtering, optional life-scene matching, zero-result relaxation suggestions, and anonymous search logging. The graph also shows the Azure Functions HTTP adapter and result-card rendering. Backend internals are evidenced by excerpts; Azure MySQL is documented in the README, while the SQL files were not sampled, so their individual schema and data relationships are omitted.

Main entry points: [`backend/main.py`](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py) (Search endpoints), [`giftia-frontend/app/page.tsx`](https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/app/page.tsx) (Search form), [`giftia-frontend/lib/api.ts`](https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/lib/api.ts) (API client), [`backend/database.py`](https://github.com/sato13san/tech0-running_app/blob/main/backend/database.py) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Search interface"]
  node_search_ui["Search form<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_gift_cards["Gift cards<br/>[ResultCard.tsx]"]
end

subgraph group_backend["Search API"]
  node_search_api["Search endpoints<br/>[main.py]"]
  node_filter_builder["Filter builder<br/>[main.py]"]
  node_relax_suggestions["Relax suggestions<br/>[main.py]"]
  node_scene_catalog["Life scenes<br/>[main.py]"]
  node_search_logging["Anonymous logging<br/>[main.py]"]
end

subgraph group_storage["Persistence"]
  node_db_access["Database access<br/>[database.py]"]
  node_azure_mysql[("Azure MySQL")]
end

subgraph group_hosting["HTTP hosting"]
  node_functions_adapter["Functions adapter<br/>[function_app.py]"]
end

node_shopper(("Gift seeker"))

node_shopper -->|"enters conditions"| node_search_ui
node_search_ui -->|"requests search"| node_api_client
node_api_client -->|"calls HTTP API"| node_search_api
node_search_api -->|"builds filters"| node_filter_builder
node_search_api -->|"validates scenes"| node_scene_catalog
node_search_api -->|"queries products"| node_db_access
node_search_api -->|"checks alternatives"| node_relax_suggestions
node_search_api -->|"records search"| node_search_logging
node_db_access -->|"reads and writes"| node_azure_mysql
node_search_api -->|"returns results"| node_api_client
node_search_ui -->|"renders results"| node_gift_cards
node_functions_adapter -->|"wraps FastAPI"| node_search_api

click node_search_ui "https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/app/page.tsx"
click node_api_client "https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/lib/api.ts"
click node_gift_cards "https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/app/ResultCard.tsx"
click node_search_api "https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py"
click node_filter_builder "https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py"
click node_relax_suggestions "https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py"
click node_scene_catalog "https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py"
click node_search_logging "https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py"
click node_db_access "https://github.com/sato13san/tech0-running_app/blob/main/backend/database.py"
click node_functions_adapter "https://github.com/sato13san/tech0-running_app/blob/main/backend/function_app.py"

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_search_ui,node_api_client,node_gift_cards toneBlue
class node_search_api,node_filter_builder,node_relax_suggestions,node_scene_catalog,node_search_logging toneAmber
class node_db_access,node_azure_mysql toneMint
class node_functions_adapter toneRose
class node_shopper toneIndigo
```

## Components

### Search interface

- [Search form](https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/app/page.tsx): `giftia-frontend/app/page.tsx`
- [API client](https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/lib/api.ts): `giftia-frontend/lib/api.ts`
- [Gift cards](https://github.com/sato13san/tech0-running_app/blob/main/giftia-frontend/app/ResultCard.tsx): `giftia-frontend/app/ResultCard.tsx`

### Search API

- [Search endpoints](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py): `backend/main.py`
- [Filter builder](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py): `backend/main.py`
- [Relax suggestions](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py): `backend/main.py`
- [Life scenes](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py): `backend/main.py`
- [Anonymous logging](https://github.com/sato13san/tech0-running_app/blob/main/backend/main.py): `backend/main.py`

### Persistence

- [Database access](https://github.com/sato13san/tech0-running_app/blob/main/backend/database.py): `backend/database.py`
- **Azure MySQL**

### HTTP hosting

- [Functions adapter](https://github.com/sato13san/tech0-running_app/blob/main/backend/function_app.py): `backend/function_app.py`

### Other components

- **Gift seeker**

## Connections

- Gift seeker → Search form: enters conditions (evidence: `giftia-frontend/app/page.tsx`)
- Search form → API client: requests search (evidence: `giftia-frontend/app/page.tsx`)
- API client → Search endpoints: calls HTTP API (evidence: `giftia-frontend/lib/api.ts`)
- Search endpoints → Filter builder: builds filters (evidence: `backend/main.py`)
- Search endpoints → Life scenes: validates scenes (evidence: `backend/main.py`)
- Search endpoints → Database access: queries products (evidence: `backend/main.py`)
- Search endpoints → Relax suggestions: checks alternatives (evidence: `backend/main.py`)
- Search endpoints → Anonymous logging: records search (evidence: `backend/main.py`)
- Database access → Azure MySQL: reads and writes (evidence: `README.md`)
- Search endpoints → API client: returns results (evidence: `giftia-frontend/lib/api.ts`)
- Search form → Gift cards: renders results (evidence: `giftia-frontend/app/page.tsx`)
- Functions adapter → Search endpoints: wraps FastAPI (evidence: `backend/function_app.py`)
