# vishnuweb-a/firnvia architecture

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

- Interactive diagram: https://gitdiagram.com/vishnuweb-a/firnvia
- Repository: https://github.com/vishnuweb-a/firnvia

## Overview

Firvanra is a hosted-payment checkout demonstration: shoppers browse services and ebooks, build a cart, create an order, choose a gateway, complete hosted payment, and view order status. The backend derives and signs payment data, verifies provider callbacks before changing order state, and keeps orders in process memory rather than durable storage. The README documents AirPay, AirPay 2, SabPaisa, PayU, and HDFC; sampled code shows the main routing and several provider integrations. Some frontend page and gateway internals were not excerpted, so their connections are shown only where the README or source index supports them.

Main entry points: [`frontend/src/api.js`](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/api.js) (API Client), [`backend/server.js`](https://github.com/vishnuweb-a/firnvia/blob/main/backend/server.js) (Express API), [`backend/routes/payment.js`](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/payment.js) (Payment API), [`backend/routes/orders.js`](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/orders.js) (Orders API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_spa["React App<br/>[main.jsx]"]
  node_home["Storefront Home<br/>[Home.jsx]"]
  node_catalog["Product Catalog<br/>[products.js]"]
  node_cart["Cart State<br/>[CartContext.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_payment_ui["Payment Navigation<br/>[payment.js]"]
  node_api["API Client<br/>[api.js]"]
  node_status["Order Status<br/>[OrderStatus.jsx]"]
end

subgraph group_order["Order Management"]
  node_server["Express API<br/>[server.js]"]
  node_products_route["Products API<br/>[products.js]"]
  node_orders_route["Orders API<br/>[orders.js]"]
  node_order_store[("In-Memory Orders<br/>[orders.js]")]
end

subgraph group_payments["Payment Integrations"]
  node_payment_route["Payment API<br/>[payment.js]"]
  node_airpay["AirPay<br/>[airpay.js]"]
  node_airpay2_route["AirPay 2 Routes<br/>[airpay2.js]"]
  node_airpay2["AirPay 2 Service<br/>[airpay2.js]"]
  node_sabpaisa["SabPaisa Service<br/>[sabpaisa.js]"]
  node_payu["PayU Service<br/>[payu.js]"]
  node_hdfc_route["HDFC Routes<br/>[hdfc.js]"]
  node_hdfc["HDFC Service<br/>[hdfc.js]"]
  node_kkchat["KKChat Forwarder<br/>[kkchatForwarder.js]"]
  node_kkdiag["Forwarding Diagnostics"]
  node_kkadapter["Field Adapter"]
end

subgraph group_content["Contact And Policies"]
  node_contact["Contact API<br/>[contact.js]"]
  node_contact_ui["Contact Form<br/>[Contact.jsx]"]
  node_legal["Legal Pages"]
  node_legal_layout["Legal Layout<br/>[LegalLayout.jsx]"]
  node_company["Company Details<br/>[company.js]"]
end

node_browser(("Shopper Browser"))
node_gateway_services(("Payment Providers"))
node_kkchat_service(("KKChat Endpoint"))

node_browser -->|"uses"| node_spa
node_spa -->|"routes to"| node_home
node_spa -->|"routes to"| node_checkout
node_spa -->|"routes to"| node_status
node_home -->|"loads products"| node_catalog
node_home -->|"renders"| node_contact_ui
node_home -->|"requests contact"| node_api
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"creates order"| node_api
node_checkout -->|"handles response"| node_payment_ui
node_api -->|"calls API"| node_server
node_api -->|"requests products"| node_products_route
node_api -->|"creates and reads"| node_orders_route
node_api -->|"initiates payment"| node_payment_route
node_api -->|"submits contact"| node_contact
node_server -->|"mounts"| node_products_route
node_server -->|"mounts"| node_orders_route
node_server -->|"mounts"| node_payment_route
node_server -->|"mounts"| node_airpay2_route
node_server -->|"mounts"| node_hdfc_route
node_server -->|"mounts"| node_contact
node_products_route -->|"reads catalog"| node_catalog
node_orders_route -->|"validates items"| node_catalog
node_orders_route -->|"stores orders"| node_order_store
node_status -->|"fetches status"| node_api
node_orders_route -->|"refreshes pending"| node_hdfc
node_payment_route -->|"reads and updates"| node_order_store
node_payment_route -->|"initiates and verifies"| node_airpay
node_payment_route -->|"initiates and enquires"| node_sabpaisa
node_payment_route -->|"builds and verifies"| node_payu
node_payment_route -.->|"contacts gateways"| node_gateway_services
node_airpay2_route -->|"uses orders"| node_order_store
node_airpay2_route -->|"delegates to"| node_airpay2
node_airpay2_route -->|"forwards verified data"| node_kkchat
node_airpay2 -.->|"integrates with"| node_gateway_services
node_hdfc_route -->|"delegates to"| node_hdfc
node_hdfc_route -->|"uses orders"| node_order_store
node_hdfc -->|"creates sessions and checks"| node_gateway_services
node_kkchat -->|"uses diagnostics"| node_kkdiag
node_kkchat -->|"uses field adapter"| node_kkadapter
node_kkchat -.->|"forwards payload"| node_kkchat_service
node_contact_ui -->|"submits form"| node_api
node_legal -->|"uses layout"| node_legal_layout
node_legal_layout -->|"renders details"| node_company

click node_spa "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/main.jsx"
click node_home "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/Home.jsx"
click node_catalog "https://github.com/vishnuweb-a/firnvia/blob/main/backend/data/products.js"
click node_cart "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/context/CartContext.jsx"
click node_checkout "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/Checkout.jsx"
click node_payment_ui "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/utils/payment.js"
click node_api "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/api.js"
click node_server "https://github.com/vishnuweb-a/firnvia/blob/main/backend/server.js"
click node_products_route "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/products.js"
click node_orders_route "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/orders.js"
click node_order_store "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/orders.js"
click node_status "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/OrderStatus.jsx"
click node_payment_route "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/payment.js"
click node_airpay "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/airpay.js"
click node_airpay2_route "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/airpay2.js"
click node_airpay2 "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/airpay2.js"
click node_sabpaisa "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/sabpaisa.js"
click node_payu "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/payu.js"
click node_hdfc_route "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/hdfc.js"
click node_hdfc "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/hdfc.js"
click node_kkchat "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatForwarder.js"
click node_kkdiag "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatDiagnostics.js"
click node_kkadapter "https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatFieldAdapter.js"
click node_contact "https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/contact.js"
click node_contact_ui "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/components/Contact.jsx"
click node_legal "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/TermsAndConditions.jsx"
click node_legal_layout "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/components/LegalLayout.jsx"
click node_company "https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/legal/company.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_spa,node_home,node_catalog,node_cart,node_checkout,node_payment_ui,node_api,node_status,node_browser toneBlue
class node_server,node_products_route,node_orders_route,node_order_store toneAmber
class node_payment_route,node_airpay,node_airpay2_route,node_airpay2,node_sabpaisa,node_payu,node_hdfc_route,node_hdfc,node_kkchat,node_kkdiag,node_kkadapter toneMint
class node_contact,node_contact_ui,node_legal,node_legal_layout,node_company toneRose
class node_gateway_services,node_kkchat_service toneIndigo
```

## Components

### Storefront

- [React App](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Storefront Home](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Product Catalog](https://github.com/vishnuweb-a/firnvia/blob/main/backend/data/products.js): `backend/data/products.js`
- [Cart State](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [Checkout](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Payment Navigation](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/utils/payment.js): `frontend/src/utils/payment.js`
- [API Client](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Order Status](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/OrderStatus.jsx): `frontend/src/pages/OrderStatus.jsx`

### Order Management

- [Express API](https://github.com/vishnuweb-a/firnvia/blob/main/backend/server.js): `backend/server.js`
- [Products API](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/products.js): `backend/routes/products.js`
- [Orders API](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/orders.js): `backend/routes/orders.js`
- [In-Memory Orders](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/orders.js): `backend/routes/orders.js`

### Payment Integrations

- [Payment API](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/payment.js): `backend/routes/payment.js`
- [AirPay](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/airpay.js): `backend/services/airpay.js`
- [AirPay 2 Routes](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/airpay2.js): `backend/routes/airpay2.js`
- [AirPay 2 Service](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/airpay2.js): `backend/services/airpay2.js`
- [SabPaisa Service](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/sabpaisa.js): `backend/services/sabpaisa.js`
- [PayU Service](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/payu.js): `backend/services/payu.js`
- [HDFC Routes](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/hdfc.js): `backend/routes/hdfc.js`
- [HDFC Service](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/hdfc.js): `backend/services/hdfc.js`
- [KKChat Forwarder](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatForwarder.js): `backend/services/kkchatForwarder.js`
- [Forwarding Diagnostics](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatDiagnostics.js): `backend/services/kkchatDiagnostics.js`
- [Field Adapter](https://github.com/vishnuweb-a/firnvia/blob/main/backend/services/kkchatFieldAdapter.js): `backend/services/kkchatFieldAdapter.js`

### Contact And Policies

- [Contact API](https://github.com/vishnuweb-a/firnvia/blob/main/backend/routes/contact.js): `backend/routes/contact.js`
- [Contact Form](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/components/Contact.jsx): `frontend/src/components/Contact.jsx`
- [Legal Pages](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/pages/TermsAndConditions.jsx): `frontend/src/pages/TermsAndConditions.jsx`
- [Legal Layout](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/components/LegalLayout.jsx): `frontend/src/components/LegalLayout.jsx`
- [Company Details](https://github.com/vishnuweb-a/firnvia/blob/main/frontend/src/legal/company.js): `frontend/src/legal/company.js`

### Other components

- **Shopper Browser**
- **Payment Providers**
- **KKChat Endpoint**

## Connections

- Shopper Browser → React App: uses (evidence: `README.md`)
- React App → Storefront Home: routes to (evidence: `frontend/src/main.jsx`)
- React App → Checkout: routes to (evidence: `frontend/src/main.jsx`)
- React App → Order Status: routes to (evidence: `frontend/src/main.jsx`)
- Storefront Home → Product Catalog: loads products (evidence: `frontend/src/pages/Home.jsx`)
- Storefront Home → Contact Form: renders (evidence: `frontend/src/pages/Home.jsx`)
- Storefront Home → API Client: requests contact (evidence: `frontend/src/pages/Home.jsx`)
- Checkout → Cart State: reads cart (evidence: `frontend/src/pages/Checkout.jsx`)
- Checkout → API Client: creates order (evidence: `frontend/src/pages/Checkout.jsx`)
- Checkout → Payment Navigation: handles response (evidence: `frontend/src/pages/Checkout.jsx`)
- API Client → Express API: calls API (evidence: `frontend/src/api.js`)
- API Client → Products API: requests products (evidence: `frontend/src/api.js`)
- API Client → Orders API: creates and reads (evidence: `frontend/src/api.js`)
- API Client → Payment API: initiates payment (evidence: `frontend/src/api.js`)
- API Client → Contact API: submits contact (evidence: `frontend/src/api.js`)
- Express API → Products API: mounts (evidence: `backend/server.js`)
- Express API → Orders API: mounts (evidence: `backend/server.js`)
- Express API → Payment API: mounts (evidence: `backend/server.js`)
- Express API → AirPay 2 Routes: mounts (evidence: `backend/server.js`)
- Express API → HDFC Routes: mounts (evidence: `backend/server.js`)
- Express API → Contact API: mounts (evidence: `backend/server.js`)
- Products API → Product Catalog: reads catalog (evidence: `backend/routes/products.js`)
- Orders API → Product Catalog: validates items (evidence: `backend/routes/orders.js`)
- Orders API → In-Memory Orders: stores orders (evidence: `backend/routes/orders.js`)
- Order Status → API Client: fetches status (evidence: `frontend/src/pages/OrderStatus.jsx`)
- Orders API → HDFC Service: refreshes pending (evidence: `backend/routes/orders.js`)
- Payment API → In-Memory Orders: reads and updates (evidence: `backend/routes/payment.js`)
- Payment API → AirPay: initiates and verifies (evidence: `backend/routes/payment.js`)
- Payment API → SabPaisa Service: initiates and enquires (evidence: `backend/routes/payment.js`)
- Payment API → PayU Service: builds and verifies (evidence: `backend/routes/payment.js`)
- Payment API → Payment Providers: contacts gateways (evidence: `README.md`)
- AirPay 2 Routes → In-Memory Orders: uses orders (evidence: `backend/routes/airpay2.js`)
- AirPay 2 Routes → AirPay 2 Service: delegates to (evidence: `backend/routes/airpay2.js`)
- AirPay 2 Routes → KKChat Forwarder: forwards verified data (evidence: `backend/routes/airpay2.js`)
- AirPay 2 Service → Payment Providers: integrates with (evidence: `README.md`)
- HDFC Routes → HDFC Service: delegates to (evidence: `backend/routes/hdfc.js`)
- HDFC Routes → In-Memory Orders: uses orders (evidence: `backend/routes/hdfc.js`)
- HDFC Service → Payment Providers: creates sessions and checks (evidence: `backend/services/hdfc.js`)
- KKChat Forwarder → Forwarding Diagnostics: uses diagnostics (evidence: `backend/services/kkchatForwarder.js`)
- KKChat Forwarder → Field Adapter: uses field adapter (evidence: `backend/services/kkchatForwarder.js`)
- KKChat Forwarder → KKChat Endpoint: forwards payload
- Contact Form → API Client: submits form (evidence: `frontend/src/components/Contact.jsx`)
- Legal Pages → Legal Layout: uses layout (evidence: `frontend/src/pages/TermsAndConditions.jsx`)
- Legal Layout → Company Details: renders details (evidence: `frontend/src/components/LegalLayout.jsx`)
