# slmakomazi/autospares architecture

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

- Interactive diagram: https://gitdiagram.com/slmakomazi/autospares
- Repository: https://github.com/slmakomazi/autospares

## Overview

Autospares is a parts-catalog storefront backed by Sanity CMS. A visitor browses products; the Angular app loads catalog data through SanityService, then supports text search and filtering by category, parts brand, vehicle fitment, and price, with fallback data if loading fails. The Studio defines the content types editors use to maintain that catalog. The sampled code shows the app-to-service fetch calls and schema definitions; the storefront template and Studio configuration were not excerpted, so their internal wiring is limited to relationships indicated by the source index.

Main entry points: [`studio/schemaTypes/index.ts`](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/index.ts) (Schema registry), [`web/src/app/services/sanity.ts`](https://github.com/slmakomazi/autospares/blob/main/web/src/app/services/sanity.ts) (Sanity fetch service), [`studio/schemaTypes/product.ts`](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/product.ts) (Product schema), [`web/src/app/app.ts`](https://github.com/slmakomazi/autospares/blob/main/web/src/app/app.ts) (Catalog UI and filters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_angular_app["Catalog UI and filters<br/>[app.ts]"]
  node_app_start["Angular bootstrap<br/>[main.ts]"]
  node_app_config["App configuration<br/>[app.config.ts]"]
  node_catalog_service["Sanity fetch service<br/>[sanity.ts]"]
  node_sanity_settings["Sanity connection settings<br/>[environment.ts]"]
end

subgraph group_catalog_data["Catalog Data"]
  node_data_models["Catalog data types<br/>[spares.model.ts]"]
end

subgraph group_cms["Sanity CMS"]
  node_schema_registry["Schema registry<br/>[index.ts]"]
  node_products["Product schema<br/>[product.ts]"]
  node_categories["Category schema<br/>[category.ts]"]
  node_parts_brands["Brand schema<br/>[brand.ts]"]
  node_car_models["Vehicle model schema<br/>[carModel.ts]"]
  node_rich_content["Block content schema<br/>[blockContent.ts]"]
  node_studio_config["Studio configuration<br/>[sanity.config.ts]"]
end

node_visitor(("Catalog visitor"))
node_sanity_platform[("Sanity platform")]

node_visitor -->|"browses catalog"| node_angular_app
node_app_start -->|"loads config"| node_app_config
node_app_start -->|"bootstraps"| node_angular_app
node_angular_app -->|"requests catalog"| node_catalog_service
node_angular_app -->|"uses types"| node_data_models
node_catalog_service -->|"types results"| node_data_models
node_catalog_service -->|"reads settings"| node_sanity_settings
node_catalog_service -->|"fetches records"| node_sanity_platform
node_studio_config -->|"registers schemas"| node_schema_registry
node_schema_registry -->|"includes schema"| node_products
node_schema_registry -->|"includes schema"| node_categories
node_schema_registry -->|"includes schema"| node_parts_brands
node_schema_registry -->|"includes schema"| node_car_models
node_schema_registry -->|"includes schema"| node_rich_content
node_products -->|"references category"| node_categories
node_products -->|"references brand"| node_parts_brands
node_products -->|"references fitment"| node_car_models
node_car_models -->|"references manufacturer"| node_parts_brands

click node_angular_app "https://github.com/slmakomazi/autospares/blob/main/web/src/app/app.ts"
click node_app_start "https://github.com/slmakomazi/autospares/blob/main/web/src/main.ts"
click node_app_config "https://github.com/slmakomazi/autospares/blob/main/web/src/app/app.config.ts"
click node_catalog_service "https://github.com/slmakomazi/autospares/blob/main/web/src/app/services/sanity.ts"
click node_data_models "https://github.com/slmakomazi/autospares/blob/main/web/src/app/models/spares.model.ts"
click node_sanity_settings "https://github.com/slmakomazi/autospares/blob/main/web/src/environments/environment.ts"
click node_schema_registry "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/index.ts"
click node_products "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/product.ts"
click node_categories "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/category.ts"
click node_parts_brands "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/brand.ts"
click node_car_models "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/carModel.ts"
click node_rich_content "https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/blockContent.ts"
click node_studio_config "https://github.com/slmakomazi/autospares/blob/main/studio/sanity.config.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_angular_app,node_app_start,node_app_config,node_catalog_service,node_sanity_settings toneBlue
class node_data_models,node_sanity_platform toneAmber
class node_schema_registry,node_products,node_categories,node_parts_brands,node_car_models,node_rich_content,node_studio_config toneMint
class node_visitor toneIndigo
```

## Components

### Storefront

- [Catalog UI and filters](https://github.com/slmakomazi/autospares/blob/main/web/src/app/app.ts): `web/src/app/app.ts`
- [Angular bootstrap](https://github.com/slmakomazi/autospares/blob/main/web/src/main.ts): `web/src/main.ts`
- [App configuration](https://github.com/slmakomazi/autospares/blob/main/web/src/app/app.config.ts): `web/src/app/app.config.ts`
- [Sanity fetch service](https://github.com/slmakomazi/autospares/blob/main/web/src/app/services/sanity.ts): `web/src/app/services/sanity.ts`
- [Sanity connection settings](https://github.com/slmakomazi/autospares/blob/main/web/src/environments/environment.ts): `web/src/environments/environment.ts`

### Catalog Data

- [Catalog data types](https://github.com/slmakomazi/autospares/blob/main/web/src/app/models/spares.model.ts): `web/src/app/models/spares.model.ts`

### Sanity CMS

- [Schema registry](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/index.ts): `studio/schemaTypes/index.ts`
- [Product schema](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/product.ts): `studio/schemaTypes/product.ts`
- [Category schema](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/category.ts): `studio/schemaTypes/category.ts`
- [Brand schema](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/brand.ts): `studio/schemaTypes/brand.ts`
- [Vehicle model schema](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/carModel.ts): `studio/schemaTypes/carModel.ts`
- [Block content schema](https://github.com/slmakomazi/autospares/blob/main/studio/schemaTypes/blockContent.ts): `studio/schemaTypes/blockContent.ts`
- [Studio configuration](https://github.com/slmakomazi/autospares/blob/main/studio/sanity.config.ts): `studio/sanity.config.ts`

### Other components

- **Catalog visitor**
- **Sanity platform**

## Connections

- Catalog visitor → Catalog UI and filters: browses catalog
- Angular bootstrap → App configuration: loads config (evidence: `web/src/main.ts`)
- Angular bootstrap → Catalog UI and filters: bootstraps (evidence: `web/src/main.ts`)
- Catalog UI and filters → Sanity fetch service: requests catalog (evidence: `web/src/app/app.ts`)
- Catalog UI and filters → Catalog data types: uses types (evidence: `web/src/app/app.ts`)
- Sanity fetch service → Catalog data types: types results (evidence: `web/src/app/services/sanity.ts`)
- Sanity fetch service → Sanity connection settings: reads settings (evidence: `web/src/app/services/sanity.ts`)
- Sanity fetch service → Sanity platform: fetches records (evidence: `web/src/app/services/sanity.ts`)
- Studio configuration → Schema registry: registers schemas (evidence: `studio/sanity.config.ts`)
- Schema registry → Product schema: includes schema (evidence: `studio/schemaTypes/index.ts`)
- Schema registry → Category schema: includes schema (evidence: `studio/schemaTypes/index.ts`)
- Schema registry → Brand schema: includes schema (evidence: `studio/schemaTypes/index.ts`)
- Schema registry → Vehicle model schema: includes schema (evidence: `studio/schemaTypes/index.ts`)
- Schema registry → Block content schema: includes schema (evidence: `studio/schemaTypes/index.ts`)
- Product schema → Category schema: references category (evidence: `studio/schemaTypes/product.ts`)
- Product schema → Brand schema: references brand (evidence: `studio/schemaTypes/product.ts`)
- Product schema → Vehicle model schema: references fitment (evidence: `studio/schemaTypes/product.ts`)
- Vehicle model schema → Brand schema: references manufacturer (evidence: `studio/schemaTypes/carModel.ts`)
