# mudst-2026-pegasus/pegasus-tcg-api architecture

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

- Interactive diagram: https://gitdiagram.com/mudst-2026-pegasus/pegasus-tcg-api
- Repository: https://github.com/mudst-2026-pegasus/pegasus-tcg-api

## Overview

Pegasus TCG API is a REST backend for a trading-card marketplace. Its user-facing journey includes account access, catalogue browsing, managing a cart, checkout and order fulfilment; sellers also onboard, manage inventory and listings, and administrators manage catalogue and verification. The README documents collections and direct-to-object-storage uploads as additional capabilities. Source excerpts show selected authentication, catalogue search, cart and storage behavior; other subsystem connections are left unverified rather than inferred.

Main entry points: [`src/main/java/com/pegasus/pegasustcgapi/controller`](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/tree/main/src/main/java/com/pegasus/pegasustcgapi/controller) (REST API), [`src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java`](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java) (Catalogue search), [`src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java`](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java) (Object storage), [`src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java`](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and identity"]
  node_api["REST API"]
  node_auth["Authentication<br/>[AuthService.java]"]
  node_refresh_tokens["Refresh tokens"]
  node_principal["Token principal<br/>[AuthPrincipal.java]"]
end

subgraph group_market["Marketplace journey"]
  node_catalog_search["Catalogue search"]
  node_catalog_data[("Catalogue data")]
  node_cart["Cart<br/>[CartService.java]"]
  node_checkout["Checkout"]
  node_orders["Order lifecycle"]
  node_order_data[("Order data")]
  node_collections["Collections"]
end

subgraph group_seller["Seller operations"]
  node_seller_onboarding["Seller onboarding"]
  node_seller_listings["Listing management"]
  node_inventory["Inventory ledger"]
  node_fulfilment["Seller fulfilment"]
end

subgraph group_platform["Catalogue and platform"]
  node_uploads["Upload workflow<br/>[UploadService.java]"]
  node_object_storage["Object storage"]
  node_taxonomy["Catalogue taxonomy"]
  node_catalog_admin["Catalogue admin"]
  node_verification_admin["Verification review"]
  node_pricing["Market pricing"]
end

node_shopper(("Shopper"))
node_seller_actor(("Seller"))
node_admin_actor(("Administrator"))
node_minio[("MinIO")]

node_shopper -->|"calls endpoints"| node_api
node_seller_actor -->|"calls endpoints"| node_api
node_admin_actor -->|"calls endpoints"| node_api
node_api -.->|"auth requests"| node_auth
node_auth -->|"manages tokens"| node_refresh_tokens
node_shopper -->|"browses catalogue"| node_catalog_search
node_catalog_search -->|"searches products"| node_catalog_data
node_catalog_search -->|"signs image URLs"| node_object_storage
node_shopper -.->|"manages cart"| node_cart
node_shopper -.->|"starts checkout"| node_checkout
node_checkout -.->|"creates orders"| node_orders
node_orders -.->|"stores orders"| node_order_data
node_shopper -->|"updates collection"| node_collections
node_seller_actor -->|"applies to sell"| node_seller_onboarding
node_seller_actor -.->|"manages listings"| node_seller_listings
node_seller_actor -.->|"manages stock"| node_inventory
node_seller_actor -.->|"fulfils orders"| node_fulfilment
node_seller_actor -->|"requests upload URL"| node_uploads
node_uploads -.->|"requests presign"| node_object_storage
node_object_storage -->|"stores objects"| node_minio
node_admin_actor -->|"manages catalogue"| node_catalog_admin
node_admin_actor -->|"manages taxonomy"| node_taxonomy
node_admin_actor -->|"reviews sellers"| node_verification_admin
node_admin_actor -.->|"manages pricing"| node_pricing

click node_api "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/tree/main/src/main/java/com/pegasus/pegasustcgapi/controller"
click node_auth "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java"
click node_refresh_tokens "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/AuthTokenService.java"
click node_principal "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/security/AuthPrincipal.java"
click node_catalog_search "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java"
click node_catalog_data "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/tree/main/src/main/java/com/pegasus/pegasustcgapi/repository"
click node_cart "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CartService.java"
click node_checkout "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CheckoutService.java"
click node_orders "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java"
click node_order_data "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/repository/OrderRepository.java"
click node_collections "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CollectionService.java"
click node_seller_onboarding "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/SellerOnboardingService.java"
click node_seller_listings "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/ListingService.java"
click node_inventory "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/InventoryService.java"
click node_fulfilment "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java"
click node_uploads "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/UploadService.java"
click node_object_storage "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java"
click node_taxonomy "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CatalogTaxonomyService.java"
click node_catalog_admin "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/controller/AdminCatalogProductController.java"
click node_verification_admin "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/controller/AdminVerificationController.java"
click node_pricing "https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/MarketPricingService.java"

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_api,node_auth,node_refresh_tokens,node_principal toneBlue
class node_catalog_search,node_catalog_data,node_cart,node_checkout,node_orders,node_order_data,node_collections,node_minio toneAmber
class node_seller_onboarding,node_seller_listings,node_inventory,node_fulfilment toneMint
class node_uploads,node_object_storage,node_taxonomy,node_catalog_admin,node_verification_admin,node_pricing toneRose
class node_shopper,node_seller_actor,node_admin_actor toneIndigo
```

## Components

### Access and identity

- [REST API](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/tree/main/src/main/java/com/pegasus/pegasustcgapi/controller): `src/main/java/com/pegasus/pegasustcgapi/controller`
- [Authentication](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java): `src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java`
- [Refresh tokens](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/AuthTokenService.java): `src/main/java/com/pegasus/pegasustcgapi/service/AuthTokenService.java`
- [Token principal](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/security/AuthPrincipal.java): `src/main/java/com/pegasus/pegasustcgapi/security/AuthPrincipal.java`

### Marketplace journey

- [Catalogue search](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java): `src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java`
- [Catalogue data](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/tree/main/src/main/java/com/pegasus/pegasustcgapi/repository): `src/main/java/com/pegasus/pegasustcgapi/repository`
- [Cart](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CartService.java): `src/main/java/com/pegasus/pegasustcgapi/service/CartService.java`
- [Checkout](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CheckoutService.java): `src/main/java/com/pegasus/pegasustcgapi/service/CheckoutService.java`
- [Order lifecycle](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java): `src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java`
- [Order data](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/repository/OrderRepository.java): `src/main/java/com/pegasus/pegasustcgapi/repository/OrderRepository.java`
- [Collections](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CollectionService.java): `src/main/java/com/pegasus/pegasustcgapi/service/CollectionService.java`

### Seller operations

- [Seller onboarding](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/SellerOnboardingService.java): `src/main/java/com/pegasus/pegasustcgapi/service/SellerOnboardingService.java`
- [Listing management](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/ListingService.java): `src/main/java/com/pegasus/pegasustcgapi/service/ListingService.java`
- [Inventory ledger](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/InventoryService.java): `src/main/java/com/pegasus/pegasustcgapi/service/InventoryService.java`
- [Seller fulfilment](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java): `src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java`

### Catalogue and platform

- [Upload workflow](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/UploadService.java): `src/main/java/com/pegasus/pegasustcgapi/service/UploadService.java`
- [Object storage](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java): `src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java`
- [Catalogue taxonomy](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/CatalogTaxonomyService.java): `src/main/java/com/pegasus/pegasustcgapi/service/CatalogTaxonomyService.java`
- [Catalogue admin](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/controller/AdminCatalogProductController.java): `src/main/java/com/pegasus/pegasustcgapi/controller/AdminCatalogProductController.java`
- [Verification review](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/controller/AdminVerificationController.java): `src/main/java/com/pegasus/pegasustcgapi/controller/AdminVerificationController.java`
- [Market pricing](https://github.com/mudst-2026-pegasus/pegasus-tcg-api/blob/main/src/main/java/com/pegasus/pegasustcgapi/service/MarketPricingService.java): `src/main/java/com/pegasus/pegasustcgapi/service/MarketPricingService.java`

### Other components

- **Shopper**
- **Seller**
- **Administrator**
- **MinIO**

## Connections

- Shopper → REST API: calls endpoints (evidence: `README.md`)
- Seller → REST API: calls endpoints (evidence: `README.md`)
- Administrator → REST API: calls endpoints (evidence: `README.md`)
- REST API → Authentication: auth requests
- Authentication → Refresh tokens: manages tokens (evidence: `src/main/java/com/pegasus/pegasustcgapi/service/AuthService.java`)
- Shopper → Catalogue search: browses catalogue (evidence: `README.md`)
- Catalogue search → Catalogue data: searches products (evidence: `src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java`)
- Catalogue search → Object storage: signs image URLs (evidence: `src/main/java/com/pegasus/pegasustcgapi/service/CatalogSearchService.java`)
- Shopper → Cart: manages cart
- Shopper → Checkout: starts checkout
- Checkout → Order lifecycle: creates orders
- Order lifecycle → Order data: stores orders (evidence: `src/main/java/com/pegasus/pegasustcgapi/service/OrderLifecycleService.java`)
- Shopper → Collections: updates collection (evidence: `README.md`)
- Seller → Seller onboarding: applies to sell (evidence: `README.md`)
- Seller → Listing management: manages listings
- Seller → Inventory ledger: manages stock
- Seller → Seller fulfilment: fulfils orders
- Seller → Upload workflow: requests upload URL (evidence: `README.md`)
- Upload workflow → Object storage: requests presign
- Object storage → MinIO: stores objects (evidence: `src/main/java/com/pegasus/pegasustcgapi/storage/StorageService.java`)
- Administrator → Catalogue admin: manages catalogue (evidence: `README.md`)
- Administrator → Catalogue taxonomy: manages taxonomy (evidence: `README.md`)
- Administrator → Verification review: reviews sellers (evidence: `README.md`)
- Administrator → Market pricing: manages pricing
