# pavitr-sharma/pingme1 architecture

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

- Interactive diagram: https://gitdiagram.com/pavitr-sharma/pingme1
- Repository: https://github.com/pavitr-sharma/pingme1

## Overview

This repository implements a React storefront and NFC-profile product, with Firebase-backed accounts and orders plus Firebase Functions for payment verification and order notifications. The main customer flow is browse products, personalize an NFC profile when relevant, place an order, pay through Razorpay, and view or manage account/order information; public NFC pages and administration are distinct capabilities. Edges reflect shown calls, routes, or README-described behavior. Several page and service implementations were not excerpted, so their internal connections are omitted.

Main entry points: [`src/App.tsx`](https://github.com/pavitr-sharma/pingme1/blob/main/src/App.tsx) (App router), [`src/pages/Prebook.tsx`](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Prebook.tsx) (Prebooking checkout), [`src/lib/prebookService.ts`](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/prebookService.ts) (Order service), [`src/lib/paymentService.ts`](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/paymentService.ts) (Payment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App router<br/>[App.tsx]"]
  node_catalog["Product catalog<br/>[productCatalog.ts]"]
  node_product_pages["Product browsing<br/>[Products.tsx]"]
  node_product_detail["Product details<br/>[ProductDetail.tsx]"]
  node_review["Product reviews<br/>[AddReview.tsx]"]
  node_layout["Storefront layout<br/>[MainLayout.tsx]"]
  node_about["About content<br/>[About.tsx]"]
  node_docs["Product documentation<br/>[DocsPage.tsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_auth_context["Authentication state<br/>[AuthContext.tsx]"]
  node_phone_auth["Phone sign-in<br/>[PhoneAuthForm.tsx]"]
  node_auth_service["Auth service<br/>[authService.ts]"]
  node_firebase["Firebase client<br/>[firebase.ts]"]
  node_profile["Account profile<br/>[Profile.tsx]"]
end

subgraph group_orders["Orders and payments"]
  node_cart["Shopping cart<br/>[CartContext.tsx]"]
  node_booking["Prebooking checkout<br/>[Prebook.tsx]"]
  node_orders_service["Order service<br/>[prebookService.ts]"]
  node_payments["Payment service<br/>[paymentService.ts]"]
  node_functions["Payment functions<br/>[index.js]"]
  node_firestore[("Firestore")]
  node_invoice["Invoice utilities<br/>[invoiceUtils.ts]"]
  node_invoice_backend["Invoice email utilities<br/>[invoiceEmail.js]"]
  node_razorpay["Razorpay Checkout"]
  node_notifications["Email and messaging"]
end

subgraph group_nfc["NFC profiles"]
  node_nfc_builder["NFC profile builder"]
  node_nfc_checkout["NFC checkout helper<br/>[nfcCheckout.ts]"]
  node_public_profile["Public NFC profile"]
  node_public_nfc["Public profile service"]
end

subgraph group_operations["Administration"]
  node_admin["Admin console<br/>[Admin.tsx]"]
  node_admin_service["Admin service<br/>[adminService.ts]"]
  node_cloud_functions["Order status trigger<br/>[index.js]"]
end

node_customer(("Customer"))
node_visitor(("Profile visitor"))

node_customer -->|"opens"| node_app
node_app -->|"routes to"| node_booking
node_app -->|"routes to"| node_public_profile
node_customer -.->|"browses"| node_product_pages
node_product_pages -.->|"uses catalog"| node_catalog
node_product_detail -.->|"uses catalog"| node_catalog
node_review -->|"normalizes category"| node_catalog
node_review -->|"saves review"| node_product_pages
node_app -->|"provides state"| node_auth_context
node_app -->|"provides state"| node_cart
node_phone_auth -->|"uses auth"| node_auth_context
node_auth_context -->|"requests OTP"| node_auth_service
node_auth_service -->|"uses phone auth"| node_firebase
node_auth_context -.->|"loads profile"| node_firebase
node_customer -.->|"checks out"| node_booking
node_booking -->|"collects profile"| node_nfc_builder
node_booking -->|"starts payment"| node_payments
node_booking -->|"uses NFC checkout"| node_nfc_checkout
node_cart -->|"uses order types"| node_orders_service
node_orders_service -->|"reads and writes"| node_firestore
node_orders_service -->|"resolves images"| node_catalog
node_payments -.->|"calls backend"| node_functions
node_functions -->|"creates and verifies"| node_razorpay
node_razorpay -->|"collects payment"| node_customer
node_functions -->|"writes payments"| node_firestore
node_payments -->|"uses order service"| node_orders_service
node_payments -->|"uses invoice helpers"| node_invoice
node_functions -->|"uses invoice email"| node_invoice_backend
node_cloud_functions -->|"sends confirmation"| node_notifications
node_cloud_functions -->|"observes status change"| node_firestore
node_nfc_builder -.->|"syncs profile"| node_orders_service
node_booking -->|"syncs NFC draft"| node_public_nfc
node_public_profile -.->|"loads profile"| node_public_nfc
node_visitor -.->|"views profile"| node_public_profile
node_admin -->|"uses admin service"| node_admin_service
node_admin -->|"uses invoice helpers"| node_invoice
node_admin -.->|"updates order status"| node_firestore
node_layout -.->|"wraps pages"| node_app

click node_app "https://github.com/pavitr-sharma/pingme1/blob/main/src/App.tsx"
click node_catalog "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/productCatalog.ts"
click node_product_pages "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Products.tsx"
click node_product_detail "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/ProductDetail.tsx"
click node_review "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/AddReview.tsx"
click node_layout "https://github.com/pavitr-sharma/pingme1/blob/main/src/layouts/MainLayout.tsx"
click node_about "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/About.tsx"
click node_docs "https://github.com/pavitr-sharma/pingme1/blob/main/src/components/DocsPage.tsx"
click node_auth_context "https://github.com/pavitr-sharma/pingme1/blob/main/src/contexts/AuthContext.tsx"
click node_phone_auth "https://github.com/pavitr-sharma/pingme1/blob/main/src/components/auth/PhoneAuthForm.tsx"
click node_auth_service "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/authService.ts"
click node_firebase "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/firebase.ts"
click node_profile "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Profile.tsx"
click node_cart "https://github.com/pavitr-sharma/pingme1/blob/main/src/contexts/CartContext.tsx"
click node_booking "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Prebook.tsx"
click node_orders_service "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/prebookService.ts"
click node_payments "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/paymentService.ts"
click node_functions "https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/index.js"
click node_invoice "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/invoiceUtils.ts"
click node_invoice_backend "https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/invoiceEmail.js"
click node_nfc_builder "https://github.com/pavitr-sharma/pingme1/blob/main/src/components/NFCProfileBuilder.tsx"
click node_nfc_checkout "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/nfcCheckout.ts"
click node_public_profile "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/PublicNFCProfile.tsx"
click node_public_nfc "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/publicNfcService.ts"
click node_admin "https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Admin.tsx"
click node_admin_service "https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/adminService.ts"
click node_cloud_functions "https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/index.js"

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_product_pages,node_product_detail,node_review,node_layout,node_about,node_docs toneBlue
class node_auth_context,node_phone_auth,node_auth_service,node_firebase,node_profile toneAmber
class node_cart,node_booking,node_orders_service,node_payments,node_functions,node_firestore,node_invoice,node_invoice_backend,node_razorpay,node_notifications toneMint
class node_nfc_builder,node_nfc_checkout,node_public_profile,node_public_nfc toneRose
class node_admin,node_admin_service,node_cloud_functions,node_customer,node_visitor toneIndigo
```

## Components

### Storefront

- [App router](https://github.com/pavitr-sharma/pingme1/blob/main/src/App.tsx): `src/App.tsx`
- [Product catalog](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/productCatalog.ts): `src/lib/productCatalog.ts`
- [Product browsing](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Products.tsx): `src/pages/Products.tsx`
- [Product details](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/ProductDetail.tsx): `src/pages/ProductDetail.tsx`
- [Product reviews](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/AddReview.tsx): `src/pages/AddReview.tsx`
- [Storefront layout](https://github.com/pavitr-sharma/pingme1/blob/main/src/layouts/MainLayout.tsx): `src/layouts/MainLayout.tsx`
- [About content](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/About.tsx): `src/pages/About.tsx`
- [Product documentation](https://github.com/pavitr-sharma/pingme1/blob/main/src/components/DocsPage.tsx): `src/components/DocsPage.tsx`

### Identity and profiles

- [Authentication state](https://github.com/pavitr-sharma/pingme1/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Phone sign-in](https://github.com/pavitr-sharma/pingme1/blob/main/src/components/auth/PhoneAuthForm.tsx): `src/components/auth/PhoneAuthForm.tsx`
- [Auth service](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/authService.ts): `src/lib/authService.ts`
- [Firebase client](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Account profile](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Profile.tsx): `src/pages/Profile.tsx`

### Orders and payments

- [Shopping cart](https://github.com/pavitr-sharma/pingme1/blob/main/src/contexts/CartContext.tsx): `src/contexts/CartContext.tsx`
- [Prebooking checkout](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Prebook.tsx): `src/pages/Prebook.tsx`
- [Order service](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/prebookService.ts): `src/lib/prebookService.ts`
- [Payment service](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/paymentService.ts): `src/lib/paymentService.ts`
- [Payment functions](https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/index.js): `functions/src/index.js`
- **Firestore**
- [Invoice utilities](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/invoiceUtils.ts): `src/lib/invoiceUtils.ts`
- [Invoice email utilities](https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/invoiceEmail.js): `functions/src/invoiceEmail.js`
- **Razorpay Checkout**
- **Email and messaging**

### NFC profiles

- [NFC profile builder](https://github.com/pavitr-sharma/pingme1/blob/main/src/components/NFCProfileBuilder.tsx): `src/components/NFCProfileBuilder.tsx`
- [NFC checkout helper](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/nfcCheckout.ts): `src/lib/nfcCheckout.ts`
- [Public NFC profile](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/PublicNFCProfile.tsx): `src/pages/PublicNFCProfile.tsx`
- [Public profile service](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/publicNfcService.ts): `src/lib/publicNfcService.ts`

### Administration

- [Admin console](https://github.com/pavitr-sharma/pingme1/blob/main/src/pages/Admin.tsx): `src/pages/Admin.tsx`
- [Admin service](https://github.com/pavitr-sharma/pingme1/blob/main/src/lib/adminService.ts): `src/lib/adminService.ts`
- [Order status trigger](https://github.com/pavitr-sharma/pingme1/blob/main/functions/src/index.js): `functions/src/index.js`

### Other components

- **Customer**
- **Profile visitor**

## Connections

- Customer → App router: opens (evidence: `src/App.tsx`)
- App router → Prebooking checkout: routes to (evidence: `src/App.tsx`)
- App router → Public NFC profile: routes to (evidence: `src/App.tsx`)
- Customer → Product browsing: browses
- Product browsing → Product catalog: uses catalog
- Product details → Product catalog: uses catalog
- Product reviews → Product catalog: normalizes category (evidence: `src/pages/AddReview.tsx`)
- Product reviews → Product browsing: saves review (evidence: `src/pages/AddReview.tsx`)
- App router → Authentication state: provides state (evidence: `src/App.tsx`)
- App router → Shopping cart: provides state (evidence: `src/App.tsx`)
- Phone sign-in → Authentication state: uses auth (evidence: `src/components/auth/PhoneAuthForm.tsx`)
- Authentication state → Auth service: requests OTP (evidence: `src/contexts/AuthContext.tsx`)
- Auth service → Firebase client: uses phone auth (evidence: `src/lib/authService.ts`)
- Authentication state → Firebase client: loads profile (evidence: `src/contexts/AuthContext.tsx`)
- Customer → Prebooking checkout: checks out
- Prebooking checkout → NFC profile builder: collects profile (evidence: `src/pages/Prebook.tsx`)
- Prebooking checkout → Payment service: starts payment (evidence: `src/pages/Prebook.tsx`)
- Prebooking checkout → NFC checkout helper: uses NFC checkout (evidence: `src/pages/Prebook.tsx`)
- Shopping cart → Order service: uses order types (evidence: `src/contexts/CartContext.tsx`)
- Order service → Firestore: reads and writes (evidence: `src/lib/prebookService.ts`)
- Order service → Product catalog: resolves images (evidence: `src/lib/prebookService.ts`)
- Payment service → Payment functions: calls backend
- Payment functions → Razorpay Checkout: creates and verifies
- Razorpay Checkout → Customer: collects payment
- Payment functions → Firestore: writes payments
- Payment service → Order service: uses order service (evidence: `src/lib/paymentService.ts`)
- Payment service → Invoice utilities: uses invoice helpers (evidence: `src/lib/paymentService.ts`)
- Payment functions → Invoice email utilities: uses invoice email (evidence: `functions/src/index.js`)
- Order status trigger → Email and messaging: sends confirmation
- Order status trigger → Firestore: observes status change
- NFC profile builder → Order service: syncs profile
- Prebooking checkout → Public profile service: syncs NFC draft (evidence: `src/pages/Prebook.tsx`)
- Public NFC profile → Public profile service: loads profile
- Profile visitor → Public NFC profile: views profile
- Admin console → Admin service: uses admin service (evidence: `src/pages/Admin.tsx`)
- Admin console → Invoice utilities: uses invoice helpers (evidence: `src/pages/Admin.tsx`)
- Admin console → Firestore: updates order status
- Storefront layout → App router: wraps pages
