# senguptajeet/expenseapp-octo-memory architecture

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

- Interactive diagram: https://gitdiagram.com/senguptajeet/expenseapp-octo-memory
- Repository: https://github.com/senguptajeet/expenseapp-octo-memory

## Overview

This is a serverless Google Apps Script expense-management dashboard. Users enter expenses and view filtered reports; administrators also manage accounts and can request audits, forecasts, and exports. The backend separates authentication, expense operations, cached lookup data, AI analysis, and document generation, with Google Sheets and Drive as the principal stores. The README documents a responsive entry grid and compliance behavior, but the HTML files are unsampled, so frontend-to-backend links are omitted rather than inferred.

Main entry points: [`ExpenseService.js`](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/ExpenseService.js) (Expense entry and reports), [`AuthService.js`](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AuthService.js) (Authentication and users), [`CacheService.js`](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/CacheService.js) (Auth and dropdown cache), [`AiService.js`](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AiService.js) (Spending insights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_webapp["Dashboard serving<br/>[Code.js]"]
  node_ui["Responsive expense UI<br/>[Index.html]"]
end

subgraph group_access["Access and lookup"]
  node_auth["Authentication and users<br/>[AuthService.js]"]
  node_authcache["Auth and dropdown cache<br/>[CacheService.js]"]
  node_email["Account welcome email<br/>[AuthService.js]"]
end

subgraph group_expenses["Expense operations"]
  node_expenses["Expense entry and reports<br/>[ExpenseService.js]"]
  node_utilities["Sheet mapping utilities<br/>[Utilities.js]"]
end

subgraph group_insights["Analytics and exports"]
  node_smart["Spending insights<br/>[AiService.js]"]
  node_pdf["PDF report generation<br/>[PdfService.js]"]
  node_csv["CSV report export<br/>[PdfService.js]"]
end

subgraph group_platform["Google services"]
  node_config["Workspace configuration<br/>[Config.js]"]
  node_sheets[("Expense and registry sheets")]
  node_drive[("Drive uploads and exports")]
  node_gemini["Gemini API"]
end

node_user(("Employee or admin"))

node_user -->|"opens dashboard"| node_webapp
node_webapp -->|"serves page"| node_ui
node_auth -->|"reads registry"| node_authcache
node_authcache -->|"loads registry"| node_sheets
node_auth -->|"updates accounts"| node_sheets
node_auth -->|"sends welcome"| node_email
node_auth -->|"verifies session"| node_expenses
node_expenses -->|"reads and writes"| node_sheets
node_expenses -->|"stores receipts"| node_drive
node_expenses -.->|"maps columns"| node_utilities
node_authcache -->|"loads dropdowns"| node_sheets
node_expenses -->|"generates insight"| node_smart
node_smart -->|"fetches report"| node_expenses
node_smart -->|"requests audit or forecast"| node_gemini
node_pdf -->|"fetches report"| node_expenses
node_pdf -->|"saves PDF"| node_drive
node_csv -.->|"exports filtered data"| node_expenses

click node_webapp "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Code.js"
click node_ui "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Index.html"
click node_auth "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AuthService.js"
click node_authcache "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/CacheService.js"
click node_config "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Config.js"
click node_expenses "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/ExpenseService.js"
click node_utilities "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Utilities.js"
click node_smart "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AiService.js"
click node_pdf "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/PdfService.js"
click node_csv "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/PdfService.js"
click node_email "https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AuthService.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_webapp,node_ui toneBlue
class node_auth,node_authcache,node_email toneAmber
class node_expenses,node_utilities toneMint
class node_smart,node_pdf,node_csv toneRose
class node_config,node_sheets,node_drive,node_gemini,node_user toneIndigo
```

## Components

### Application entry

- [Dashboard serving](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Code.js): `Code.js`
- [Responsive expense UI](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Index.html): `Index.html`

### Access and lookup

- [Authentication and users](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AuthService.js): `AuthService.js`
- [Auth and dropdown cache](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/CacheService.js): `CacheService.js`
- [Account welcome email](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AuthService.js): `AuthService.js`

### Expense operations

- [Expense entry and reports](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/ExpenseService.js): `ExpenseService.js`
- [Sheet mapping utilities](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Utilities.js): `Utilities.js`

### Analytics and exports

- [Spending insights](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/AiService.js): `AiService.js`
- [PDF report generation](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/PdfService.js): `PdfService.js`
- [CSV report export](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/PdfService.js): `PdfService.js`

### Google services

- [Workspace configuration](https://github.com/senguptajeet/expenseapp-octo-memory/blob/main/Config.js): `Config.js`
- **Expense and registry sheets**
- **Drive uploads and exports**
- **Gemini API**

### Other components

- **Employee or admin**

## Connections

- Employee or admin → Dashboard serving: opens dashboard (evidence: `Code.js`)
- Dashboard serving → Responsive expense UI: serves page (evidence: `Code.js`)
- Authentication and users → Auth and dropdown cache: reads registry (evidence: `AuthService.js`)
- Auth and dropdown cache → Expense and registry sheets: loads registry (evidence: `CacheService.js`)
- Authentication and users → Expense and registry sheets: updates accounts (evidence: `AuthService.js`)
- Authentication and users → Account welcome email: sends welcome (evidence: `AuthService.js`)
- Authentication and users → Expense entry and reports: verifies session (evidence: `ExpenseService.js`)
- Expense entry and reports → Expense and registry sheets: reads and writes (evidence: `ExpenseService.js`)
- Expense entry and reports → Drive uploads and exports: stores receipts (evidence: `ExpenseService.js`)
- Expense entry and reports → Sheet mapping utilities: maps columns
- Auth and dropdown cache → Expense and registry sheets: loads dropdowns (evidence: `CacheService.js`)
- Expense entry and reports → Spending insights: generates insight (evidence: `ExpenseService.js`)
- Spending insights → Expense entry and reports: fetches report (evidence: `AiService.js`)
- Spending insights → Gemini API: requests audit or forecast (evidence: `AiService.js`)
- PDF report generation → Expense entry and reports: fetches report (evidence: `PdfService.js`)
- PDF report generation → Drive uploads and exports: saves PDF (evidence: `PdfService.js`)
- CSV report export → Expense entry and reports: exports filtered data
