# shivamkesharwani2931/invoice-generator architecture

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

- Interactive diagram: https://gitdiagram.com/shivamkesharwani2931/invoice-generator
- Repository: https://github.com/shivamkesharwani2931/invoice-generator

## Overview

Invoice Generator is a web app for creating, styling, saving, downloading, and revisiting invoices, with cookie-based signup/login and protected invoice features. The main path is user → create form and template preview → generated PDF and invoice API → authenticated backend validation and persistence; users can later list and download saved invoices. The graph also includes the documented auth and template-selection branches. Connections reflect shown imports, route registrations, and calls; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/Data/templates.js`](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Data/templates.js) (Template catalog), [`backend/Routes/authRoutes.js`](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/authRoutes.js) (Auth routes), [`backend/Routes/invoiceRoutes.js`](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/invoiceRoutes.js) (Invoice routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth_pages["Login and signup<br/>[Login.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_templates_page["Template gallery<br/>[Templates.jsx]"]
  node_create_page["Invoice workspace<br/>[CreateInvoice.jsx]"]
  node_my_invoices["Saved invoices<br/>[MyInvoices.jsx]"]
end

subgraph group_identity["Authentication"]
  node_user_store["Auth state<br/>[User.js]"]
  node_user_services["Auth API client<br/>[UserServices.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Auth operations<br/>[authController.js]"]
  node_auth_middleware["Session guard<br/>[authMiddleware.js]"]
end

subgraph group_invoice["Invoice workflow"]
  node_template_catalog["Template catalog<br/>[templates.js]"]
  node_business_template["Business design"]
  node_modern_template["Modern design<br/>[ModernTemplate.jsx]"]
  node_other_templates["Other designs"]
  node_invoice_form["Invoice form<br/>[InvoiceForm.jsx]"]
  node_preview["Preview and PDF<br/>[InvoicePreview.jsx]"]
  node_invoice_service["Invoice API client<br/>[invoiceServices.js]"]
  node_invoice_controller["Invoice operations"]
end

subgraph group_backend["API and persistence"]
  node_api_server["Express server<br/>[server.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_invoice_routes["Invoice routes<br/>[invoiceRoutes.js]"]
  node_invoice_model[("Invoice records<br/>[Invoice.js]")]
end

node_user(("User"))
node_mongo[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_create_page
node_app -->|"routes to"| node_templates_page
node_app -->|"routes to"| node_my_invoices
node_app -->|"renders"| node_navbar
node_app -->|"checks session"| node_user_store
node_create_page -->|"renders"| node_invoice_form
node_create_page -->|"renders"| node_preview
node_preview -->|"selects design"| node_template_catalog
node_template_catalog -->|"registers"| node_business_template
node_template_catalog -->|"registers"| node_modern_template
node_template_catalog -->|"registers"| node_other_templates
node_preview -->|"saves invoice"| node_invoice_service
node_my_invoices -->|"requests invoices"| node_invoice_service
node_invoice_service -->|"HTTP requests"| node_invoice_routes
node_user_store -->|"calls"| node_user_services
node_user_services -.->|"HTTP requests"| node_auth_routes
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_invoice_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"guards session"| node_auth_middleware
node_invoice_routes -->|"guards requests"| node_auth_middleware
node_invoice_routes -->|"dispatches"| node_invoice_controller
node_auth_controller -->|"reads and creates"| node_user_model
node_auth_middleware -->|"loads user"| node_user_model
node_invoice_controller -->|"reads and creates"| node_invoice_model
node_api_server -->|"connects"| node_mongo
node_invoice_controller -->|"stores PDF"| node_mongo

click node_app "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/App.jsx"
click node_auth_pages "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/Login.jsx"
click node_navbar "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Navbar.jsx"
click node_templates_page "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/Templates.jsx"
click node_template_catalog "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Data/templates.js"
click node_business_template "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Templates/BusinessTemplate.jsx"
click node_modern_template "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Templates/ModernTemplate.jsx"
click node_other_templates "https://github.com/shivamkesharwani2931/invoice-generator/tree/main/frontend/src/Components/Templates"
click node_create_page "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/CreateInvoice.jsx"
click node_invoice_form "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/InvoiceForm.jsx"
click node_preview "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/InvoicePreview.jsx"
click node_invoice_service "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Services/invoiceServices.js"
click node_my_invoices "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/MyInvoices.jsx"
click node_user_store "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Store/User/User.js"
click node_user_services "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Services/UserServices.js"
click node_api_server "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/server.js"
click node_auth_routes "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/authRoutes.js"
click node_auth_controller "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Controllers/authController.js"
click node_auth_middleware "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Middleware/authMiddleware.js"
click node_user_model "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Models/User.js"
click node_invoice_routes "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/invoiceRoutes.js"
click node_invoice_controller "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Controllers/invoiceController.js"
click node_invoice_model "https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Models/Invoice.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_auth_pages,node_navbar,node_templates_page,node_create_page,node_my_invoices,node_user toneBlue
class node_user_store,node_user_services,node_auth_routes,node_auth_controller,node_auth_middleware,node_mongo toneAmber
class node_template_catalog,node_business_template,node_modern_template,node_other_templates,node_invoice_form,node_preview,node_invoice_service,node_invoice_controller toneMint
class node_api_server,node_user_model,node_invoice_routes,node_invoice_model toneRose
```

