# akgane/product_shop architecture

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

- Interactive diagram: https://gitdiagram.com/akgane/product_shop
- Repository: https://github.com/akgane/product_shop

## Overview

Product Shop is a small FastAPI service for product CRUD. The workflow is HTTP client → registered product routes → CRUD service → SQLAlchemy product model and PostgreSQL, with Pydantic request/response schemas at the API boundary. Startup creates tables from model metadata; database settings configure the async engine. The README documents the CRUD endpoints and PostgreSQL-backed deployment. Edges reflect shown calls and documented storage; no unsampled runtime subsystem is inferred.

Main entry points: [`app/core/database.py`](https://github.com/akgane/product_shop/blob/master/app/core/database.py) (Async database), [`app/modules/products/router.py`](https://github.com/akgane/product_shop/blob/master/app/modules/products/router.py) (Product routes), [`app/main.py`](https://github.com/akgane/product_shop/blob/master/app/main.py) (FastAPI app), [`app/modules/products/service.py`](https://github.com/akgane/product_shop/blob/master/app/modules/products/service.py) (Product CRUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Layer"]
  node_app["FastAPI app<br/>[main.py]"]
  node_routes["Product routes<br/>[router.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_products["Product Domain"]
  node_service["Product CRUD<br/>[service.py]"]
  node_product["Product model<br/>[models.py]"]
end

subgraph group_persistence["Persistence"]
  node_database["Async database<br/>[database.py]"]
  node_config["Database settings<br/>[config.py]"]
end

node_client(("HTTP client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends HTTP"| node_app
node_app -->|"registers routes"| node_routes
node_app -->|"creates tables"| node_database
node_routes -->|"dispatches CRUD"| node_service
node_routes -->|"injects session"| node_database
node_routes -->|"validates and serializes"| node_schemas
node_service -->|"queries and mutates"| node_product
node_service -->|"accepts request"| node_schemas
node_product -->|"inherits metadata"| node_database
node_database -->|"loads URL"| node_config
node_database -.->|"persists data"| node_postgres

click node_app "https://github.com/akgane/product_shop/blob/master/app/main.py"
click node_routes "https://github.com/akgane/product_shop/blob/master/app/modules/products/router.py"
click node_schemas "https://github.com/akgane/product_shop/blob/master/app/modules/products/schemas.py"
click node_service "https://github.com/akgane/product_shop/blob/master/app/modules/products/service.py"
click node_product "https://github.com/akgane/product_shop/blob/master/app/modules/products/models.py"
click node_database "https://github.com/akgane/product_shop/blob/master/app/core/database.py"
click node_config "https://github.com/akgane/product_shop/blob/master/app/core/config.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_app,node_routes,node_schemas,node_client toneBlue
class node_service,node_product,node_postgres toneAmber
class node_database,node_config toneMint
```

## Components

### API Layer

- [FastAPI app](https://github.com/akgane/product_shop/blob/master/app/main.py): `app/main.py`
- [Product routes](https://github.com/akgane/product_shop/blob/master/app/modules/products/router.py): `app/modules/products/router.py`
- [API schemas](https://github.com/akgane/product_shop/blob/master/app/modules/products/schemas.py): `app/modules/products/schemas.py`

### Product Domain

- [Product CRUD](https://github.com/akgane/product_shop/blob/master/app/modules/products/service.py): `app/modules/products/service.py`
- [Product model](https://github.com/akgane/product_shop/blob/master/app/modules/products/models.py): `app/modules/products/models.py`

### Persistence

- [Async database](https://github.com/akgane/product_shop/blob/master/app/core/database.py): `app/core/database.py`
- [Database settings](https://github.com/akgane/product_shop/blob/master/app/core/config.py): `app/core/config.py`

### Other components

- **HTTP client**
- **PostgreSQL**

## Connections

- HTTP client → FastAPI app: sends HTTP (evidence: `README.md`)
- FastAPI app → Product routes: registers routes (evidence: `app/main.py`)
- FastAPI app → Async database: creates tables (evidence: `app/main.py`)
- Product routes → Product CRUD: dispatches CRUD (evidence: `app/modules/products/router.py`)
- Product routes → Async database: injects session (evidence: `app/modules/products/router.py`)
- Product routes → API schemas: validates and serializes (evidence: `app/modules/products/router.py`)
- Product CRUD → Product model: queries and mutates (evidence: `app/modules/products/service.py`)
- Product CRUD → API schemas: accepts request (evidence: `app/modules/products/service.py`)
- Product model → Async database: inherits metadata (evidence: `app/modules/products/models.py`)
- Async database → Database settings: loads URL (evidence: `app/core/database.py`)
- Async database → PostgreSQL: persists data (evidence: `README.md`)
