# kushalsingh2003/cloudmart architecture

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

- Interactive diagram: https://gitdiagram.com/kushalsingh2003/cloudmart
- Repository: https://github.com/kushalsingh2003/cloudmart

## Overview

CloudMart is a serverless e-commerce application with an admin web dashboard. The main workflow is an API request through authorization to product or order handling and MySQL; order and low-stock events support notifications, while a scheduled report function exports sales data to S3. The dashboard also reads application data directly. The README documents the broader AWS layout and capabilities; sampled code confirms selected database access and initialization details, but not all runtime wiring.

Main entry points: [`cloudformation/data-stack.yaml`](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/data-stack.yaml) (RDS MySQL), [`cloudformation/application-stack.yaml`](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml) (API Gateway), [`lambdas/report/lambda_function.py`](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/report/lambda_function.py) (Sales report function), [`lambdas/authorizer/lambda_function.py`](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/authorizer/lambda_function.py) (Request authorizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and commerce"]
  node_gateway{{"API Gateway"}}
  node_auth["Request authorizer<br/>[lambda_function.py]"]
  node_products["Product operations<br/>[lambda_function.py]"]
  node_orders["Order operations<br/>[lambda_function.py]"]
end

subgraph group_data["Data services"]
  node_database[("RDS MySQL<br/>[data-stack.yaml]")]
  node_dbinit["Schema initializer<br/>[lambda_function.py]"]
  node_parameters[("Parameter Store")]
end

subgraph group_reporting["Reporting and alerts"]
  node_scheduler(("Report scheduler"))
  node_reports["Sales report function<br/>[lambda_function.py]"]
  node_reportbucket[("Reports bucket")]
  node_events["EventBridge"]
  node_notifications{{"SNS notifications"}}
end

subgraph group_dashboard["Admin dashboard"]
  node_webapp["Flask dashboard<br/>[app.py]"]
  node_charts["Dashboard charts<br/>[dashboard.js]"]
  node_visualization["3D visualization<br/>[cloudmart-3d.js]"]
end

node_shopper(("API client"))
node_email(("Email subscriber"))
node_admin(("Dashboard admin"))

node_shopper -->|"sends requests"| node_gateway
node_gateway -->|"authorizes"| node_auth
node_gateway -->|"routes product requests"| node_products
node_gateway -->|"routes order requests"| node_orders
node_auth -->|"checks customer records"| node_database
node_products -->|"manages products"| node_database
node_orders -->|"manages orders and stock"| node_database
node_dbinit -->|"initializes schema"| node_database
node_scheduler -->|"triggers daily report"| node_reports
node_reports -->|"reads sales data"| node_database
node_reports -->|"uploads CSV reports"| node_reportbucket
node_events -->|"dispatches low-stock events"| node_notifications
node_notifications -->|"sends notifications"| node_email
node_admin -->|"uses dashboard"| node_webapp
node_webapp -->|"queries dashboard data"| node_database

click node_gateway "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_auth "https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/authorizer/lambda_function.py"
click node_products "https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/product/lambda_function.py"
click node_orders "https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/order/lambda_function.py"
click node_database "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/data-stack.yaml"
click node_dbinit "https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/db_init/lambda_function.py"
click node_parameters "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_scheduler "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_reports "https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/report/lambda_function.py"
click node_reportbucket "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_events "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_notifications "https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml"
click node_webapp "https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/app.py"
click node_charts "https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/static/js/dashboard.js"
click node_visualization "https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/static/js/cloudmart-3d.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_gateway,node_auth,node_products,node_orders,node_shopper toneBlue
class node_database,node_dbinit,node_parameters toneAmber
class node_scheduler,node_reports,node_reportbucket,node_events,node_notifications toneMint
class node_webapp,node_charts,node_visualization toneRose
class node_email,node_admin toneIndigo
```

## Components

### API and commerce

- [API Gateway](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`
- [Request authorizer](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/authorizer/lambda_function.py): `lambdas/authorizer/lambda_function.py`
- [Product operations](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/product/lambda_function.py): `lambdas/product/lambda_function.py`
- [Order operations](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/order/lambda_function.py): `lambdas/order/lambda_function.py`

### Data services

- [RDS MySQL](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/data-stack.yaml): `cloudformation/data-stack.yaml`
- [Schema initializer](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/db_init/lambda_function.py): `lambdas/db_init/lambda_function.py`
- [Parameter Store](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`

### Reporting and alerts

- [Report scheduler](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`
- [Sales report function](https://github.com/kushalsingh2003/cloudmart/blob/main/lambdas/report/lambda_function.py): `lambdas/report/lambda_function.py`
- [Reports bucket](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`
- [EventBridge](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`
- [SNS notifications](https://github.com/kushalsingh2003/cloudmart/blob/main/cloudformation/application-stack.yaml): `cloudformation/application-stack.yaml`

### Admin dashboard

- [Flask dashboard](https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/app.py): `dashboard/app.py`
- [Dashboard charts](https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/static/js/dashboard.js): `dashboard/static/js/dashboard.js`
- [3D visualization](https://github.com/kushalsingh2003/cloudmart/blob/main/dashboard/static/js/cloudmart-3d.js): `dashboard/static/js/cloudmart-3d.js`

### Other components

- **API client**
- **Email subscriber**
- **Dashboard admin**

## Connections

- API client → API Gateway: sends requests (evidence: `README.md`)
- API Gateway → Request authorizer: authorizes (evidence: `README.md`)
- API Gateway → Product operations: routes product requests (evidence: `README.md`)
- API Gateway → Order operations: routes order requests (evidence: `README.md`)
- Request authorizer → RDS MySQL: checks customer records (evidence: `README.md`)
- Product operations → RDS MySQL: manages products (evidence: `README.md`)
- Order operations → RDS MySQL: manages orders and stock (evidence: `README.md`)
- Schema initializer → RDS MySQL: initializes schema (evidence: `lambdas/db_init/lambda_function.py`)
- Report scheduler → Sales report function: triggers daily report (evidence: `README.md`)
- Sales report function → RDS MySQL: reads sales data (evidence: `README.md`)
- Sales report function → Reports bucket: uploads CSV reports (evidence: `README.md`)
- EventBridge → SNS notifications: dispatches low-stock events (evidence: `README.md`)
- SNS notifications → Email subscriber: sends notifications (evidence: `README.md`)
- Dashboard admin → Flask dashboard: uses dashboard (evidence: `README.md`)
- Flask dashboard → RDS MySQL: queries dashboard data (evidence: `dashboard/app.py`)
