# vizzaq23/tcg architecture

> Architecture diagram of the GitHub repository vizzaq23/tcg, 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/vizzaq23/tcg
- Repository: https://github.com/vizzaq23/tcg
- Video tour (about a minute): https://gitdiagram.com/vizzaq23/tcg/video

## Overview

One Piece TCG Shelf is a collector platform: collectors browse a card catalog, build and value private collections, then share public shelves and connect socially. Its distinct branches include portfolio/trade features, the Journey experience, price caching, and a seller storefront with Stripe checkout. The README establishes the broad capabilities and Supabase/Stripe integrations; sampled source confirms selected catalog, authentication, and checkout/webhook relationships. Several feature pages and services were not sampled, so their internal links are omitted rather than inferred.

Main entry points: [`app/api/shop/checkout/route.ts`](https://github.com/vizzaq23/tcg/blob/main/app/api/shop/checkout/route.ts) (Checkout API), [`app/api/shop/webhook/route.ts`](https://github.com/vizzaq23/tcg/blob/main/app/api/shop/webhook/route.ts) (Payment Webhook), [`lib/prices/repository.ts`](https://github.com/vizzaq23/tcg/blob/main/lib/prices/repository.ts) (Price Repository), [`app/browse/page.tsx`](https://github.com/vizzaq23/tcg/blob/main/app/browse/page.tsx) (Browse Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog and Journey"]
  node_browse["Browse Catalog<br/>[page.tsx]"]
  node_catalog_search["Catalog Search<br/>[catalog-query.ts]"]
  node_journey["Journey Explorer<br/>[page.tsx]"]
end

subgraph group_collection["Collection and Profiles"]
  node_collection_dashboard["Collection Dashboard<br/>[page.tsx]"]
  node_portfolio["Portfolio<br/>[page.tsx]"]
  node_public_profile["Public Shelf<br/>[page.tsx]"]
  node_showcase["Collector Showcase"]
end

subgraph group_social["Community Features"]
  node_trades["Trade Offers<br/>[page.tsx]"]
  node_social_feed["Social and Follows<br/>[page.tsx]"]
  node_creator["Creator Studio<br/>[page.tsx]"]
end

subgraph group_commerce["Shop and Orders"]
  node_shopfront["Shop Storefront<br/>[page.tsx]"]
  node_cart["Cookie Cart<br/>[page.tsx]"]
  node_checkout_route["Checkout API<br/>[route.ts]"]
  node_order_workflow["Order Lifecycle<br/>[checkout.ts]"]
  node_webhook["Payment Webhook<br/>[route.ts]"]
end

subgraph group_platform["Platform Services"]
  node_price_sync["Price Sync<br/>[route.ts]"]
  node_price_repository["Price Repository<br/>[repository.ts]"]
end

node_collector(("Collector"))
node_justtcg["JustTCG"]
node_supabase[("Supabase")]
node_stripe["Stripe"]
node_auth["Supabase Auth"]

node_collector -->|"browses"| node_browse
node_browse -->|"searches via"| node_catalog_search
node_collector -->|"tracks cards"| node_collection_dashboard
node_collection_dashboard -->|"reads collection"| node_supabase
node_collector -->|"views value"| node_portfolio
node_collector -->|"shares shelf"| node_public_profile
node_public_profile -->|"shows showcase"| node_showcase
node_collector -->|"offers trades"| node_trades
node_collector -->|"follows collectors"| node_social_feed
node_collector -->|"creates content"| node_creator
node_collector -->|"explores journey"| node_journey
node_collector -->|"shops listings"| node_shopfront
node_shopfront -->|"adds to cart"| node_cart
node_cart -->|"starts checkout"| node_checkout_route
node_checkout_route -->|"reserves order"| node_order_workflow
node_checkout_route -->|"stores order"| node_supabase
node_checkout_route -->|"creates session"| node_stripe
node_stripe -->|"sends events"| node_webhook
node_webhook -->|"finalizes payment"| node_order_workflow
node_webhook -->|"updates order"| node_supabase
node_price_sync -.->|"syncs prices"| node_price_repository
node_price_repository -->|"matches provider data"| node_justtcg
node_price_repository -->|"caches prices"| node_supabase
node_collector -->|"signs in"| node_auth
node_auth -->|"authenticates with"| node_supabase

click node_browse "https://github.com/vizzaq23/tcg/blob/main/app/browse/page.tsx"
click node_catalog_search "https://github.com/vizzaq23/tcg/blob/main/lib/catalog-query.ts"
click node_journey "https://github.com/vizzaq23/tcg/blob/main/app/journey/page.tsx"
click node_collection_dashboard "https://github.com/vizzaq23/tcg/blob/main/app/collection/page.tsx"
click node_portfolio "https://github.com/vizzaq23/tcg/blob/main/app/collection/portfolio/page.tsx"
click node_public_profile "https://github.com/vizzaq23/tcg/blob/main/app/u/%5Busername%5D/page.tsx"
click node_showcase "https://github.com/vizzaq23/tcg/blob/main/components/collection/ShowcaseGlassCase.tsx"
click node_trades "https://github.com/vizzaq23/tcg/blob/main/app/collection/trades/page.tsx"
click node_social_feed "https://github.com/vizzaq23/tcg/blob/main/app/social/page.tsx"
click node_creator "https://github.com/vizzaq23/tcg/blob/main/app/creator-studio/page.tsx"
click node_shopfront "https://github.com/vizzaq23/tcg/blob/main/app/shop/page.tsx"
click node_cart "https://github.com/vizzaq23/tcg/blob/main/app/cart/page.tsx"
click node_checkout_route "https://github.com/vizzaq23/tcg/blob/main/app/api/shop/checkout/route.ts"
click node_order_workflow "https://github.com/vizzaq23/tcg/blob/main/lib/shop/checkout.ts"
click node_webhook "https://github.com/vizzaq23/tcg/blob/main/app/api/shop/webhook/route.ts"
click node_price_sync "https://github.com/vizzaq23/tcg/blob/main/app/api/admin/prices/refresh/route.ts"
click node_price_repository "https://github.com/vizzaq23/tcg/blob/main/lib/prices/repository.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_browse,node_catalog_search,node_journey toneBlue
class node_collection_dashboard,node_portfolio,node_public_profile,node_showcase,node_supabase toneAmber
class node_trades,node_social_feed,node_creator toneMint
class node_shopfront,node_cart,node_checkout_route,node_order_workflow,node_webhook toneRose
class node_price_sync,node_price_repository,node_collector,node_justtcg,node_stripe,node_auth toneIndigo
```

## Components

### Catalog and Journey

- [Browse Catalog](https://github.com/vizzaq23/tcg/blob/main/app/browse/page.tsx): `app/browse/page.tsx`
- [Catalog Search](https://github.com/vizzaq23/tcg/blob/main/lib/catalog-query.ts): `lib/catalog-query.ts`
- [Journey Explorer](https://github.com/vizzaq23/tcg/blob/main/app/journey/page.tsx): `app/journey/page.tsx`

### Collection and Profiles

- [Collection Dashboard](https://github.com/vizzaq23/tcg/blob/main/app/collection/page.tsx): `app/collection/page.tsx`
- [Portfolio](https://github.com/vizzaq23/tcg/blob/main/app/collection/portfolio/page.tsx): `app/collection/portfolio/page.tsx`
- [Public Shelf](https://github.com/vizzaq23/tcg/blob/main/app/u/%5Busername%5D/page.tsx): `app/u/[username]/page.tsx`
- [Collector Showcase](https://github.com/vizzaq23/tcg/blob/main/components/collection/ShowcaseGlassCase.tsx): `components/collection/ShowcaseGlassCase.tsx`

### Community Features

- [Trade Offers](https://github.com/vizzaq23/tcg/blob/main/app/collection/trades/page.tsx): `app/collection/trades/page.tsx`
- [Social and Follows](https://github.com/vizzaq23/tcg/blob/main/app/social/page.tsx): `app/social/page.tsx`
- [Creator Studio](https://github.com/vizzaq23/tcg/blob/main/app/creator-studio/page.tsx): `app/creator-studio/page.tsx`

### Shop and Orders

- [Shop Storefront](https://github.com/vizzaq23/tcg/blob/main/app/shop/page.tsx): `app/shop/page.tsx`
- [Cookie Cart](https://github.com/vizzaq23/tcg/blob/main/app/cart/page.tsx): `app/cart/page.tsx`
- [Checkout API](https://github.com/vizzaq23/tcg/blob/main/app/api/shop/checkout/route.ts): `app/api/shop/checkout/route.ts`
- [Order Lifecycle](https://github.com/vizzaq23/tcg/blob/main/lib/shop/checkout.ts): `lib/shop/checkout.ts`
- [Payment Webhook](https://github.com/vizzaq23/tcg/blob/main/app/api/shop/webhook/route.ts): `app/api/shop/webhook/route.ts`

### Platform Services

- [Price Sync](https://github.com/vizzaq23/tcg/blob/main/app/api/admin/prices/refresh/route.ts): `app/api/admin/prices/refresh/route.ts`
- [Price Repository](https://github.com/vizzaq23/tcg/blob/main/lib/prices/repository.ts): `lib/prices/repository.ts`

### Other components

- **Collector**
- **JustTCG**
- **Supabase**
- **Stripe**
- **Supabase Auth**

## Connections

- Collector → Browse Catalog: browses (evidence: `README.md`)
- Browse Catalog → Catalog Search: searches via
- Collector → Collection Dashboard: tracks cards (evidence: `README.md`)
- Collection Dashboard → Supabase: reads collection (evidence: `app/collection/page.tsx`)
- Collector → Portfolio: views value (evidence: `README.md`)
- Collector → Public Shelf: shares shelf (evidence: `README.md`)
- Public Shelf → Collector Showcase: shows showcase (evidence: `app/u/[username]/page.tsx`)
- Collector → Trade Offers: offers trades (evidence: `README.md`)
- Collector → Social and Follows: follows collectors (evidence: `README.md`)
- Collector → Creator Studio: creates content (evidence: `README.md`)
- Collector → Journey Explorer: explores journey
- Collector → Shop Storefront: shops listings (evidence: `README.md`)
- Shop Storefront → Cookie Cart: adds to cart (evidence: `app/shop/page.tsx`)
- Cookie Cart → Checkout API: starts checkout (evidence: `app/cart/page.tsx`)
- Checkout API → Order Lifecycle: reserves order (evidence: `app/api/shop/checkout/route.ts`)
- Checkout API → Supabase: stores order (evidence: `app/api/shop/checkout/route.ts`)
- Checkout API → Stripe: creates session (evidence: `app/api/shop/checkout/route.ts`)
- Stripe → Payment Webhook: sends events (evidence: `README.md`)
- Payment Webhook → Order Lifecycle: finalizes payment (evidence: `app/api/shop/webhook/route.ts`)
- Payment Webhook → Supabase: updates order (evidence: `app/api/shop/webhook/route.ts`)
- Price Sync → Price Repository: syncs prices
- Price Repository → JustTCG: matches provider data (evidence: `lib/prices/repository.ts`)
- Price Repository → Supabase: caches prices (evidence: `README.md`)
- Collector → Supabase Auth: signs in (evidence: `README.md`)
- Supabase Auth → Supabase: authenticates with (evidence: `README.md`)
