# karthikeyanh/seg-catalogue architecture

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

- Interactive diagram: https://gitdiagram.com/karthikeyanh/seg-catalogue
- Repository: https://github.com/karthikeyanh/seg-catalogue

## Overview

SEG Spare Parts Catalogue is a searchable catalogue of starters and generators, with cross-references and component part numbers. Customers search and filter products through the web or mobile client, which the README describes as reading from the API; the API returns catalogue records from the database. Administrators use the web admin panel and token-protected API operations to manage records. The backend also seeds an empty database from the catalogue JSON. Web and mobile implementation details are not included in the sampled source, so those links reflect README documentation.

Main entry points: [`backend/app/main.py`](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/main.py) (HTTP API), [`backend/app/crud.py`](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/crud.py) (Search and CRUD), [`web`](https://github.com/karthikeyanh/seg-catalogue/tree/main/web) (Web app and admin), [`backend/app/db.py`](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/db.py) (DB sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Catalogue clients"]
  node_web["Web app and admin"]
  node_mobile["Mobile app"]
end

subgraph group_service["Catalogue API"]
  node_api["HTTP API<br/>[main.py]"]
  node_crud["Search and CRUD<br/>[crud.py]"]
  node_schemas["Product validation<br/>[schemas.py]"]
end

subgraph group_storage["Catalogue storage"]
  node_models["Product records<br/>[models.py]"]
  node_db["DB sessions<br/>[db.py]"]
  node_database[("Catalogue database")]
end

subgraph group_ingest["Catalogue data"]
  node_seed["Seed loader<br/>[main.py]"]
  node_catalogue["Catalogue seed data"]
end

node_customer(("Customer"))
node_administrator(("Administrator"))

node_customer -.->|"uses"| node_web
node_administrator -.->|"manages catalogue"| node_web
node_web -.->|"requests catalogue"| node_api
node_mobile -.->|"reads catalogue"| node_api
node_api -->|"calls search and create"| node_crud
node_crud -->|"creates and searches"| node_models
node_api -->|"reads records"| node_models
node_api -->|"uses sessions"| node_db
node_crud -->|"queries and writes"| node_database
node_db -->|"connects"| node_database
node_api -->|"validates requests"| node_schemas
node_seed -->|"loads when empty"| node_catalogue
node_seed -->|"creates products"| node_crud

click node_web "https://github.com/karthikeyanh/seg-catalogue/tree/main/web"
click node_mobile "https://github.com/karthikeyanh/seg-catalogue/tree/main/mobile"
click node_api "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/main.py"
click node_crud "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/crud.py"
click node_schemas "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/schemas.py"
click node_models "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/models.py"
click node_db "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/db.py"
click node_seed "https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/main.py"
click node_catalogue "https://github.com/karthikeyanh/seg-catalogue/blob/main/data/catalogue_data.json"

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_web,node_mobile toneBlue
class node_api,node_crud,node_schemas toneAmber
class node_models,node_db,node_database toneMint
class node_seed,node_catalogue toneRose
class node_customer,node_administrator toneIndigo
```

## Components

### Catalogue clients

- [Web app and admin](https://github.com/karthikeyanh/seg-catalogue/tree/main/web): `web`
- [Mobile app](https://github.com/karthikeyanh/seg-catalogue/tree/main/mobile): `mobile`

### Catalogue API

- [HTTP API](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/main.py): `backend/app/main.py`
- [Search and CRUD](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/crud.py): `backend/app/crud.py`
- [Product validation](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Catalogue storage

- [Product records](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/models.py): `backend/app/models.py`
- [DB sessions](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/db.py): `backend/app/db.py`
- **Catalogue database**

### Catalogue data

- [Seed loader](https://github.com/karthikeyanh/seg-catalogue/blob/main/backend/app/main.py): `backend/app/main.py`
- [Catalogue seed data](https://github.com/karthikeyanh/seg-catalogue/blob/main/data/catalogue_data.json): `data/catalogue_data.json`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Web app and admin: uses (evidence: `README.md`)
- Administrator → Web app and admin: manages catalogue (evidence: `README.md`)
- Web app and admin → HTTP API: requests catalogue (evidence: `README.md`)
- Mobile app → HTTP API: reads catalogue (evidence: `README.md`)
- HTTP API → Search and CRUD: calls search and create (evidence: `backend/app/main.py`)
- Search and CRUD → Product records: creates and searches (evidence: `backend/app/crud.py`)
- HTTP API → Product records: reads records (evidence: `backend/app/main.py`)
- HTTP API → DB sessions: uses sessions (evidence: `backend/app/main.py`)
- Search and CRUD → Catalogue database: queries and writes (evidence: `backend/app/crud.py`)
- DB sessions → Catalogue database: connects (evidence: `backend/app/db.py`)
- HTTP API → Product validation: validates requests (evidence: `backend/app/main.py`)
- Seed loader → Catalogue seed data: loads when empty (evidence: `backend/app/main.py`)
- Seed loader → Search and CRUD: creates products (evidence: `backend/app/main.py`)
