# arpan7777-dot/my-shopping-site architecture

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

- Interactive diagram: https://gitdiagram.com/arpan7777-dot/my-shopping-site
- Repository: https://github.com/arpan7777-dot/my-shopping-site

## Overview

This is an Astro client-site application with a product catalog, wishlist and product-management APIs, Google sign-in, content-led marketing pages, and invoice/resume tools. Its principal data workflow is product browsing through the catalog API, which reads Turso and caches results; admin/import APIs mutate catalog data and invalidate that cache. Wishlist changes pass through the browser script and API, using Cloudflare KV with Turso-backed persistence. The README is generic Astro starter documentation, so site capabilities are inferred from the file tree and shown excerpts; unsampled page and component internals are not assumed.

Main entry points: [`src/lib/turso.ts`](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/lib/turso.ts) (Turso client), [`src/pages/api/products`](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/pages/api/products) (Product mutations), [`src/pages/api/wishlist.ts`](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/wishlist.ts) (Wishlist API), [`src/pages/api/products.ts`](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/products.ts) (Product catalog API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Site experience"]
  node_home["Home page<br/>[index.astro]"]
  node_site_components["Site components"]
  node_content["Site content"]
  node_layouts["Page layouts"]
end

subgraph group_catalog["Catalog and admin"]
  node_product_search["Product search"]
  node_product_cards["Product cards<br/>[ProductCard.astro]"]
  node_product_api["Product catalog API<br/>[products.ts]"]
  node_product_mutations["Product mutations"]
  node_csv_import["CSV product import"]
  node_tag_parser["Product tag parser<br/>[tagParser.ts]"]
  node_admin["Admin page<br/>[admin.astro]"]
  node_turso_client["Turso client<br/>[turso.ts]"]
  node_turso[("Turso database")]
  node_product_cache["Product cache<br/>[products.ts]"]
end

subgraph group_identity["Identity and wishlist"]
  node_login["Login page<br/>[login.astro]"]
  node_google_auth["Google sign-in"]
  node_wishlist_script["Wishlist controls<br/>[toggleWishlist.ts]"]
  node_wishlist_api["Wishlist API<br/>[wishlist.ts]"]
  node_pending_store[("Pending wishlist store")]
  node_sync_users["Wishlist sync<br/>[syncUserData.ts]"]
  node_sparkles["Sparkle effects<br/>[sparkles.ts]"]
  node_dashboard["User dashboard"]
end

subgraph group_tools["User tools"]
  node_invoice_tool["Invoice builder"]
  node_resume_tool["Resume builder"]
end

node_visitor(("Site visitor"))
node_google(("Google identity"))

node_product_api -->|"queries through"| node_turso_client
node_turso_client -->|"connects to"| node_turso
node_product_api -->|"reads and updates"| node_product_cache
node_product_mutations -->|"writes through"| node_turso_client
node_product_mutations -->|"invalidates cache"| node_product_api
node_product_mutations -->|"parses IDs with"| node_tag_parser
node_csv_import -->|"imports into"| node_turso_client
node_csv_import -->|"clears cache"| node_product_cache
node_google_auth -->|"exchanges code with"| node_google
node_google_auth -->|"upserts user through"| node_turso_client
node_wishlist_script -->|"requests wishlist"| node_wishlist_api
node_wishlist_script -->|"creates effects with"| node_sparkles
node_wishlist_api -->|"reads and writes"| node_pending_store
node_wishlist_api -->|"loads fallback from"| node_turso_client
node_sync_users -->|"reads and deletes"| node_pending_store
node_sync_users -->|"updates users through"| node_turso_client

click node_home "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/index.astro"
click node_site_components "https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/components"
click node_content "https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/content"
click node_layouts "https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/layouts"
click node_product_search "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/components/ProductSearch.astro"
click node_product_cards "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/components/ProductCard.astro"
click node_product_api "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/products.ts"
click node_product_mutations "https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/pages/api/products"
click node_csv_import "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/import-drive-csv.ts"
click node_tag_parser "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/tagParser.ts"
click node_admin "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/admin.astro"
click node_turso_client "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/lib/turso.ts"
click node_product_cache "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/products.ts"
click node_login "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/login.astro"
click node_google_auth "https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/pages/api/auth"
click node_wishlist_script "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/toggleWishlist.ts"
click node_wishlist_api "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/wishlist.ts"
click node_sync_users "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/syncUserData.ts"
click node_sparkles "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/sparkles.ts"
click node_dashboard "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/user-dashboard.astro"
click node_invoice_tool "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/tools/invoice-builder.astro"
click node_resume_tool "https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/tools/resume-builder.astro"

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_home,node_site_components,node_content,node_layouts toneBlue
class node_product_search,node_product_cards,node_product_api,node_product_mutations,node_csv_import,node_tag_parser,node_admin,node_turso_client,node_turso,node_product_cache toneAmber
class node_login,node_google_auth,node_wishlist_script,node_wishlist_api,node_pending_store,node_sync_users,node_sparkles,node_dashboard toneMint
class node_invoice_tool,node_resume_tool toneRose
class node_visitor,node_google toneIndigo
```

## Components

### Site experience

- [Home page](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/index.astro): `src/pages/index.astro`
- [Site components](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/components): `src/components`
- [Site content](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/content): `src/content`
- [Page layouts](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/layouts): `src/layouts`

### Catalog and admin

- [Product search](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/components/ProductSearch.astro): `src/components/ProductSearch.astro`
- [Product cards](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/components/ProductCard.astro): `src/components/ProductCard.astro`
- [Product catalog API](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/products.ts): `src/pages/api/products.ts`
- [Product mutations](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/pages/api/products): `src/pages/api/products`
- [CSV product import](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/import-drive-csv.ts): `src/pages/api/import-drive-csv.ts`
- [Product tag parser](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/tagParser.ts): `src/scripts/tagParser.ts`
- [Admin page](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/admin.astro): `src/pages/admin.astro`
- [Turso client](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/lib/turso.ts): `src/lib/turso.ts`
- **Turso database**
- [Product cache](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/products.ts): `src/pages/api/products.ts`

### Identity and wishlist

- [Login page](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/login.astro): `src/pages/login.astro`
- [Google sign-in](https://github.com/arpan7777-dot/my-shopping-site/tree/cloudflare-worker/src/pages/api/auth): `src/pages/api/auth`
- [Wishlist controls](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/toggleWishlist.ts): `src/scripts/toggleWishlist.ts`
- [Wishlist API](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/wishlist.ts): `src/pages/api/wishlist.ts`
- **Pending wishlist store**
- [Wishlist sync](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/api/syncUserData.ts): `src/pages/api/syncUserData.ts`
- [Sparkle effects](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/scripts/sparkles.ts): `src/scripts/sparkles.ts`
- [User dashboard](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/user-dashboard.astro): `src/pages/user-dashboard.astro`

### User tools

- [Invoice builder](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/tools/invoice-builder.astro): `src/pages/tools/invoice-builder.astro`
- [Resume builder](https://github.com/arpan7777-dot/my-shopping-site/blob/cloudflare-worker/src/pages/tools/resume-builder.astro): `src/pages/tools/resume-builder.astro`

### Other components

- **Site visitor**
- **Google identity**

## Connections

- Product catalog API → Turso client: queries through (evidence: `src/pages/api/products.ts`)
- Turso client → Turso database: connects to (evidence: `src/lib/turso.ts`)
- Product catalog API → Product cache: reads and updates (evidence: `src/pages/api/products.ts`)
- Product mutations → Turso client: writes through (evidence: `src/pages/api/products/add-product.ts`)
- Product mutations → Product catalog API: invalidates cache (evidence: `src/pages/api/products/delete-product.ts`)
- Product mutations → Product tag parser: parses IDs with (evidence: `src/pages/api/products/delete-product.ts`)
- CSV product import → Turso client: imports into (evidence: `src/pages/api/import-drive-csv.ts`)
- CSV product import → Product cache: clears cache (evidence: `src/pages/api/import-drive-csv.ts`)
- Google sign-in → Google identity: exchanges code with (evidence: `src/pages/api/auth/callback/google.ts`)
- Google sign-in → Turso client: upserts user through (evidence: `src/pages/api/auth/callback/google.ts`)
- Wishlist controls → Wishlist API: requests wishlist (evidence: `src/scripts/toggleWishlist.ts`)
- Wishlist controls → Sparkle effects: creates effects with (evidence: `src/scripts/toggleWishlist.ts`)
- Wishlist API → Pending wishlist store: reads and writes (evidence: `src/pages/api/wishlist.ts`)
- Wishlist API → Turso client: loads fallback from (evidence: `src/pages/api/wishlist.ts`)
- Wishlist sync → Pending wishlist store: reads and deletes (evidence: `src/pages/api/syncUserData.ts`)
- Wishlist sync → Turso client: updates users through (evidence: `src/pages/api/syncUserData.ts`)
