# sarveshbhoyar22/altstore architecture

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

- Interactive diagram: https://gitdiagram.com/sarveshbhoyar22/altstore
- Repository: https://github.com/sarveshbhoyar22/altstore

## Overview

This is a React storefront with customer accounts, product discovery, cart and wishlist management, checkout, order tracking, referrals, support, and an admin area. The principal flow is browsing products, adding items to a cart, submitting an order, and viewing order details; account and address management support that flow. The README only describes the Vite template, so product capabilities and connections are based on the source index and excerpts. Unsampled pages and integrations are represented where their paths are known, without inferring their internal behavior.

Main entry points: [`src/App.tsx`](https://github.com/sarveshbhoyar22/altstore/blob/main/src/App.tsx) (Application Router), [`src/firebase/firestore.ts`](https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/firestore.ts) (Firestore Access), [`src/pages/Cart.tsx`](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Cart.tsx) (Cart and Checkout), [`src/pages/ProductDetail.tsx`](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/ProductDetail.tsx) (Product Detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Application Router<br/>[App.tsx]"]
  node_landing["Home<br/>[LandingPage.tsx]"]
  node_catalog["Product Catalog<br/>[Products.tsx]"]
  node_product["Product Detail<br/>[ProductDetail.tsx]"]
  node_search["Product Search<br/>[Search.tsx]"]
  node_productdata["Sample Products<br/>[SampleProducts.tsx]"]
  node_productcard["Product Card<br/>[ProductCard.tsx]"]
end

subgraph group_identity["Customer Accounts"]
  node_auth["Authentication State<br/>[AuthContext.tsx]"]
  node_login["Login Modal<br/>[LoginModal.tsx]"]
  node_profile["Profile and Addresses<br/>[useUserProfile.ts]"]
  node_addressui["Address Form<br/>[AddressForm.tsx]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Cart State<br/>[CartContext.tsx]"]
  node_cartpage["Cart and Checkout<br/>[Cart.tsx]"]
  node_payment["Payment Hook<br/>[useRazorpay.ts]"]
  node_orders["Order Operations<br/>[useOrders.ts]"]
  node_orderspage["Order History<br/>[MyOrders.tsx]"]
  node_orderdetail["Order Details<br/>[OrderDetail.tsx]"]
  node_wishlist["Wishlist State"]
  node_wishlistpage["Wishlist Page<br/>[Wishlist.tsx]"]
end

subgraph group_admin["Admin and Support"]
  node_adminpage["Admin Console<br/>[Admin.tsx]"]
  node_support["Customer Support<br/>[Support.tsx]"]
  node_rewards["Rewards and Referrals"]
end

subgraph group_services["Platform Services"]
  node_firestore["Firestore Access<br/>[firestore.ts]"]
  node_firebase["Firebase<br/>[config.ts]"]
  node_authservice["Firebase Auth<br/>[auth.ts]"]
  node_email["Email Service<br/>[emailService.ts]"]
  node_cloudinary["Image Hosting<br/>[cloudinary.ts]"]
  node_razorpay["Razorpay Utility<br/>[razorpay.ts]"]
end

node_shopper(("Shopper"))

node_shopper -->|"browses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_product
node_app -->|"routes to"| node_cartpage
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_orderspage
node_app -->|"routes to"| node_orderdetail
node_app -->|"routes to"| node_wishlistpage
node_app -->|"routes to"| node_adminpage
node_app -->|"routes to"| node_support
node_app -->|"routes to"| node_rewards
node_app -->|"provides state"| node_auth
node_app -->|"provides state"| node_cart
node_app -->|"provides state"| node_wishlist
node_search -->|"loads products"| node_firestore
node_search -->|"uses fallback"| node_productdata
node_search -->|"renders results"| node_productcard
node_product -->|"uses products"| node_productdata
node_product -->|"updates cart"| node_cart
node_product -->|"updates wishlist"| node_wishlist
node_product -->|"renders products"| node_productcard
node_productcard -->|"adds items"| node_cart
node_login -->|"signs in"| node_auth
node_auth -->|"calls auth"| node_authservice
node_auth -->|"creates user"| node_firestore
node_authservice -->|"uses config"| node_firebase
node_cart -->|"syncs cart"| node_firestore
node_wishlist -->|"syncs wishlist"| node_firestore
node_cartpage -->|"uses cart"| node_cart
node_cartpage -->|"starts payment"| node_payment
node_cartpage -->|"creates order"| node_orders
node_cartpage -->|"loads profile"| node_profile
node_cartpage -->|"prompts sign-in"| node_login
node_cartpage -->|"opens address"| node_addressui
node_payment -->|"uses utility"| node_razorpay
node_orders -->|"writes and reads"| node_firestore
node_orders -->|"sends confirmation"| node_email
node_profile -->|"reads and writes"| node_firestore
node_orderspage -.->|"uses orders"| node_orders
node_orderdetail -->|"loads order"| node_orders
node_orderdetail -->|"prompts sign-in"| node_login
node_wishlistpage -.->|"uses wishlist"| node_wishlist
node_adminpage -->|"manages records"| node_firestore
node_adminpage -->|"uses image hosting"| node_cloudinary
node_adminpage -->|"checks identity"| node_auth
node_support -.->|"uses support data"| node_firestore
node_rewards -.->|"uses referral data"| node_firestore

click node_app "https://github.com/sarveshbhoyar22/altstore/blob/main/src/App.tsx"
click node_landing "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/LandingPage.tsx"
click node_catalog "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Products.tsx"
click node_product "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/ProductDetail.tsx"
click node_search "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Search.tsx"
click node_productdata "https://github.com/sarveshbhoyar22/altstore/blob/main/src/Data/SampleProducts.tsx"
click node_productcard "https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Product/ProductCard.tsx"
click node_auth "https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/AuthContext.tsx"
click node_login "https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Auth/LoginModal.tsx"
click node_profile "https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useUserProfile.ts"
click node_addressui "https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Address/AddressForm.tsx"
click node_cart "https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/CartContext.tsx"
click node_cartpage "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Cart.tsx"
click node_payment "https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useRazorpay.ts"
click node_orders "https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useOrders.ts"
click node_orderspage "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/MyOrders.tsx"
click node_orderdetail "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/OrderDetail.tsx"
click node_wishlist "https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/WishlistContext.tsx"
click node_wishlistpage "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Wishlist.tsx"
click node_adminpage "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Admin.tsx"
click node_support "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Support.tsx"
click node_rewards "https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/RewardsAndReferral.tsx"
click node_firestore "https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/firestore.ts"
click node_firebase "https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/config.ts"
click node_authservice "https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/auth.ts"
click node_email "https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/emailService.ts"
click node_cloudinary "https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/cloudinary.ts"
click node_razorpay "https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/razorpay.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_landing,node_catalog,node_product,node_search,node_productdata,node_productcard toneBlue
class node_auth,node_login,node_profile,node_addressui toneAmber
class node_cart,node_cartpage,node_payment,node_orders,node_orderspage,node_orderdetail,node_wishlist,node_wishlistpage toneMint
class node_adminpage,node_support,node_rewards toneRose
class node_firestore,node_firebase,node_authservice,node_email,node_cloudinary,node_razorpay,node_shopper toneIndigo
```

## Components

### Storefront

- [Application Router](https://github.com/sarveshbhoyar22/altstore/blob/main/src/App.tsx): `src/App.tsx`
- [Home](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/LandingPage.tsx): `src/pages/LandingPage.tsx`
- [Product Catalog](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Products.tsx): `src/pages/Products.tsx`
- [Product Detail](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/ProductDetail.tsx): `src/pages/ProductDetail.tsx`
- [Product Search](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Search.tsx): `src/pages/Search.tsx`
- [Sample Products](https://github.com/sarveshbhoyar22/altstore/blob/main/src/Data/SampleProducts.tsx): `src/Data/SampleProducts.tsx`
- [Product Card](https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Product/ProductCard.tsx): `src/components/Product/ProductCard.tsx`

### Customer Accounts

- [Authentication State](https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Login Modal](https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Auth/LoginModal.tsx): `src/components/Auth/LoginModal.tsx`
- [Profile and Addresses](https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useUserProfile.ts): `src/hooks/useUserProfile.ts`
- [Address Form](https://github.com/sarveshbhoyar22/altstore/blob/main/src/components/Address/AddressForm.tsx): `src/components/Address/AddressForm.tsx`

### Commerce

- [Cart State](https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`
- [Cart and Checkout](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Cart.tsx): `src/pages/Cart.tsx`
- [Payment Hook](https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useRazorpay.ts): `src/hooks/useRazorpay.ts`
- [Order Operations](https://github.com/sarveshbhoyar22/altstore/blob/main/src/hooks/useOrders.ts): `src/hooks/useOrders.ts`
- [Order History](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/MyOrders.tsx): `src/pages/MyOrders.tsx`
- [Order Details](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/OrderDetail.tsx): `src/pages/OrderDetail.tsx`
- [Wishlist State](https://github.com/sarveshbhoyar22/altstore/blob/main/src/context/WishlistContext.tsx): `src/context/WishlistContext.tsx`
- [Wishlist Page](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Wishlist.tsx): `src/pages/Wishlist.tsx`

### Admin and Support

- [Admin Console](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Admin.tsx): `src/pages/Admin.tsx`
- [Customer Support](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/Support.tsx): `src/pages/Support.tsx`
- [Rewards and Referrals](https://github.com/sarveshbhoyar22/altstore/blob/main/src/pages/RewardsAndReferral.tsx): `src/pages/RewardsAndReferral.tsx`

### Platform Services

- [Firestore Access](https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/firestore.ts): `src/firebase/firestore.ts`
- [Firebase](https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/config.ts): `src/firebase/config.ts`
- [Firebase Auth](https://github.com/sarveshbhoyar22/altstore/blob/main/src/firebase/auth.ts): `src/firebase/auth.ts`
- [Email Service](https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/emailService.ts): `src/utils/emailService.ts`
- [Image Hosting](https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/cloudinary.ts): `src/utils/cloudinary.ts`
- [Razorpay Utility](https://github.com/sarveshbhoyar22/altstore/blob/main/src/utils/razorpay.ts): utility · `src/utils/razorpay.ts`

### Other components

- **Shopper**

## Connections

- Shopper → Application Router: browses (evidence: `src/App.tsx`)
- Application Router → Home: routes to (evidence: `src/App.tsx`)
- Application Router → Product Catalog: routes to (evidence: `src/App.tsx`)
- Application Router → Product Detail: routes to (evidence: `src/App.tsx`)
- Application Router → Cart and Checkout: routes to (evidence: `src/App.tsx`)
- Application Router → Product Search: routes to (evidence: `src/App.tsx`)
- Application Router → Order History: routes to (evidence: `src/App.tsx`)
- Application Router → Order Details: routes to (evidence: `src/App.tsx`)
- Application Router → Wishlist Page: routes to (evidence: `src/App.tsx`)
- Application Router → Admin Console: routes to (evidence: `src/App.tsx`)
- Application Router → Customer Support: routes to (evidence: `src/App.tsx`)
- Application Router → Rewards and Referrals: routes to (evidence: `src/App.tsx`)
- Application Router → Authentication State: provides state (evidence: `src/App.tsx`)
- Application Router → Cart State: provides state (evidence: `src/App.tsx`)
- Application Router → Wishlist State: provides state (evidence: `src/App.tsx`)
- Product Search → Firestore Access: loads products (evidence: `src/pages/Search.tsx`)
- Product Search → Sample Products: uses fallback (evidence: `src/pages/Search.tsx`)
- Product Search → Product Card: renders results (evidence: `src/pages/Search.tsx`)
- Product Detail → Sample Products: uses products (evidence: `src/pages/ProductDetail.tsx`)
- Product Detail → Cart State: updates cart (evidence: `src/pages/ProductDetail.tsx`)
- Product Detail → Wishlist State: updates wishlist (evidence: `src/pages/ProductDetail.tsx`)
- Product Detail → Product Card: renders products (evidence: `src/pages/ProductDetail.tsx`)
- Product Card → Cart State: adds items (evidence: `src/components/Product/ProductCard.tsx`)
- Login Modal → Authentication State: signs in (evidence: `src/components/Auth/LoginModal.tsx`)
- Authentication State → Firebase Auth: calls auth (evidence: `src/context/AuthContext.tsx`)
- Authentication State → Firestore Access: creates user (evidence: `src/context/AuthContext.tsx`)
- Firebase Auth → Firebase: uses config (evidence: `src/firebase/auth.ts`)
- Cart State → Firestore Access: syncs cart (evidence: `src/context/CartContext.tsx`)
- Wishlist State → Firestore Access: syncs wishlist (evidence: `src/context/WishlistContext.tsx`)
- Cart and Checkout → Cart State: uses cart (evidence: `src/pages/Cart.tsx`)
- Cart and Checkout → Payment Hook: starts payment (evidence: `src/pages/Cart.tsx`)
- Cart and Checkout → Order Operations: creates order (evidence: `src/pages/Cart.tsx`)
- Cart and Checkout → Profile and Addresses: loads profile (evidence: `src/pages/Cart.tsx`)
- Cart and Checkout → Login Modal: prompts sign-in (evidence: `src/pages/Cart.tsx`)
- Cart and Checkout → Address Form: opens address (evidence: `src/pages/Cart.tsx`)
- Payment Hook → Razorpay Utility: uses utility (evidence: `src/hooks/useRazorpay.ts`)
- Order Operations → Firestore Access: writes and reads (evidence: `src/hooks/useOrders.ts`)
- Order Operations → Email Service: sends confirmation (evidence: `src/hooks/useOrders.ts`)
- Profile and Addresses → Firestore Access: reads and writes (evidence: `src/hooks/useUserProfile.ts`)
- Order History → Order Operations: uses orders
- Order Details → Order Operations: loads order (evidence: `src/pages/OrderDetail.tsx`)
- Order Details → Login Modal: prompts sign-in (evidence: `src/pages/OrderDetail.tsx`)
- Wishlist Page → Wishlist State: uses wishlist
- Admin Console → Firestore Access: manages records (evidence: `src/pages/Admin.tsx`)
- Admin Console → Image Hosting: uses image hosting (evidence: `src/pages/Admin.tsx`)
- Admin Console → Authentication State: checks identity (evidence: `src/pages/Admin.tsx`)
- Customer Support → Firestore Access: uses support data
- Rewards and Referrals → Firestore Access: uses referral data
