# adityaprasad02/bill-bridge-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/adityaprasad02/bill-bridge-frontend
- Repository: https://github.com/adityaprasad02/bill-bridge-frontend

## Overview

This is a React bill-management frontend for merchants and customers. Users enter through public landing, login, signup, or OAuth routes; authenticated users reach a role-aware dashboard to register as merchants, create or upload bills, manage responses, and review received bills. Bill and payment operations go through API services, while customer bill payment and merchant refunds are distinct flows. The dashboard also uses a socket service for live updates. Relationships for unsampled routes and integrations are limited to SOURCE INDEX references; the README describes only the Vite template.

Main entry points: [`src/pages/Dashboard.jsx`](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Dashboard.jsx) (Role dashboard), [`src/api/billService.js`](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/api/billService.js) (Bill API service), [`src/main.jsx`](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/main.jsx) (Route setup), [`src/features/auth/authStore.js`](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/authStore.js) (Session state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and identity"]
  node_routes["Route setup<br/>[main.jsx]"]
  node_landing["Landing page<br/>[Landing.jsx]"]
  node_login["Login and signup<br/>[Login.jsx]"]
  node_oauth["OAuth completion<br/>[OauthSuccess.jsx]"]
  node_authguard["Auth guard<br/>[RequireAuth.jsx]"]
end

subgraph group_dashboard["Bill workflows"]
  node_dashboard["Role dashboard<br/>[Dashboard.jsx]"]
  node_merchantsetup["Merchant registration"]
  node_billcreate["Create bills<br/>[CreateBillForm.jsx]"]
  node_billupload["PDF bill upload<br/>[UploadBillPdf.jsx]"]
  node_merchantlist["Merchant bill management"]
  node_merchantresponses["Merchant responses"]
  node_received["Received bills"]
  node_reacted["Customer bill responses"]
end

subgraph group_services["Client services"]
  node_authservice["Authentication service<br/>[authService.js]"]
  node_authstate[("Session state<br/>[authStore.js]")]
  node_billservice["Bill API service<br/>[billService.js]"]
  node_http["HTTP client<br/>[axios.js]"]
end

subgraph group_payments["Payments and live events"]
  node_paymentui["Payment handoff<br/>[PaytmPayment.js]"]
  node_payservice["Payment service<br/>[PaytmService.js]"]
  node_socketservice["Socket service<br/>[socketService.js]"]
  node_socket["Socket connection<br/>[socket.js]"]
end

node_user(("User"))
node_backend{{"Application backend"}}

node_user -->|"opens app"| node_routes
node_routes -->|"routes to"| node_landing
node_routes -->|"routes to"| node_login
node_routes -->|"guards route"| node_authguard
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_oauth
node_login -->|"authenticates"| node_authservice
node_login -->|"updates session"| node_authstate
node_oauth -->|"uses auth"| node_authservice
node_oauth -->|"updates session"| node_authstate
node_authguard -->|"checks session"| node_authstate
node_authservice -->|"sends requests"| node_http
node_http -->|"reads tokens"| node_authstate
node_http -->|"calls API"| node_backend
node_dashboard -->|"loads profile"| node_authservice
node_dashboard -->|"loads merchant data"| node_billservice
node_dashboard -->|"reads user"| node_authstate
node_dashboard -->|"renders registration"| node_merchantsetup
node_dashboard -->|"renders form"| node_billcreate
node_dashboard -->|"renders uploader"| node_billupload
node_dashboard -->|"renders bills"| node_merchantlist
node_dashboard -->|"renders responses"| node_merchantresponses
node_dashboard -->|"renders received bills"| node_received
node_dashboard -->|"renders responses"| node_reacted
node_merchantsetup -->|"registers merchant"| node_billservice
node_billcreate -->|"creates bill"| node_billservice
node_billupload -->|"uploads PDF"| node_billservice
node_merchantlist -->|"manages bills"| node_billservice
node_reacted -->|"fetches bills"| node_billservice
node_received -->|"fetches bills"| node_billservice
node_billservice -->|"sends requests"| node_http
node_billservice -->|"calls bill endpoints"| node_backend
node_received -->|"starts payment"| node_paymentui
node_merchantlist -->|"initiates refunds"| node_billservice
node_dashboard -->|"saves payment data"| node_billservice
node_dashboard -->|"uses live updates"| node_socketservice
node_socketservice -->|"delegates connection"| node_socket
node_socketservice -->|"reads session"| node_authstate
node_payservice -->|"sends requests"| node_http

click node_routes "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/main.jsx"
click node_landing "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Landing.jsx"
click node_login "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Login.jsx"
click node_oauth "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/OauthSuccess.jsx"
click node_authguard "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/RequireAuth.jsx"
click node_dashboard "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Dashboard.jsx"
click node_merchantsetup "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantRegisterForm.jsx"
click node_billcreate "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CreateBillForm.jsx"
click node_billupload "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/UploadBillPdf.jsx"
click node_merchantlist "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantBillsList.jsx"
click node_merchantresponses "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantResponses.jsx"
click node_received "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CustomerReceivedBills.jsx"
click node_reacted "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CustomerReactedBills.jsx"
click node_authservice "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/authService.js"
click node_authstate "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/authStore.js"
click node_billservice "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/api/billService.js"
click node_http "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/api/axios.js"
click node_paymentui "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/payments/PaytmPayment.js"
click node_payservice "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/payments/PaytmService.js"
click node_socketservice "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/socket/socketService.js"
click node_socket "https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/socket/socket.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_routes,node_landing,node_login,node_oauth,node_authguard,node_user toneBlue
class node_dashboard,node_merchantsetup,node_billcreate,node_billupload,node_merchantlist,node_merchantresponses,node_received,node_reacted toneAmber
class node_authservice,node_authstate,node_billservice,node_http toneMint
class node_paymentui,node_payservice,node_socketservice,node_socket toneRose
class node_backend toneIndigo
```

## Components

### App entry and identity

- [Route setup](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/main.jsx): `src/main.jsx`
- [Landing page](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Landing.jsx): `src/pages/Landing.jsx`
- [Login and signup](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [OAuth completion](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/OauthSuccess.jsx): `src/pages/OauthSuccess.jsx`
- [Auth guard](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/RequireAuth.jsx): `src/features/auth/RequireAuth.jsx`

### Bill workflows

- [Role dashboard](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Merchant registration](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantRegisterForm.jsx): `src/components/dashboard/MerchantRegisterForm.jsx`
- [Create bills](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CreateBillForm.jsx): `src/components/dashboard/CreateBillForm.jsx`
- [PDF bill upload](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/UploadBillPdf.jsx): `src/components/dashboard/UploadBillPdf.jsx`
- [Merchant bill management](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantBillsList.jsx): `src/components/dashboard/MerchantBillsList.jsx`
- [Merchant responses](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/MerchantResponses.jsx): `src/components/dashboard/MerchantResponses.jsx`
- [Received bills](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CustomerReceivedBills.jsx): `src/components/dashboard/CustomerReceivedBills.jsx`
- [Customer bill responses](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/dashboard/CustomerReactedBills.jsx): `src/components/dashboard/CustomerReactedBills.jsx`

### Client services

- [Authentication service](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/authService.js): `src/features/auth/authService.js`
- [Session state](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/auth/authStore.js): `src/features/auth/authStore.js`
- [Bill API service](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/api/billService.js): `src/api/billService.js`
- [HTTP client](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/api/axios.js): `src/api/axios.js`

### Payments and live events

- [Payment handoff](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/payments/PaytmPayment.js): `src/components/payments/PaytmPayment.js`
- [Payment service](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/components/payments/PaytmService.js): `src/components/payments/PaytmService.js`
- [Socket service](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/socket/socketService.js): `src/features/socket/socketService.js`
- [Socket connection](https://github.com/adityaprasad02/bill-bridge-frontend/blob/main/src/features/socket/socket.js): `src/features/socket/socket.js`

### Other components

- **User**
- **Application backend**

## Connections

- User → Route setup: opens app (evidence: `src/main.jsx`)
- Route setup → Landing page: routes to (evidence: `src/main.jsx`)
- Route setup → Login and signup: routes to (evidence: `src/main.jsx`)
- Route setup → Auth guard: guards route (evidence: `src/main.jsx`)
- Route setup → Role dashboard: routes to (evidence: `src/main.jsx`)
- Route setup → OAuth completion: routes to (evidence: `src/main.jsx`)
- Login and signup → Authentication service: authenticates (evidence: `src/pages/Login.jsx`)
- Login and signup → Session state: updates session (evidence: `src/pages/Login.jsx`)
- OAuth completion → Authentication service: uses auth (evidence: `src/pages/OauthSuccess.jsx`)
- OAuth completion → Session state: updates session (evidence: `src/pages/OauthSuccess.jsx`)
- Auth guard → Session state: checks session (evidence: `src/features/auth/RequireAuth.jsx`)
- Authentication service → HTTP client: sends requests (evidence: `src/features/auth/authService.js`)
- HTTP client → Session state: reads tokens (evidence: `src/api/axios.js`)
- HTTP client → Application backend: calls API (evidence: `src/api/axios.js`)
- Role dashboard → Authentication service: loads profile (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Bill API service: loads merchant data (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Session state: reads user (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Merchant registration: renders registration (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Create bills: renders form (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → PDF bill upload: renders uploader (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Merchant bill management: renders bills (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Merchant responses: renders responses (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Received bills: renders received bills (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Customer bill responses: renders responses (evidence: `src/pages/Dashboard.jsx`)
- Merchant registration → Bill API service: registers merchant (evidence: `src/components/dashboard/MerchantRegisterForm.jsx`)
- Create bills → Bill API service: creates bill (evidence: `src/components/dashboard/CreateBillForm.jsx`)
- PDF bill upload → Bill API service: uploads PDF (evidence: `src/components/dashboard/UploadBillPdf.jsx`)
- Merchant bill management → Bill API service: manages bills (evidence: `src/components/dashboard/MerchantBillsList.jsx`)
- Customer bill responses → Bill API service: fetches bills (evidence: `src/components/dashboard/CustomerReactedBills.jsx`)
- Received bills → Bill API service: fetches bills (evidence: `src/components/dashboard/CustomerReceivedBills.jsx`)
- Bill API service → HTTP client: sends requests (evidence: `src/api/billService.js`)
- Bill API service → Application backend: calls bill endpoints (evidence: `src/api/billService.js`)
- Received bills → Payment handoff: starts payment (evidence: `src/components/dashboard/CustomerReceivedBills.jsx`)
- Merchant bill management → Bill API service: initiates refunds (evidence: `src/components/dashboard/MerchantBillsList.jsx`)
- Role dashboard → Bill API service: saves payment data (evidence: `src/pages/Dashboard.jsx`)
- Role dashboard → Socket service: uses live updates (evidence: `src/pages/Dashboard.jsx`)
- Socket service → Socket connection: delegates connection (evidence: `src/features/socket/socketService.js`)
- Socket service → Session state: reads session (evidence: `src/features/socket/socketService.js`)
- Payment service → HTTP client: sends requests (evidence: `src/components/payments/PaytmService.js`)
