# ameyey/new-bill-pro architecture

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

- Interactive diagram: https://gitdiagram.com/ameyey/new-bill-pro
- Repository: https://github.com/ameyey/new-bill-pro

## Overview

BillPro is an invoicing and business-management application. Users authenticate, manage customers and products, create GST-aware invoices, preview and save them, and access reports, settings, image uploads, and subscription features; a separate admin dashboard manages users. The backend exposes these domains through Express routes and persists data through a database adapter. The README contains no usable product description, so capability coverage relies on the source tree and index; several backend routes and frontend pages were not sampled, and their internal behavior is not inferred.

Main entry points: [`backend/src/server.js`](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/server.js) (Express API server), [`frontend/src/App.jsx`](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/utils/api.js`](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/utils/api.js) (API client), [`backend/src/config/db.js`](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/config/db.js) (Database adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_authui["Sign in / register"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_billing["Billing workflow"]
  node_invoiceui["Invoice creation<br/>[CreateInvoice.jsx]"]
  node_preview["Invoice preview"]
  node_template["Invoice template"]
  node_gst["GST calculations<br/>[gstCalculator.js]"]
  node_pdf["Invoice PDF generation<br/>[pdfGenerator.js]"]
end

subgraph group_business["Business operations"]
  node_customersui["Customer management<br/>[CustomerList.jsx]"]
  node_productsui["Product management<br/>[ProductList.jsx]"]
  node_admin["Admin user dashboard"]
  node_dashboard["Dashboard and reports<br/>[DashboardHome.jsx]"]
  node_reportsui["Reports view<br/>[ReportsPage.jsx]"]
  node_settingsui["Settings view<br/>[SettingsPage.jsx]"]
  node_subscriptionui["Subscription view"]
end

subgraph group_server["API services"]
  node_invoicectrl["Invoice service"]
  node_invoiceroutes["Invoice routes<br/>[invoiceRoutes.js]"]
  node_customersctrl["Customer service"]
  node_productsctrl["Product service"]
  node_reports["Reporting service"]
  node_settings["Company settings"]
  node_subscriptions["Subscription service"]
  node_images["Image uploads"]
  node_authmw["Request authentication<br/>[auth.js]"]
  node_server["Express API server<br/>[server.js]"]
end

subgraph group_data["Persistence"]
  node_db["Database adapter<br/>[db.js]"]
  node_schema["Application schema<br/>[schema.js]"]
end

node_user(("Business user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_invoiceui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_reportsui
node_app -->|"routes to"| node_settingsui
node_app -->|"routes to"| node_subscriptionui
node_app -->|"routes to"| node_admin
node_authui -->|"uses"| node_authstate
node_authstate -->|"requests"| node_api
node_customersui -->|"requests"| node_api
node_productsui -->|"requests"| node_api
node_invoiceui -->|"requests"| node_api
node_invoiceui -->|"opens preview"| node_preview
node_preview -->|"renders"| node_template
node_reportsui -->|"requests"| node_api
node_settingsui -->|"requests"| node_api
node_subscriptionui -->|"requests"| node_api
node_dashboard -->|"requests"| node_api
node_api -.->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_invoiceroutes
node_server -.->|"mounts customer routes"| node_customersctrl
node_server -.->|"mounts product routes"| node_productsctrl
node_server -.->|"mounts report routes"| node_reports
node_server -.->|"mounts settings routes"| node_settings
node_server -.->|"mounts subscription routes"| node_subscriptions
node_server -->|"mounts upload routes"| node_images
node_server -->|"mounts admin routes"| node_admin
node_invoiceroutes -->|"dispatches to"| node_invoicectrl
node_invoicectrl -->|"reads and writes"| node_db
node_invoicectrl -->|"calculates totals"| node_gst
node_invoicectrl -.->|"generates PDF"| node_pdf
node_customersctrl -->|"reads and writes"| node_db
node_reports -->|"queries reports"| node_db
node_admin -->|"reads and updates"| node_db
node_server -->|"initializes schema"| node_schema
node_schema -.->|"defines stored data"| node_db
node_authmw -->|"loads user"| node_db

click node_app "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/ameyey/new-bill-pro/tree/main/frontend/src/pages/Auth"
click node_authstate "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/context/AuthContext.jsx"
click node_api "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/utils/api.js"
click node_customersui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Customers/CustomerList.jsx"
click node_productsui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Products/ProductList.jsx"
click node_invoiceui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Invoices/CreateInvoice.jsx"
click node_preview "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/components/InvoicePreviewModal.jsx"
click node_template "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/components/InvoiceTemplates/IndustrialTemplate.jsx"
click node_gst "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/utils/gstCalculator.js"
click node_invoicectrl "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/invoiceController.js"
click node_invoiceroutes "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/routes/invoiceRoutes.js"
click node_customersctrl "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/customerController.js"
click node_productsctrl "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/productController.js"
click node_reports "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/reportController.js"
click node_settings "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/settingsController.js"
click node_subscriptions "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/subscriptionController.js"
click node_images "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/uploadController.js"
click node_admin "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/myUserController.js"
click node_authmw "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/middleware/auth.js"
click node_server "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/server.js"
click node_db "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/config/db.js"
click node_schema "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/models/schema.js"
click node_pdf "https://github.com/ameyey/new-bill-pro/blob/main/backend/src/utils/pdfGenerator.js"
click node_dashboard "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Dashboard/DashboardHome.jsx"
click node_reportsui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Reports/ReportsPage.jsx"
click node_settingsui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Settings/SettingsPage.jsx"
click node_subscriptionui "https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Subscriptions/SubscriptionPage.jsx"

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_authui,node_authstate,node_api,node_user toneBlue
class node_invoiceui,node_preview,node_template,node_gst,node_pdf toneAmber
class node_customersui,node_productsui,node_admin,node_dashboard,node_reportsui,node_settingsui,node_subscriptionui toneMint
class node_invoicectrl,node_invoiceroutes,node_customersctrl,node_productsctrl,node_reports,node_settings,node_subscriptions,node_images,node_authmw,node_server toneRose
class node_db,node_schema toneIndigo
```

## Components

### Client experience

- [App routing](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign in / register](https://github.com/ameyey/new-bill-pro/tree/main/frontend/src/pages/Auth): `frontend/src/pages/Auth`
- [Auth state](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`

### Billing workflow

- [Invoice creation](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Invoices/CreateInvoice.jsx): `frontend/src/pages/Invoices/CreateInvoice.jsx`
- [Invoice preview](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/components/InvoicePreviewModal.jsx): `frontend/src/components/InvoicePreviewModal.jsx`
- [Invoice template](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/components/InvoiceTemplates/IndustrialTemplate.jsx): `frontend/src/components/InvoiceTemplates/IndustrialTemplate.jsx`
- [GST calculations](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/utils/gstCalculator.js): `backend/src/utils/gstCalculator.js`
- [Invoice PDF generation](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/utils/pdfGenerator.js): `backend/src/utils/pdfGenerator.js`

### Business operations

- [Customer management](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Customers/CustomerList.jsx): `frontend/src/pages/Customers/CustomerList.jsx`
- [Product management](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Products/ProductList.jsx): `frontend/src/pages/Products/ProductList.jsx`
- [Admin user dashboard](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/myUserController.js): `backend/src/controllers/myUserController.js`
- [Dashboard and reports](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Dashboard/DashboardHome.jsx): `frontend/src/pages/Dashboard/DashboardHome.jsx`
- [Reports view](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Reports/ReportsPage.jsx): `frontend/src/pages/Reports/ReportsPage.jsx`
- [Settings view](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Settings/SettingsPage.jsx): `frontend/src/pages/Settings/SettingsPage.jsx`
- [Subscription view](https://github.com/ameyey/new-bill-pro/blob/main/frontend/src/pages/Subscriptions/SubscriptionPage.jsx): `frontend/src/pages/Subscriptions/SubscriptionPage.jsx`

### API services

- [Invoice service](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/invoiceController.js): `backend/src/controllers/invoiceController.js`
- [Invoice routes](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/routes/invoiceRoutes.js): `backend/src/routes/invoiceRoutes.js`
- [Customer service](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/customerController.js): `backend/src/controllers/customerController.js`
- [Product service](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/productController.js): `backend/src/controllers/productController.js`
- [Reporting service](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/reportController.js): `backend/src/controllers/reportController.js`
- [Company settings](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/settingsController.js): `backend/src/controllers/settingsController.js`
- [Subscription service](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/subscriptionController.js): `backend/src/controllers/subscriptionController.js`
- [Image uploads](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/controllers/uploadController.js): `backend/src/controllers/uploadController.js`
- [Request authentication](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Express API server](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/server.js): `backend/src/server.js`

### Persistence

- [Database adapter](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Application schema](https://github.com/ameyey/new-bill-pro/blob/main/backend/src/models/schema.js): `backend/src/models/schema.js`

### Other components

- **Business user**

## Connections

- Business user → App routing: uses
- App routing → Sign in / register: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Invoice creation: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard and reports: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Reports view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Settings view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Subscription view: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Admin user dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Sign in / register → Auth state: uses (evidence: `frontend/src/pages/Auth/Login.jsx`)
- Auth state → API client: requests (evidence: `frontend/src/context/AuthContext.jsx`)
- Customer management → API client: requests (evidence: `frontend/src/pages/Customers/CustomerList.jsx`)
- Product management → API client: requests (evidence: `frontend/src/pages/Products/ProductList.jsx`)
- Invoice creation → API client: requests (evidence: `frontend/src/pages/Invoices/CreateInvoice.jsx`)
- Invoice creation → Invoice preview: opens preview (evidence: `frontend/src/pages/Invoices/CreateInvoice.jsx`)
- Invoice preview → Invoice template: renders (evidence: `frontend/src/components/InvoicePreviewModal.jsx`)
- Reports view → API client: requests (evidence: `frontend/src/pages/Reports/ReportsPage.jsx`)
- Settings view → API client: requests (evidence: `frontend/src/pages/Settings/SettingsPage.jsx`)
- Subscription view → API client: requests (evidence: `frontend/src/pages/Subscriptions/SubscriptionPage.jsx`)
- Dashboard and reports → API client: requests (evidence: `frontend/src/pages/Dashboard/DashboardHome.jsx`)
- API client → Express API server: sends API requests
- Express API server → Invoice routes: mounts routes (evidence: `backend/src/server.js`)
- Express API server → Customer service: mounts customer routes
- Express API server → Product service: mounts product routes
- Express API server → Reporting service: mounts report routes
- Express API server → Company settings: mounts settings routes
- Express API server → Subscription service: mounts subscription routes
- Express API server → Image uploads: mounts upload routes (evidence: `backend/src/server.js`)
- Express API server → Admin user dashboard: mounts admin routes (evidence: `backend/src/server.js`)
- Invoice routes → Invoice service: dispatches to (evidence: `backend/src/routes/invoiceRoutes.js`)
- Invoice service → Database adapter: reads and writes (evidence: `backend/src/controllers/invoiceController.js`)
- Invoice service → GST calculations: calculates totals (evidence: `backend/src/controllers/invoiceController.js`)
- Invoice service → Invoice PDF generation: generates PDF (evidence: `backend/src/controllers/invoiceController.js`)
- Customer service → Database adapter: reads and writes (evidence: `backend/src/controllers/customerController.js`)
- Reporting service → Database adapter: queries reports (evidence: `backend/src/controllers/reportController.js`)
- Admin user dashboard → Database adapter: reads and updates (evidence: `backend/src/controllers/myUserController.js`)
- Express API server → Application schema: initializes schema (evidence: `backend/src/server.js`)
- Application schema → Database adapter: defines stored data
- Request authentication → Database adapter: loads user (evidence: `backend/src/middleware/auth.js`)
