# hirtik786/weather-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/hirtik786/weather-dashboard
- Repository: https://github.com/hirtik786/weather-dashboard

## Overview

This repository combines the README-described weather reporting dashboard with a backend product-management and marketplace-integration API. The main dashboard flow fetches fresh city weather or reads the latest cached snapshot, then renders metrics, charts, and a searchable table; separate pages inspect historical reports and configured cities. Product routes add authenticated catalog synchronization with Amazon and Sendbox. The README documents weather capabilities whose implementation is not sampled here; their nodes use paths confirmed by the tree, and uncertain internal wiring is omitted.

Main entry points: [`backend/server.js`](https://github.com/hirtik786/weather-dashboard/blob/main/backend/server.js) (Express application), [`backend/services/weatherService.js`](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/weatherService.js) (Weather fetching), [`backend/controllers/productController.js`](https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/productController.js) (Product operations), [`frontend/js/api.js`](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/api.js) (Weather API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_weather_ui["Weather experience"]
  node_dashboard["Dashboard view<br/>[app.js]"]
  node_reports_ui["Reports archive<br/>[reports.js]"]
  node_cities_ui["City directory<br/>[cities.js]"]
  node_weather_api_client["Weather API client<br/>[api.js]"]
  node_reports_archive["Historical reports<br/>[reports.js]"]
end

subgraph group_weather_backend["Weather services"]
  node_weather_routes["Weather routes<br/>[weatherRoutes.js]"]
  node_weather_controller["Weather controller"]
  node_weather_service["Weather fetching<br/>[weatherService.js]"]
  node_city_data["City coordinates<br/>[cities.js]"]
  node_weather_codes["Weather mapping<br/>[weatherCode.js]"]
  node_redis_service["Cache and reports<br/>[redisService.js]"]
  node_redis_store[("Redis<br/>[redis.js]")]
  node_server["Express application<br/>[server.js]"]
end

subgraph group_accounts_catalog["Accounts and catalog"]
  node_auth_ui["Account interface<br/>[auth.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_auth_controller["Authentication handlers<br/>[authController.js]"]
  node_auth_middleware["User authentication<br/>[authMiddleware.js]"]
  node_products_ui["Product interface<br/>[products.js]"]
  node_product_routes["Product routes<br/>[productRoutes.js]"]
  node_product_controller["Product operations"]
  node_product_model["Product records<br/>[productModel.js]"]
  node_integration_model["Sync records"]
end

subgraph group_commerce_integrations["Marketplace integrations"]
  node_sync_service["Product synchronizer"]
  node_amazon_service["Amazon adapter<br/>[amazonService.js]"]
  node_sendbox_service["Sendbox adapter<br/>[sendboxService.js]"]
end

node_visitor(("Dashboard user"))
node_open_meteo["Open-Meteo API"]
node_amazon_external["Amazon services"]
node_sendbox_external["Sendbox services"]

node_visitor -->|"views or refreshes"| node_dashboard
node_visitor -->|"opens reports"| node_reports_ui
node_visitor -->|"browses cities"| node_cities_ui
node_dashboard -->|"requests weather"| node_weather_api_client
node_reports_ui -->|"requests reports"| node_weather_api_client
node_cities_ui -->|"requests cities"| node_weather_api_client
node_weather_api_client -->|"sends REST requests"| node_server
node_server -->|"mounts routes"| node_weather_routes
node_weather_routes -->|"dispatches requests"| node_weather_controller
node_weather_controller -->|"fetches fresh data"| node_weather_service
node_weather_service -->|"requests forecasts"| node_open_meteo
node_weather_service -->|"uses city coordinates"| node_city_data
node_weather_service -->|"maps conditions"| node_weather_codes
node_weather_controller -->|"reads and saves"| node_redis_service
node_redis_service -->|"reads and writes"| node_redis_store
node_redis_service -->|"supplies snapshots"| node_reports_archive
node_auth_ui -->|"sends auth requests"| node_server
node_server -->|"mounts routes"| node_auth_routes
node_auth_routes -->|"dispatches requests"| node_auth_controller
node_products_ui -->|"sends product requests"| node_server
node_server -->|"mounts routes"| node_product_routes
node_product_routes -->|"protects routes"| node_auth_middleware
node_product_routes -->|"dispatches requests"| node_product_controller
node_product_controller -->|"manages products"| node_product_model
node_product_controller -->|"reads integration state"| node_integration_model
node_product_controller -->|"requests synchronization"| node_sync_service
node_sync_service -.->|"syncs listings"| node_amazon_service
node_sync_service -.->|"syncs fulfillment"| node_sendbox_service
node_amazon_service -.->|"calls marketplace API"| node_amazon_external
node_sendbox_service -.->|"calls shipping API"| node_sendbox_external

click node_dashboard "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/app.js"
click node_reports_ui "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/reports.js"
click node_cities_ui "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/cities.js"
click node_weather_api_client "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/api.js"
click node_weather_routes "https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/weatherRoutes.js"
click node_weather_controller "https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/weatherController.js"
click node_weather_service "https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/weatherService.js"
click node_city_data "https://github.com/hirtik786/weather-dashboard/blob/main/backend/data/cities.js"
click node_weather_codes "https://github.com/hirtik786/weather-dashboard/blob/main/backend/utils/weatherCode.js"
click node_redis_service "https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/redisService.js"
click node_redis_store "https://github.com/hirtik786/weather-dashboard/blob/main/backend/config/redis.js"
click node_reports_archive "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/reports.js"
click node_auth_ui "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/auth.js"
click node_auth_routes "https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/authController.js"
click node_auth_middleware "https://github.com/hirtik786/weather-dashboard/blob/main/backend/middleware/authMiddleware.js"
click node_products_ui "https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/products.js"
click node_product_routes "https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/productRoutes.js"
click node_product_controller "https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/productController.js"
click node_product_model "https://github.com/hirtik786/weather-dashboard/blob/main/backend/models/productModel.js"
click node_integration_model "https://github.com/hirtik786/weather-dashboard/blob/main/backend/models/productIntegrationModel.js"
click node_sync_service "https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/productSyncService.js"
click node_amazon_service "https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/amazon/amazonService.js"
click node_sendbox_service "https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/sendbox/sendboxService.js"
click node_server "https://github.com/hirtik786/weather-dashboard/blob/main/backend/server.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_dashboard,node_reports_ui,node_cities_ui,node_weather_api_client,node_reports_archive,node_visitor toneBlue
class node_weather_routes,node_weather_controller,node_weather_service,node_city_data,node_weather_codes,node_redis_service,node_redis_store,node_server toneAmber
class node_auth_ui,node_auth_routes,node_auth_controller,node_auth_middleware,node_products_ui,node_product_routes,node_product_controller,node_product_model,node_integration_model,node_open_meteo toneMint
class node_sync_service,node_amazon_service,node_sendbox_service toneRose
class node_amazon_external,node_sendbox_external toneIndigo
```

## Components

### Weather experience

- [Dashboard view](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Reports archive](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/reports.js): `frontend/js/reports.js`
- [City directory](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/cities.js): `frontend/js/cities.js`
- [Weather API client](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Historical reports](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/reports.js): `frontend/js/reports.js`

### Weather services

- [Weather routes](https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/weatherRoutes.js): `backend/routes/weatherRoutes.js`
- [Weather controller](https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/weatherController.js): `backend/controllers/weatherController.js`
- [Weather fetching](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/weatherService.js): `backend/services/weatherService.js`
- [City coordinates](https://github.com/hirtik786/weather-dashboard/blob/main/backend/data/cities.js): `backend/data/cities.js`
- [Weather mapping](https://github.com/hirtik786/weather-dashboard/blob/main/backend/utils/weatherCode.js): `backend/utils/weatherCode.js`
- [Cache and reports](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/redisService.js): `backend/services/redisService.js`
- [Redis](https://github.com/hirtik786/weather-dashboard/blob/main/backend/config/redis.js): `backend/config/redis.js`
- [Express application](https://github.com/hirtik786/weather-dashboard/blob/main/backend/server.js): `backend/server.js`

### Accounts and catalog

- [Account interface](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/auth.js): `frontend/js/auth.js`
- [Authentication routes](https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication handlers](https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [User authentication](https://github.com/hirtik786/weather-dashboard/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Product interface](https://github.com/hirtik786/weather-dashboard/blob/main/frontend/js/products.js): `frontend/js/products.js`
- [Product routes](https://github.com/hirtik786/weather-dashboard/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Product operations](https://github.com/hirtik786/weather-dashboard/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product records](https://github.com/hirtik786/weather-dashboard/blob/main/backend/models/productModel.js): `backend/models/productModel.js`
- [Sync records](https://github.com/hirtik786/weather-dashboard/blob/main/backend/models/productIntegrationModel.js): `backend/models/productIntegrationModel.js`

### Marketplace integrations

- [Product synchronizer](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/productSyncService.js): `backend/services/productSyncService.js`
- [Amazon adapter](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/amazon/amazonService.js): `backend/services/amazon/amazonService.js`
- [Sendbox adapter](https://github.com/hirtik786/weather-dashboard/blob/main/backend/services/sendbox/sendboxService.js): `backend/services/sendbox/sendboxService.js`

### Other components

- **Dashboard user**
- **Open-Meteo API**
- **Amazon services**
- **Sendbox services**

## Connections

- Dashboard user → Dashboard view: views or refreshes
- Dashboard user → Reports archive: opens reports
- Dashboard user → City directory: browses cities
- Dashboard view → Weather API client: requests weather
- Reports archive → Weather API client: requests reports
- City directory → Weather API client: requests cities
- Weather API client → Express application: sends REST requests
- Express application → Weather routes: mounts routes
- Weather routes → Weather controller: dispatches requests
- Weather controller → Weather fetching: fetches fresh data
- Weather fetching → Open-Meteo API: requests forecasts
- Weather fetching → City coordinates: uses city coordinates
- Weather fetching → Weather mapping: maps conditions
- Weather controller → Cache and reports: reads and saves
- Cache and reports → Redis: reads and writes
- Cache and reports → Historical reports: supplies snapshots
- Account interface → Express application: sends auth requests
- Express application → Authentication routes: mounts routes
- Authentication routes → Authentication handlers: dispatches requests
- Product interface → Express application: sends product requests
- Express application → Product routes: mounts routes
- Product routes → User authentication: protects routes
- Product routes → Product operations: dispatches requests
- Product operations → Product records: manages products
- Product operations → Sync records: reads integration state
- Product operations → Product synchronizer: requests synchronization
- Product synchronizer → Amazon adapter: syncs listings
- Product synchronizer → Sendbox adapter: syncs fulfillment
- Amazon adapter → Amazon services: calls marketplace API
- Sendbox adapter → Sendbox services: calls shipping API
