# deveshsarda5/billify architecture

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

- Interactive diagram: https://gitdiagram.com/deveshsarda5/billify
- Repository: https://github.com/deveshsarda5/billify

## Overview

Billify combines a customer mobile app, an Express/MongoDB API, and a web admin console. The customer flow is authentication, store selection, bill scanning and history, then payment and receipt tracking; support and profile tools are additional user-facing capabilities. The admin console manages users, sales, products, offers, payments, and support. Several screen and service implementations were not sampled, so their detailed call paths are left unspecified; dashed links mark documented but unverified runtime connections.

Main entry points: [`billify-admin-main/lib/adminApi.ts`](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/lib/adminApi.ts) (Admin API client), [`app/navigation/AppNavigator.tsx`](https://github.com/deveshsarda5/billify/blob/main/app/navigation/AppNavigator.tsx) (Screen navigation), [`billify-backend/server.js`](https://github.com/deveshsarda5/billify/blob/main/billify-backend/server.js) (HTTP server), [`billify-backend/src/models`](https://github.com/deveshsarda5/billify/tree/main/billify-backend/src/models) (Domain records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Customer mobile app"]
  node_app["App shell<br/>[App.tsx]"]
  node_navigation["Screen navigation<br/>[AppNavigator.tsx]"]
  node_authscreens["Sign-in and signup<br/>[LoginScreen.tsx]"]
  node_dashboard["Dashboard"]
  node_location["Store selection"]
  node_scan["Receipt scanning<br/>[ScanScreen.tsx]"]
  node_billhistory["Bills and receipts"]
  node_checkout["Payment checkout<br/>[PaymentScreen.tsx]"]
  node_paymethods["Payment methods"]
  node_support["Support tickets"]
  node_profile["Profile settings<br/>[ProfileScreen.tsx]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.routes.js]"]
  node_adminroutes["Admin routes<br/>[admin.routes.js]"]
  node_authcontroller["Authentication logic<br/>[auth.controller.js]"]
  node_admincontroller["Admin operations"]
  node_paymentcontroller["Payment and verification"]
  node_authmiddleware["JWT authorization<br/>[auth.middleware.js]"]
end

subgraph group_data["Persistence"]
  node_datamodels[("Domain records")]
  node_mongodb[("MongoDB")]
end

subgraph group_admin["Admin console"]
  node_adminweb["Admin web console<br/>[page.tsx]"]
  node_adminproducts["Product management<br/>[page.tsx]"]
  node_adminoffers["Offer management<br/>[page.tsx]"]
  node_adminsupport["Support management<br/>[page.tsx]"]
  node_admintransactions["Payments and transactions<br/>[page.tsx]"]
  node_adminproxy["Admin API client<br/>[adminApi.ts]"]
end

subgraph group_shared["Mobile state and services"]
  node_authstate["Authentication state<br/>[AuthContext.tsx]"]
  node_cartstate["Cart state<br/>[CartContext.tsx]"]
  node_locationstate["Location state"]
  node_locationutils["Store distance logic<br/>[locationUtils.ts]"]
  node_mobileapi["Mobile API client<br/>[api.ts]"]
  node_invoice["Invoice processing<br/>[invoiceService.ts]"]
end

node_customer(("Customer"))
node_razorpay["Razorpay gateway"]

node_customer -.->|"signs in"| node_authscreens
node_app -->|"renders"| node_navigation
node_app -->|"provides"| node_authstate
node_app -->|"provides"| node_locationstate
node_navigation -->|"checks session"| node_authstate
node_navigation -->|"checks selection"| node_locationstate
node_authstate -->|"calls auth API"| node_mobileapi
node_locationstate -->|"resolves stores"| node_locationutils
node_dashboard -->|"opens screens"| node_navigation
node_scan -.->|"captures bills"| node_billhistory
node_billhistory -.->|"processes invoices"| node_invoice
node_checkout -.->|"processes payment"| node_razorpay
node_paymethods -.->|"selects method"| node_checkout
node_support -->|"calls API"| node_mobileapi
node_mobileapi -.->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_adminroutes
node_authroutes -->|"routes requests"| node_authcontroller
node_authroutes -->|"protects endpoints"| node_authmiddleware
node_adminroutes -->|"routes requests"| node_admincontroller
node_adminroutes -->|"checks admin access"| node_authmiddleware
node_authcontroller -->|"reads and writes"| node_datamodels
node_admincontroller -->|"queries and updates"| node_datamodels
node_paymentcontroller -->|"updates bills"| node_datamodels
node_paymentcontroller -->|"creates orders"| node_razorpay
node_datamodels -.->|"persists records"| node_mongodb
node_adminweb -.->|"requests admin data"| node_adminproxy
node_adminproducts -.->|"manages products"| node_adminproxy
node_adminoffers -->|"manages offers"| node_adminproxy
node_adminsupport -.->|"manages tickets"| node_adminproxy
node_admintransactions -.->|"views transactions"| node_adminproxy
node_adminproxy -.->|"calls API"| node_server

click node_app "https://github.com/deveshsarda5/billify/blob/main/App.tsx"
click node_navigation "https://github.com/deveshsarda5/billify/blob/main/app/navigation/AppNavigator.tsx"
click node_authscreens "https://github.com/deveshsarda5/billify/blob/main/app/screens/LoginScreen.tsx"
click node_dashboard "https://github.com/deveshsarda5/billify/blob/main/app/screens/DashboardScreen.tsx"
click node_location "https://github.com/deveshsarda5/billify/blob/main/app/screens/StoreSelectionScreen.tsx"
click node_scan "https://github.com/deveshsarda5/billify/blob/main/app/screens/ScanScreen.tsx"
click node_billhistory "https://github.com/deveshsarda5/billify/blob/main/app/screens/PreviousBillsScreen.tsx"
click node_checkout "https://github.com/deveshsarda5/billify/blob/main/app/screens/PaymentScreen.tsx"
click node_paymethods "https://github.com/deveshsarda5/billify/blob/main/app/screens/PaymentMethodsScreen.tsx"
click node_support "https://github.com/deveshsarda5/billify/blob/main/app/screens/HelpSupportScreen.tsx"
click node_profile "https://github.com/deveshsarda5/billify/blob/main/app/screens/ProfileScreen.tsx"
click node_authstate "https://github.com/deveshsarda5/billify/blob/main/app/context/AuthContext.tsx"
click node_cartstate "https://github.com/deveshsarda5/billify/blob/main/app/context/CartContext.tsx"
click node_locationstate "https://github.com/deveshsarda5/billify/blob/main/app/context/LocationContext.tsx"
click node_locationutils "https://github.com/deveshsarda5/billify/blob/main/app/utils/locationUtils.ts"
click node_mobileapi "https://github.com/deveshsarda5/billify/blob/main/app/services/api.ts"
click node_invoice "https://github.com/deveshsarda5/billify/blob/main/app/services/invoiceService.ts"
click node_server "https://github.com/deveshsarda5/billify/blob/main/billify-backend/server.js"
click node_authroutes "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/routes/auth.routes.js"
click node_adminroutes "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/routes/admin.routes.js"
click node_authcontroller "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/auth.controller.js"
click node_admincontroller "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/admin.controller.js"
click node_paymentcontroller "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/payment.controller.js"
click node_authmiddleware "https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/middleware/auth.middleware.js"
click node_datamodels "https://github.com/deveshsarda5/billify/tree/main/billify-backend/src/models"
click node_adminweb "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/page.tsx"
click node_adminproducts "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/products/page.tsx"
click node_adminoffers "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/discounts/page.tsx"
click node_adminsupport "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/support/page.tsx"
click node_admintransactions "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/transactions/page.tsx"
click node_adminproxy "https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/lib/adminApi.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_navigation,node_authscreens,node_dashboard,node_location,node_scan,node_billhistory,node_checkout,node_paymethods,node_support,node_profile toneBlue
class node_server,node_authroutes,node_adminroutes,node_authcontroller,node_admincontroller,node_paymentcontroller,node_authmiddleware toneAmber
class node_datamodels,node_mongodb toneMint
class node_adminweb,node_adminproducts,node_adminoffers,node_adminsupport,node_admintransactions,node_adminproxy toneRose
class node_authstate,node_cartstate,node_locationstate,node_locationutils,node_mobileapi,node_invoice,node_customer,node_razorpay toneIndigo
```

## Components

### Customer mobile app

- [App shell](https://github.com/deveshsarda5/billify/blob/main/App.tsx): `App.tsx`
- [Screen navigation](https://github.com/deveshsarda5/billify/blob/main/app/navigation/AppNavigator.tsx): `app/navigation/AppNavigator.tsx`
- [Sign-in and signup](https://github.com/deveshsarda5/billify/blob/main/app/screens/LoginScreen.tsx): `app/screens/LoginScreen.tsx`
- [Dashboard](https://github.com/deveshsarda5/billify/blob/main/app/screens/DashboardScreen.tsx): `app/screens/DashboardScreen.tsx`
- [Store selection](https://github.com/deveshsarda5/billify/blob/main/app/screens/StoreSelectionScreen.tsx): `app/screens/StoreSelectionScreen.tsx`
- [Receipt scanning](https://github.com/deveshsarda5/billify/blob/main/app/screens/ScanScreen.tsx): `app/screens/ScanScreen.tsx`
- [Bills and receipts](https://github.com/deveshsarda5/billify/blob/main/app/screens/PreviousBillsScreen.tsx): `app/screens/PreviousBillsScreen.tsx`
- [Payment checkout](https://github.com/deveshsarda5/billify/blob/main/app/screens/PaymentScreen.tsx): `app/screens/PaymentScreen.tsx`
- [Payment methods](https://github.com/deveshsarda5/billify/blob/main/app/screens/PaymentMethodsScreen.tsx): `app/screens/PaymentMethodsScreen.tsx`
- [Support tickets](https://github.com/deveshsarda5/billify/blob/main/app/screens/HelpSupportScreen.tsx): `app/screens/HelpSupportScreen.tsx`
- [Profile settings](https://github.com/deveshsarda5/billify/blob/main/app/screens/ProfileScreen.tsx): `app/screens/ProfileScreen.tsx`

### Backend API

- [HTTP server](https://github.com/deveshsarda5/billify/blob/main/billify-backend/server.js): `billify-backend/server.js`
- [Authentication routes](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/routes/auth.routes.js): `billify-backend/src/routes/auth.routes.js`
- [Admin routes](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/routes/admin.routes.js): `billify-backend/src/routes/admin.routes.js`
- [Authentication logic](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/auth.controller.js): `billify-backend/src/controllers/auth.controller.js`
- [Admin operations](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/admin.controller.js): `billify-backend/src/controllers/admin.controller.js`
- [Payment and verification](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/controllers/payment.controller.js): `billify-backend/src/controllers/payment.controller.js`
- [JWT authorization](https://github.com/deveshsarda5/billify/blob/main/billify-backend/src/middleware/auth.middleware.js): `billify-backend/src/middleware/auth.middleware.js`

### Persistence

- [Domain records](https://github.com/deveshsarda5/billify/tree/main/billify-backend/src/models): `billify-backend/src/models`
- **MongoDB**

### Admin console

- [Admin web console](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/page.tsx): `billify-admin-main/app/page.tsx`
- [Product management](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/products/page.tsx): `billify-admin-main/app/products/page.tsx`
- [Offer management](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/discounts/page.tsx): `billify-admin-main/app/discounts/page.tsx`
- [Support management](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/support/page.tsx): `billify-admin-main/app/support/page.tsx`
- [Payments and transactions](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/app/transactions/page.tsx): `billify-admin-main/app/transactions/page.tsx`
- [Admin API client](https://github.com/deveshsarda5/billify/blob/main/billify-admin-main/lib/adminApi.ts): `billify-admin-main/lib/adminApi.ts`

### Mobile state and services

- [Authentication state](https://github.com/deveshsarda5/billify/blob/main/app/context/AuthContext.tsx): `app/context/AuthContext.tsx`
- [Cart state](https://github.com/deveshsarda5/billify/blob/main/app/context/CartContext.tsx): `app/context/CartContext.tsx`
- [Location state](https://github.com/deveshsarda5/billify/blob/main/app/context/LocationContext.tsx): `app/context/LocationContext.tsx`
- [Store distance logic](https://github.com/deveshsarda5/billify/blob/main/app/utils/locationUtils.ts): `app/utils/locationUtils.ts`
- [Mobile API client](https://github.com/deveshsarda5/billify/blob/main/app/services/api.ts): `app/services/api.ts`
- [Invoice processing](https://github.com/deveshsarda5/billify/blob/main/app/services/invoiceService.ts): `app/services/invoiceService.ts`

### Other components

- **Customer**
- **Razorpay gateway**

## Connections

- Customer → Sign-in and signup: signs in (evidence: `README.md`)
- App shell → Screen navigation: renders (evidence: `App.tsx`)
- App shell → Authentication state: provides (evidence: `App.tsx`)
- App shell → Location state: provides (evidence: `App.tsx`)
- Screen navigation → Authentication state: checks session (evidence: `app/navigation/AppNavigator.tsx`)
- Screen navigation → Location state: checks selection (evidence: `app/navigation/AppNavigator.tsx`)
- Authentication state → Mobile API client: calls auth API (evidence: `app/context/AuthContext.tsx`)
- Location state → Store distance logic: resolves stores (evidence: `app/context/LocationContext.tsx`)
- Dashboard → Screen navigation: opens screens (evidence: `app/screens/DashboardScreen.tsx`)
- Receipt scanning → Bills and receipts: captures bills (evidence: `README.md`)
- Bills and receipts → Invoice processing: processes invoices (evidence: `README.md`)
- Payment checkout → Razorpay gateway: processes payment (evidence: `README.md`)
- Payment methods → Payment checkout: selects method (evidence: `README.md`)
- Support tickets → Mobile API client: calls API (evidence: `app/screens/HelpSupportScreen.tsx`)
- Mobile API client → HTTP server: sends API requests (evidence: `README.md`)
- HTTP server → Authentication routes: mounts routes (evidence: `billify-backend/server.js`)
- HTTP server → Admin routes: mounts routes (evidence: `billify-backend/server.js`)
- Authentication routes → Authentication logic: routes requests (evidence: `billify-backend/src/routes/auth.routes.js`)
- Authentication routes → JWT authorization: protects endpoints (evidence: `billify-backend/src/routes/auth.routes.js`)
- Admin routes → Admin operations: routes requests (evidence: `billify-backend/src/routes/admin.routes.js`)
- Admin routes → JWT authorization: checks admin access (evidence: `billify-backend/src/routes/admin.routes.js`)
- Authentication logic → Domain records: reads and writes (evidence: `billify-backend/src/controllers/auth.controller.js`)
- Admin operations → Domain records: queries and updates (evidence: `billify-backend/src/controllers/admin.controller.js`)
- Payment and verification → Domain records: updates bills (evidence: `billify-backend/src/controllers/payment.controller.js`)
- Payment and verification → Razorpay gateway: creates orders (evidence: `billify-backend/src/controllers/payment.controller.js`)
- Domain records → MongoDB: persists records (evidence: `README.md`)
- Admin web console → Admin API client: requests admin data
- Product management → Admin API client: manages products (evidence: `billify-admin-main/app/products/page.tsx`)
- Offer management → Admin API client: manages offers (evidence: `billify-admin-main/app/discounts/page.tsx`)
- Support management → Admin API client: manages tickets (evidence: `billify-admin-main/app/support/page.tsx`)
- Payments and transactions → Admin API client: views transactions (evidence: `billify-admin-main/app/transactions/page.tsx`)
- Admin API client → HTTP server: calls API
