# rsingh230105/ecommerce-product-service architecture

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

- Interactive diagram: https://gitdiagram.com/rsingh230105/ecommerce-product-service
- Repository: https://github.com/rsingh230105/ecommerce-product-service

## Overview

Product Service is the e-commerce catalogue API: clients and Order Service request product records and current prices, and the service validates requests, performs CRUD operations, and persists products. Its internal layers are FastAPI routes, Pydantic schemas, SQLAlchemy models and sessions, and PostgreSQL. The README also documents health/readiness checks and Alembic-managed schema changes. Relationships reflect the sampled route calls or explicit README statements; migration internals were not sampled.

Main entry points: [`app/main.py`](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/main.py) (Product and health routes), [`app/database.py`](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/database.py) (Database sessions), [`app/models.py`](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/models.py) (Product model), [`alembic`](https://github.com/rsingh230105/ecommerce-product-service/tree/dev/alembic) (Schema migrations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_routes["Product and health routes<br/>[main.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_catalogue["Catalogue"]
  node_product["Product model<br/>[models.py]"]
end

subgraph group_persistence["Persistence"]
  node_sessions["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_migrations["Schema migrations"]
end

node_clients(("Public clients"))
node_orders(("Order Service"))

node_clients -->|"call API"| node_routes
node_orders -->|"request products"| node_routes
node_routes -->|"validate and serialize"| node_schemas
node_routes -->|"open sessions"| node_sessions
node_routes -->|"query and modify"| node_product
node_product -->|"use base"| node_sessions
node_sessions -->|"persist data"| node_postgres
node_migrations -->|"manage schema"| node_postgres

click node_routes "https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/main.py"
click node_schemas "https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/schemas.py"
click node_product "https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/models.py"
click node_sessions "https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/database.py"
click node_migrations "https://github.com/rsingh230105/ecommerce-product-service/tree/dev/alembic"

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_routes,node_schemas,node_clients toneBlue
class node_product toneAmber
class node_sessions,node_postgres,node_migrations toneMint
class node_orders toneIndigo
```

## Components

### API

- [Product and health routes](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/main.py): `app/main.py`
- [Request and response schemas](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/schemas.py): `app/schemas.py`

### Catalogue

- [Product model](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/models.py): `app/models.py`

### Persistence

- [Database sessions](https://github.com/rsingh230105/ecommerce-product-service/blob/dev/app/database.py): `app/database.py`
- **PostgreSQL**
- [Schema migrations](https://github.com/rsingh230105/ecommerce-product-service/tree/dev/alembic): `alembic`

### Other components

- **Public clients**
- **Order Service**

## Connections

- Public clients → Product and health routes: call API (evidence: `README.md`)
- Order Service → Product and health routes: request products (evidence: `README.md`)
- Product and health routes → Request and response schemas: validate and serialize (evidence: `app/main.py`)
- Product and health routes → Database sessions: open sessions (evidence: `app/main.py`)
- Product and health routes → Product model: query and modify (evidence: `app/main.py`)
- Product model → Database sessions: use base (evidence: `app/models.py`)
- Database sessions → PostgreSQL: persist data (evidence: `README.md`)
- Schema migrations → PostgreSQL: manage schema (evidence: `README.md`)
