# shreyasawankar/shreyas-capstone-project-gms architecture

> Architecture diagram of the GitHub repository shreyasawankar/shreyas-capstone-project-gms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreyasawankar/shreyas-capstone-project-gms
- Repository: https://github.com/shreyasawankar/shreyas-capstone-project-gms

## Overview

This is a Go Grocery Management API: clients authenticate, then create, browse, update, or delete grocery records; product images can be uploaded with thumbnails. Bulk CSV upload is a separate ingestion path that stores a file and publishes its URL for processing into grocery records. Firestore holds grocery data, while Pub/Sub is used for bulk and audit messages. The tree and sampled handlers support the main CRUD, image, and bulk flows; wiring for some unsampled handlers and background consumers is not established here.

Main entry points: [`main.go`](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/main.go) (HTTP routes), [`functions/updateItem.go`](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/updateItem.go) (Update item), [`functions/createItems.go`](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createItems.go) (Create item), [`functions/clients.go`](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/clients.go) (Cloud clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and authentication"]
  node_router["HTTP routes<br/>[main.go]"]
  node_login["Login<br/>[login.go]"]
  node_logout["Logout<br/>[logout.go]"]
  node_verify["Token verification<br/>[verifyToken.go]"]
end

subgraph group_grocery["Grocery management"]
  node_create["Create item<br/>[createItems.go]"]
  node_list["List groceries<br/>[listGrocery.go]"]
  node_get["Get item<br/>[getItemById.go]"]
  node_update["Update item<br/>[updateItem.go]"]
  node_delete["Delete item<br/>[deleteItem.go]"]
  node_product["Product model<br/>[groceryModel.go]"]
end

subgraph group_bulk["Bulk ingestion"]
  node_bulk_upload["Bulk upload API"]
  node_bulk_process["CSV processor<br/>[createBulk.go]"]
  node_bulk_store["Bulk record storage<br/>[createBulk.go]"]
end

subgraph group_cloud["Cloud services"]
  node_clients["Cloud clients<br/>[clients.go]"]
  node_firestore[("Firestore")]
  node_storage[("Cloud Storage")]
  node_pubsub["Pub/Sub topics"]
  node_upload["File upload helper<br/>[uploadFile.go]"]
  node_thumbnail["Thumbnail generation"]
  node_audit["Audit records"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_router
node_router -->|"routes login"| node_login
node_router -->|"routes logout"| node_logout
node_router -->|"routes create"| node_create
node_router -->|"routes list"| node_list
node_router -->|"routes lookup"| node_get
node_router -->|"routes update"| node_update
node_router -->|"routes delete"| node_delete
node_router -->|"routes upload"| node_bulk_upload
node_login -->|"uses clients"| node_clients
node_create -->|"verifies token"| node_verify
node_bulk_upload -->|"verifies token"| node_verify
node_update -->|"verifies token"| node_verify
node_create -->|"binds product"| node_product
node_create -->|"writes product"| node_firestore
node_create -->|"uploads image"| node_upload
node_create -->|"generates thumbnail"| node_thumbnail
node_list -->|"queries products"| node_firestore
node_list -->|"decodes products"| node_product
node_get -->|"reads product"| node_firestore
node_update -->|"reads and writes"| node_firestore
node_update -->|"binds product"| node_product
node_update -->|"uploads image"| node_upload
node_update -->|"generates thumbnail"| node_thumbnail
node_update -->|"publishes audit"| node_pubsub
node_delete -->|"deletes product"| node_firestore
node_bulk_upload -->|"stores CSV"| node_upload
node_bulk_upload -->|"publishes file URL"| node_pubsub
node_bulk_process -->|"passes CSV records"| node_bulk_store
node_bulk_process -->|"reads grocery data"| node_firestore
node_bulk_store -->|"writes products"| node_firestore
node_upload -->|"writes files"| node_storage
node_thumbnail -->|"stores thumbnail"| node_storage
node_clients -->|"initializes client"| node_firestore
node_clients -->|"initializes client"| node_storage
node_clients -->|"initializes client"| node_pubsub
node_clients -->|"initializes logging"| node_audit

click node_router "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/main.go"
click node_login "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/login.go"
click node_logout "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/logout.go"
click node_verify "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/verifyToken.go"
click node_create "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createItems.go"
click node_list "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/listGrocery.go"
click node_get "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/getItemById.go"
click node_update "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/updateItem.go"
click node_delete "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/deleteItem.go"
click node_product "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/models/groceryModel.go"
click node_bulk_upload "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulkUpload.go"
click node_bulk_process "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulk.go"
click node_bulk_store "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulk.go"
click node_clients "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/clients.go"
click node_upload "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/uploadFile.go"
click node_thumbnail "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/generateThumbnail.go"
click node_audit "https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/storeAuditRecords.go"

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_router,node_login,node_logout,node_verify,node_client toneBlue
class node_create,node_list,node_get,node_update,node_delete,node_product toneAmber
class node_bulk_upload,node_bulk_process,node_bulk_store toneMint
class node_clients,node_firestore,node_storage,node_pubsub,node_upload,node_thumbnail,node_audit toneRose
```

## Components

### API and authentication

- [HTTP routes](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/main.go): `main.go`
- [Login](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/login.go): `functions/login.go`
- [Logout](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/logout.go): `functions/logout.go`
- [Token verification](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/verifyToken.go): `functions/verifyToken.go`

### Grocery management

- [Create item](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createItems.go): `functions/createItems.go`
- [List groceries](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/listGrocery.go): `functions/listGrocery.go`
- [Get item](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/getItemById.go): `functions/getItemById.go`
- [Update item](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/updateItem.go): `functions/updateItem.go`
- [Delete item](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/deleteItem.go): `functions/deleteItem.go`
- [Product model](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/models/groceryModel.go): `models/groceryModel.go`

### Bulk ingestion

- [Bulk upload API](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulkUpload.go): `functions/createBulkUpload.go`
- [CSV processor](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulk.go): `functions/createBulk.go`
- [Bulk record storage](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/createBulk.go): `functions/createBulk.go`

### Cloud services

- [Cloud clients](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/clients.go): `functions/clients.go`
- **Firestore**
- **Cloud Storage**
- **Pub/Sub topics**
- [File upload helper](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/uploadFile.go): `functions/uploadFile.go`
- [Thumbnail generation](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/generateThumbnail.go): `functions/generateThumbnail.go`
- [Audit records](https://github.com/shreyasawankar/shreyas-capstone-project-gms/blob/master/functions/storeAuditRecords.go): `functions/storeAuditRecords.go`

### Other components

- **API client**

## Connections

- API client → HTTP routes: sends requests
- HTTP routes → Login: routes login
- HTTP routes → Logout: routes logout
- HTTP routes → Create item: routes create
- HTTP routes → List groceries: routes list
- HTTP routes → Get item: routes lookup
- HTTP routes → Update item: routes update
- HTTP routes → Delete item: routes delete
- HTTP routes → Bulk upload API: routes upload
- Login → Cloud clients: uses clients
- Create item → Token verification: verifies token
- Bulk upload API → Token verification: verifies token
- Update item → Token verification: verifies token
- Create item → Product model: binds product
- Create item → Firestore: writes product
- Create item → File upload helper: uploads image
- Create item → Thumbnail generation: generates thumbnail
- List groceries → Firestore: queries products
- List groceries → Product model: decodes products
- Get item → Firestore: reads product
- Update item → Firestore: reads and writes
- Update item → Product model: binds product
- Update item → File upload helper: uploads image
- Update item → Thumbnail generation: generates thumbnail
- Update item → Pub/Sub topics: publishes audit
- Delete item → Firestore: deletes product
- Bulk upload API → File upload helper: stores CSV
- Bulk upload API → Pub/Sub topics: publishes file URL
- CSV processor → Bulk record storage: passes CSV records
- CSV processor → Firestore: reads grocery data
- Bulk record storage → Firestore: writes products
- File upload helper → Cloud Storage: writes files
- Thumbnail generation → Cloud Storage: stores thumbnail
- Cloud clients → Firestore: initializes client
- Cloud clients → Cloud Storage: initializes client
- Cloud clients → Pub/Sub topics: initializes client
- Cloud clients → Audit records: initializes logging
