# group900/ipricepro architecture

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

- Interactive diagram: https://gitdiagram.com/group900/ipricepro
- Repository: https://github.com/group900/ipricepro

## Overview

##### Project type and purpose
- This is a monorepo containing three npm/TypeScript packages:
- packages/shared: common types, constants, utilities
- packages/guide: exports Apple product definitions & helpers
- packages/price-data: scripts and functions to retrieve or load price data
- It’s a library/tooling project rather than a full-stack app. The goal is to provide reusable data-model definitions (“guide”) and price-fetching/loading logic (“price-data”), with shared code kept in “shared.”

##### File structure
- Top level:
- pnpm-workspace.yaml & pnpm-lock.yaml – pnpm workspace configuration
- .github/workflows/main.yml – CI pipeline for build & tests
- packages/… – three subdirectories, each with its own package.json and tsconfig.json
- packages/shared: central utilities, types, enums, constants
- packages/guide: AppleProducts.ts, index.ts/test – provides product catalog definitions
- packages/price-data:
– src/getProductPrices.ts (core API)
– scripts/find.ts, findAll.ts (entry points)
– results/*.json (mocked data)
– tests in index.test.ts

##### README for additional insights
- Only links to an external article; no further architecture details. We infer architecture entirely from the code layout.

##### Main components & their relationships
a. Components:
1) Monorepo & pnpm workspace (orchestrator)
2) Shared Package (shared code: types, constants, utils)
3) Guide Package (product definitions & tests)
4) Price-Data Package
– Core Module (getProductPrices API)
– Scripts (find.ts, findAll.ts)
– Data Store (JSON files under results/)
5) CI/CD (GitHub Actions)
b. Interactions:
– guide and price-data both import from shared
– scripts in price-data import getProductPrices, run against results JSON
– tests in each package invoke their respective index.ts or API
– CI pipeline checks out monorepo → installs via pnpm → runs build & tests across all packages
c. Architectural patterns & principles:
– Monorepo with isolated packages & internal dependencies
– Code sharing via a “shared” package to avoid duplication
– Scripts-as-entry-points under price-data following a CLI-style pattern
d. Key technologies: TypeScript, Node.js, pnpm workspaces, JSON data files, GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TD
    CI["CI/CD (GitHub Actions)"]:::external
    Root["Monorepo Root"]:::root

    CI -->|"triggers build & test"| Root

    subgraph "Monorepo Root"
        PNPM["pnpm-workspace.yaml"]:::config
        PX["package.json"]:::config
    end

    subgraph "Packages"
        subgraph "Shared Package"
            SHIdx["index.ts"]:::package
            SHConst["constants.ts"]:::package
            SHEnum["enums.ts"]:::package
            SHPreset["presets.ts"]:::package
            SHTypes["types.ts"]:::package
            SHUtils["utils.ts"]:::package
            SHPkg["package.json"]:::config
            SHTSC["tsconfig.json"]:::config
        end

        subgraph "Guide Package"
            GIdx["index.ts"]:::package
            GAP["AppleProducts.ts"]:::package
            GTypes["types.ts"]:::package
            GTest["index.test.ts"]:::test
            GPkg["package.json"]:::config
            GTSC["tsconfig.json"]:::config
        end

        subgraph "Price-Data Package"
            PDGet["getProductPrices.ts"]:::package
            PDTypes["types.ts"]:::package
            PDUtils["utils.ts"]:::package
            subgraph "Scripts"
                PDSingle["find.ts"]:::process
                PDAll["findAll.ts"]:::process
                PDScriptUtils["utils.ts"]:::process
            end
            PDData["JSON Results"]:::datastore
            PDTest["index.test.ts"]:::test
            PDPkg["package.json"]:::config
            PDTSC["tsconfig.json"]:::config
        end
    end

    Root --> SHPkg
    Root --> GPkg
    Root --> PDPkg

    GIdx -->|imports| SHIdx
    PDGet -->|imports| SHIdx

    PDSingle -->|uses API| PDGet
    PDAll -->|uses API| PDGet
    PDSingle -->|reads data| PDData
    PDAll -->|reads data| PDData

    GTest -->|tests| GIdx
    PDTest -->|tests| PDGet

    classDef package fill:#cce5ff,stroke:#004085,color:#004085
    classDef datastore fill:#fff3cd,stroke:#856404,color:#856404
    classDef process fill:#d4edda,stroke:#155724,color:#155724
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef config fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef test fill:#e2f0fb,stroke:#084b8a,color:#084b8a
    classDef root fill:#d1ecf1,stroke:#0c5460,color:#0c5460

    click PNPM "https://github.com/group900/ipricepro/blob/main//pnpm-workspace.yaml"
    click PX "https://github.com/group900/ipricepro/blob/main//package.json"
    click CI "https://github.com/group900/ipricepro/blob/main//.github/workflows/main.yml"
    click SHConst "https://github.com/group900/ipricepro/blob/main//packages/shared/constants.ts"
    click SHEnum "https://github.com/group900/ipricepro/blob/main//packages/shared/enums.ts"
    click SHPreset "https://github.com/group900/ipricepro/blob/main//packages/shared/presets.ts"
    click SHTypes "https://github.com/group900/ipricepro/blob/main//packages/shared/types.ts"
    click SHUtils "https://github.com/group900/ipricepro/blob/main//packages/shared/utils.ts"
    click SHIdx "https://github.com/group900/ipricepro/blob/main//packages/shared/index.ts"
    click SHPkg "https://github.com/group900/ipricepro/blob/main//packages/shared/package.json"
    click SHTSC "https://github.com/group900/ipricepro/blob/main//packages/shared/tsconfig.json"
    click GAP "https://github.com/group900/ipricepro/blob/main//packages/guide/AppleProducts.ts"
    click GTypes "https://github.com/group900/ipricepro/blob/main//packages/guide/types.ts"
    click GIdx "https://github.com/group900/ipricepro/blob/main//packages/guide/index.ts"
    click GTest "https://github.com/group900/ipricepro/blob/main//packages/guide/index.test.ts"
    click GPkg "https://github.com/group900/ipricepro/blob/main//packages/guide/package.json"
    click GTSC "https://github.com/group900/ipricepro/blob/main//packages/guide/tsconfig.json"
    click PDGet "https://github.com/group900/ipricepro/blob/main//packages/price-data/src/getProductPrices.ts"
    click PDTypes "https://github.com/group900/ipricepro/blob/main//packages/price-data/src/types.ts"
    click PDUtils "https://github.com/group900/ipricepro/blob/main//packages/price-data/src/utils.ts"
    click PDSingle "https://github.com/group900/ipricepro/blob/main//packages/price-data/scripts/find.ts"
    click PDAll "https://github.com/group900/ipricepro/blob/main//packages/price-data/scripts/findAll.ts"
    click PDScriptUtils "https://github.com/group900/ipricepro/blob/main//packages/price-data/scripts/utils.ts"
    click PDData "https://github.com/group900/ipricepro/tree/main//packages/price-data/results"
    click PDTest "https://github.com/group900/ipricepro/blob/main//packages/price-data/index.test.ts"
    click PDPkg "https://github.com/group900/ipricepro/blob/main//packages/price-data/package.json"
    click PDTSC "https://github.com/group900/ipricepro/blob/main//packages/price-data/tsconfig.json"
```
