# kranthi08-dot/offline-first-e-commerce-pwa architecture

> Architecture diagram of the GitHub repository kranthi08-dot/offline-first-e-commerce-pwa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kranthi08-dot/offline-first-e-commerce-pwa
- Repository: https://github.com/kranthi08-dot/offline-first-e-commerce-pwa

## Overview

This is a React storefront prototype demonstrating an offline-capable shopping flow: browse a cached mock catalog, inspect products, manage a cart, and simulate checkout. Offline mutations can be queued and replayed in a sync panel; a separate demo presents conflict-resolution strategies. The app also exposes viewport simulation and guided-review UI. Persistence is browser localStorage, and synchronization and conflict resolution are simulations rather than a connected backend. Edges reflect excerpted imports/calls or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/App.tsx) (App Coordinator), [`src/utils/currency.ts`](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/utils/currency.ts) (Currency Formatting), [`src/components/ConflictDemoModal.tsx`](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ConflictDemoModal.tsx) (Conflict Demo), [`src/services/storageService.ts`](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/storageService.ts) (Browser Persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App Coordinator<br/>[App.tsx]"]
  node_catalog["Mock Catalog<br/>[mockProducts.ts]"]
  node_productgrid["Product Grid<br/>[ProductGrid.tsx]"]
  node_productcard["Product Card<br/>[ProductCard.tsx]"]
  node_productdetails["Product Details"]
  node_header["Store Header<br/>[Header.tsx]"]
  node_hero["Adaptive Hero"]
  node_footer["Store Footer<br/>[Footer.tsx]"]
end

subgraph group_shopping["Shopping"]
  node_cart["Cart Drawer<br/>[CartDrawer.tsx]"]
  node_checkout["Checkout Modal<br/>[CheckoutModal.tsx]"]
  node_currency["Currency Formatting<br/>[currency.ts]"]
end

subgraph group_offline["Offline State"]
  node_syncpanel["Sync Queue Panel<br/>[SyncQueuePanel.tsx]"]
  node_syncservice["Queue and Replay"]
  node_storage[("Browser Persistence<br/>[storageService.ts]")]
  node_conflictdemo["Conflict Demo"]
  node_conflictservice["Conflict Policies<br/>[conflictService.ts]"]
end

subgraph group_experience["Demo Experience"]
  node_device["Device Simulator"]
  node_guide["Review Guide"]
  node_badge["Project Badge"]
  node_pwa["PWA Placeholder"]
  node_types["Domain Types<br/>[index.ts]"]
end

node_shopper(("Shopper"))
node_browserstore[("Browser localStorage")]

node_shopper -->|"uses storefront"| node_app
node_app -->|"loads products"| node_catalog
node_app -->|"renders catalog"| node_productgrid
node_productgrid -->|"renders items"| node_productcard
node_app -->|"opens details"| node_productdetails
node_app -->|"renders header"| node_header
node_app -->|"renders hero"| node_hero
node_app -->|"renders footer"| node_footer
node_app -->|"renders cart"| node_cart
node_app -->|"opens checkout"| node_checkout
node_app -->|"opens sync panel"| node_syncpanel
node_app -->|"queues mutations"| node_syncservice
node_syncservice -->|"reads and writes"| node_storage
node_app -->|"persists cart state"| node_storage
node_storage -->|"reads and writes"| node_browserstore
node_app -->|"opens conflict demo"| node_conflictdemo
node_conflictdemo -->|"resolves scenario"| node_conflictservice
node_app -->|"renders simulator"| node_device
node_app -->|"opens guide"| node_guide
node_app -->|"renders badge"| node_badge
node_productcard -->|"formats prices"| node_currency
node_productdetails -->|"formats prices"| node_currency
node_cart -->|"formats totals"| node_currency
node_checkout -->|"formats totals"| node_currency
node_conflictdemo -->|"formats prices"| node_currency

click node_app "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/App.tsx"
click node_catalog "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/data/mockProducts.ts"
click node_productgrid "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductGrid.tsx"
click node_productcard "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductCard.tsx"
click node_productdetails "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductDetailsModal.tsx"
click node_header "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/Header.tsx"
click node_hero "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/AdaptiveHeroSection.tsx"
click node_footer "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/Footer.tsx"
click node_cart "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/CartDrawer.tsx"
click node_checkout "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/CheckoutModal.tsx"
click node_currency "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/utils/currency.ts"
click node_syncpanel "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/SyncQueuePanel.tsx"
click node_syncservice "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/syncQueueService.ts"
click node_storage "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/storageService.ts"
click node_conflictdemo "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ConflictDemoModal.tsx"
click node_conflictservice "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/conflictService.ts"
click node_device "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/DeviceSimulatorToolbar.tsx"
click node_guide "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProjectReviewGuideModal.tsx"
click node_badge "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProjectBadgeBanner.tsx"
click node_pwa "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/pwaPlaceholderService.ts"
click node_types "https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/types/index.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_app,node_catalog,node_productgrid,node_productcard,node_productdetails,node_header,node_hero,node_footer toneBlue
class node_cart,node_checkout,node_currency,node_browserstore toneAmber
class node_syncpanel,node_syncservice,node_storage,node_conflictdemo,node_conflictservice toneMint
class node_device,node_guide,node_badge,node_pwa,node_types toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [App Coordinator](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/App.tsx): `src/App.tsx`
- [Mock Catalog](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/data/mockProducts.ts): `src/data/mockProducts.ts`
- [Product Grid](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductGrid.tsx): `src/components/ProductGrid.tsx`
- [Product Card](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductCard.tsx): `src/components/ProductCard.tsx`
- [Product Details](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProductDetailsModal.tsx): `src/components/ProductDetailsModal.tsx`
- [Store Header](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/Header.tsx): `src/components/Header.tsx`
- [Adaptive Hero](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/AdaptiveHeroSection.tsx): `src/components/AdaptiveHeroSection.tsx`
- [Store Footer](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/Footer.tsx): `src/components/Footer.tsx`

### Shopping

- [Cart Drawer](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/CartDrawer.tsx): `src/components/CartDrawer.tsx`
- [Checkout Modal](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/CheckoutModal.tsx): `src/components/CheckoutModal.tsx`
- [Currency Formatting](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/utils/currency.ts): `src/utils/currency.ts`

### Offline State

- [Sync Queue Panel](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/SyncQueuePanel.tsx): `src/components/SyncQueuePanel.tsx`
- [Queue and Replay](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/syncQueueService.ts): `src/services/syncQueueService.ts`
- [Browser Persistence](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/storageService.ts): `src/services/storageService.ts`
- [Conflict Demo](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ConflictDemoModal.tsx): `src/components/ConflictDemoModal.tsx`
- [Conflict Policies](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/conflictService.ts): `src/services/conflictService.ts`

### Demo Experience

- [Device Simulator](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/DeviceSimulatorToolbar.tsx): `src/components/DeviceSimulatorToolbar.tsx`
- [Review Guide](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProjectReviewGuideModal.tsx): `src/components/ProjectReviewGuideModal.tsx`
- [Project Badge](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/components/ProjectBadgeBanner.tsx): `src/components/ProjectBadgeBanner.tsx`
- [PWA Placeholder](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/services/pwaPlaceholderService.ts): `src/services/pwaPlaceholderService.ts`
- [Domain Types](https://github.com/kranthi08-dot/offline-first-e-commerce-pwa/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **Shopper**
- **Browser localStorage**

## Connections

- Shopper → App Coordinator: uses storefront
- App Coordinator → Mock Catalog: loads products (evidence: `src/App.tsx`)
- App Coordinator → Product Grid: renders catalog (evidence: `src/App.tsx`)
- Product Grid → Product Card: renders items (evidence: `src/components/ProductGrid.tsx`)
- App Coordinator → Product Details: opens details (evidence: `src/App.tsx`)
- App Coordinator → Store Header: renders header (evidence: `src/App.tsx`)
- App Coordinator → Adaptive Hero: renders hero (evidence: `src/App.tsx`)
- App Coordinator → Store Footer: renders footer (evidence: `src/App.tsx`)
- App Coordinator → Cart Drawer: renders cart (evidence: `src/App.tsx`)
- App Coordinator → Checkout Modal: opens checkout (evidence: `src/App.tsx`)
- App Coordinator → Sync Queue Panel: opens sync panel (evidence: `src/App.tsx`)
- App Coordinator → Queue and Replay: queues mutations (evidence: `src/App.tsx`)
- Queue and Replay → Browser Persistence: reads and writes (evidence: `src/services/syncQueueService.ts`)
- App Coordinator → Browser Persistence: persists cart state (evidence: `src/App.tsx`)
- Browser Persistence → Browser localStorage: reads and writes (evidence: `src/services/storageService.ts`)
- App Coordinator → Conflict Demo: opens conflict demo (evidence: `src/App.tsx`)
- Conflict Demo → Conflict Policies: resolves scenario (evidence: `src/components/ConflictDemoModal.tsx`)
- App Coordinator → Device Simulator: renders simulator (evidence: `src/App.tsx`)
- App Coordinator → Review Guide: opens guide (evidence: `src/App.tsx`)
- App Coordinator → Project Badge: renders badge (evidence: `src/App.tsx`)
- Product Card → Currency Formatting: formats prices (evidence: `src/components/ProductCard.tsx`)
- Product Details → Currency Formatting: formats prices (evidence: `src/components/ProductDetailsModal.tsx`)
- Cart Drawer → Currency Formatting: formats totals (evidence: `src/components/CartDrawer.tsx`)
- Checkout Modal → Currency Formatting: formats totals (evidence: `src/components/CheckoutModal.tsx`)
- Conflict Demo → Currency Formatting: formats prices (evidence: `src/components/ConflictDemoModal.tsx`)