## Components

### Frontend experience

- [App routing](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Navigation](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Navbar.jsx): `frontend/src/Components/Navbar.jsx`
- [Template gallery](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/Templates.jsx): `frontend/src/pages/Templates.jsx`
- [Invoice workspace](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/CreateInvoice.jsx): `frontend/src/pages/CreateInvoice.jsx`
- [Saved invoices](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/pages/MyInvoices.jsx): `frontend/src/pages/MyInvoices.jsx`

### Authentication

- [Auth state](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Store/User/User.js): `frontend/src/Store/User/User.js`
- [Auth API client](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Services/UserServices.js): `frontend/src/Services/UserServices.js`
- [Auth routes](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/authRoutes.js): `backend/Routes/authRoutes.js`
- [Auth operations](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Controllers/authController.js): `backend/Controllers/authController.js`
- [Session guard](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Middleware/authMiddleware.js): `backend/Middleware/authMiddleware.js`

### Invoice workflow

- [Template catalog](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Data/templates.js): `frontend/src/Data/templates.js`
- [Business design](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Templates/BusinessTemplate.jsx): `frontend/src/Components/Templates/BusinessTemplate.jsx`
- [Modern design](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/Templates/ModernTemplate.jsx): `frontend/src/Components/Templates/ModernTemplate.jsx`
- [Other designs](https://github.com/shivamkesharwani2931/invoice-generator/tree/main/frontend/src/Components/Templates): `frontend/src/Components/Templates`
- [Invoice form](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/InvoiceForm.jsx): `frontend/src/Components/InvoiceForm.jsx`
- [Preview and PDF](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Components/InvoicePreview.jsx): `frontend/src/Components/InvoicePreview.jsx`
- [Invoice API client](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/frontend/src/Services/invoiceServices.js): `frontend/src/Services/invoiceServices.js`
- [Invoice operations](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Controllers/invoiceController.js): `backend/Controllers/invoiceController.js`

### API and persistence

- [Express server](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/server.js): `backend/server.js`
- [User records](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Models/User.js): `backend/Models/User.js`
- [Invoice routes](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Routes/invoiceRoutes.js): `backend/Routes/invoiceRoutes.js`
- [Invoice records](https://github.com/shivamkesharwani2931/invoice-generator/blob/main/backend/Models/Invoice.js): `backend/Models/Invoice.js`

### Other components

- **User**
- **MongoDB**

## Connections

- User → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Login and signup: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Invoice workspace: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Template gallery: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Saved invoices: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App routing → Auth state: checks session (evidence: `frontend/src/App.jsx`)
- Invoice workspace → Invoice form: renders (evidence: `frontend/src/pages/CreateInvoice.jsx`)
- Invoice workspace → Preview and PDF: renders (evidence: `frontend/src/pages/CreateInvoice.jsx`)
- Preview and PDF → Template catalog: selects design (evidence: `frontend/src/Components/InvoicePreview.jsx`)
- Template catalog → Business design: registers (evidence: `frontend/src/Data/templates.js`)
- Template catalog → Modern design: registers (evidence: `frontend/src/Data/templates.js`)
- Template catalog → Other designs: registers (evidence: `frontend/src/Data/templates.js`)
- Preview and PDF → Invoice API client: saves invoice (evidence: `frontend/src/Components/InvoicePreview.jsx`)
- Saved invoices → Invoice API client: requests invoices (evidence: `frontend/src/pages/MyInvoices.jsx`)
- Invoice API client → Invoice routes: HTTP requests (evidence: `frontend/src/Services/invoiceServices.js`)
- Auth state → Auth API client: calls (evidence: `frontend/src/Store/User/User.js`)
- Auth API client → Auth routes: HTTP requests
- Express server → Auth routes: mounts routes (evidence: `backend/server.js`)
- Express server → Invoice routes: mounts routes
- Auth routes → Auth operations: dispatches (evidence: `backend/Routes/authRoutes.js`)
- Auth routes → Session guard: guards session (evidence: `backend/Routes/authRoutes.js`)
- Invoice routes → Session guard: guards requests (evidence: `backend/Routes/invoiceRoutes.js`)
- Invoice routes → Invoice operations: dispatches (evidence: `backend/Routes/invoiceRoutes.js`)
- Auth operations → User records: reads and creates (evidence: `backend/Controllers/authController.js`)
- Session guard → User records: loads user (evidence: `backend/Middleware/authMiddleware.js`)
- Invoice operations → Invoice records: reads and creates (evidence: `backend/Controllers/invoiceController.js`)
- Express server → MongoDB: connects (evidence: `backend/server.js`)
- Invoice operations → MongoDB: stores PDF (evidence: `backend/Controllers/invoiceController.js`)
