# myselfsislam/qonnect-tool architecture

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

- Interactive diagram: https://gitdiagram.com/myselfsislam/qonnect-tool
- Repository: https://github.com/myselfsislam/qonnect-tool

## Overview

#### Purpose and Entry Points
This repository serves a small server-rendered search/lookup application, with data synchronized from Google Sheets into JSON and optional cache warming. The primary runtime entry point is `app.py`; the browser UI is rendered from `templates/` and enhanced by static assets. Supporting operational paths cover container deployment and SSL certificate renewal.

#### Application Server and Routes
`app.py` is the central application boundary: it likely owns HTTP routing, template rendering, data loading, search handling, and authentication/session behavior indicated by the available templates.

Key UI route surfaces are represented by:
- `templates/index.html`
- `templates/search.html`
- `templates/login.html`
- `templates/declare.html`

The application is server-rendered rather than a standalone client application. Search behavior is split between server responses and browser-side interaction.

#### Search Presentation Layer
The search experience is implemented through HTML templates plus a focused JavaScript asset:
- `templates/search.html`
- `templates/search_simple.html`
- `static/js/search.js`

`templates/search_backup.html` suggests an alternate or retained prior search view. Styling is centrally provided by `static/css/style.css`. The browser boundary should remain limited to presentation and user interaction; authoritative lookup data and access decisions belong in the Python application.

#### Sheet-to-JSON Data Ingestion
`sync_sheets_to_json.py` is the repository’s explicit data-ingestion stage. Its role is to pull source data from Google Sheets and materialize it as JSON for application consumption. This establishes Google Sheets as an external source of truth and JSON as the local application-facing data boundary.

Relevant paths:
- `sync_sheets_to_json.py`
- `app.py`
- `warm_cache_local.py`

The expected operational flow is: synchronize sheet data, load or cache the generated data in the app, then serve searches against that local representation rather than requiring a Sheets request for every browser interaction.

#### Cache Preparation
`warm_cache_local.py` provides a separate precomputation or local cache-population path. It is architecturally distinct from request handling: it can prepare data before traffic reaches `app.py`, reducing startup or first-request latency.

Relevant paths:
- `warm_cache_local.py`
- `sync_sheets_to_json.py`
- `app.py`

Any deployment scheduler or manual operational process should run synchronization/cache warming with clear ordering, since the cache is downstream of source data acquisition.

#### Container and GCP Deployment Boundary
The root container definition packages the primary application runtime:
- `Dockerfile`
- `app.py`
- `requirements.txt`

`GCP_ARCHITECTURE.md` documents the intended Google Cloud deployment architecture. Google Cloud is therefore a material infrastructure dependency, while Google Sheets is the material external data service. `.gcloudignore` controls what is included in Google Cloud deployment contexts.

#### SSL Renewal Sidecar/Operational Unit
Certificate renewal is isolated into its own deployable operational unit rather than embedded in the application container:
- `ssl-renewal/Dockerfile`
- `ssl-renewal/renew.sh`
- `SSL_CERTIFICATE_RENEWAL_REMINDER.md`

The separate `ssl-renewal/` subtree indicates independent lifecycle, scheduling, and permissions for certificate management. This separation protects the application runtime from certificate-renewal tooling and allows SSL operations to be deployed or executed independently.

Main entry points: [`app.py`](https://github.com/myselfsislam/qonnect-tool/blob/main/app.py) (Application server), [`templates/search.html`](https://github.com/myselfsislam/qonnect-tool/blob/main/templates/search.html) (Search views), [`sync_sheets_to_json.py`](https://github.com/myselfsislam/qonnect-tool/blob/main/sync_sheets_to_json.py) (Sheet synchronizer), [`templates/index.html`](https://github.com/myselfsislam/qonnect-tool/blob/main/templates/index.html) (App views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Browser UI"]
  node_browser(("Browser<br/>client"))
  node_search_ui["Search views<br/>server templates<br/>[search.html]"]
  node_other_views["App views<br/>server templates<br/>[index.html]"]
  node_search_js["Search interaction<br/>browser script<br/>[search.js]"]
  node_styles["Shared styling<br/>stylesheet<br/>[style.css]"]
end

subgraph group_runtime["Application Runtime"]
  node_app["Application server<br/>Python HTTP app<br/>[app.py]"]
end

subgraph group_dataops["Data Operations"]
  node_sheets[("Google Sheets<br/>external data source")]
  node_sync["Sheet synchronizer<br/>ingestion job"]
  node_json_data[("Local JSON data<br/>data boundary")]
  node_warm_cache["Cache warmer<br/>precomputation job"]
end

subgraph group_deploy["Deployment &amp; SSL"]
  node_app_container["Application container<br/>container image"]
  node_google_cloud{{"Google Cloud<br/>deployment platform"}}
  node_ssl_unit["SSL renewal unit<br/>operational container"]
  node_renew_script["Certificate renewal<br/>renewal script<br/>[renew.sh]"]
end

node_browser -->|"HTTP requests"| node_app
node_app -->|"renders"| node_search_ui
node_app -->|"renders"| node_other_views
node_search_ui -->|"loads"| node_search_js
node_search_ui -->|"uses"| node_styles
node_other_views -->|"uses"| node_styles
node_sync -->|"reads"| node_sheets
node_sync -->|"writes"| node_json_data
node_warm_cache -->|"prepares from"| node_json_data
node_app -->|"loads lookup data"| node_json_data
node_app_container -->|"packages"| node_app
node_google_cloud -->|"runs"| node_app_container
node_ssl_unit -->|"executes"| node_renew_script
node_google_cloud -.->|"operates independently"| node_ssl_unit

click node_search_ui "https://github.com/myselfsislam/qonnect-tool/blob/main/templates/search.html"
click node_other_views "https://github.com/myselfsislam/qonnect-tool/blob/main/templates/index.html"
click node_search_js "https://github.com/myselfsislam/qonnect-tool/blob/main/static/js/search.js"
click node_styles "https://github.com/myselfsislam/qonnect-tool/blob/main/static/css/style.css"
click node_app "https://github.com/myselfsislam/qonnect-tool/blob/main/app.py"
click node_sync "https://github.com/myselfsislam/qonnect-tool/blob/main/sync_sheets_to_json.py"
click node_warm_cache "https://github.com/myselfsislam/qonnect-tool/blob/main/warm_cache_local.py"
click node_app_container "https://github.com/myselfsislam/qonnect-tool/blob/main/Dockerfile"
click node_ssl_unit "https://github.com/myselfsislam/qonnect-tool/blob/main/ssl-renewal/Dockerfile"
click node_renew_script "https://github.com/myselfsislam/qonnect-tool/blob/main/ssl-renewal/renew.sh"

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_browser,node_search_ui,node_other_views,node_search_js,node_styles toneBlue
class node_app toneAmber
class node_sheets,node_sync,node_json_data,node_warm_cache toneMint
class node_app_container,node_google_cloud,node_ssl_unit,node_renew_script toneRose
```

## Components

### Browser UI

- **Browser**: client
- [Search views](https://github.com/myselfsislam/qonnect-tool/blob/main/templates/search.html): server templates · Search results and alternate search presentations. · `templates/search.html`
- [App views](https://github.com/myselfsislam/qonnect-tool/blob/main/templates/index.html): server templates · Index, login, and declaration pages. · `templates/index.html`
- [Search interaction](https://github.com/myselfsislam/qonnect-tool/blob/main/static/js/search.js): browser script · `static/js/search.js`
- [Shared styling](https://github.com/myselfsislam/qonnect-tool/blob/main/static/css/style.css): stylesheet · `static/css/style.css`

### Application Runtime

- [Application server](https://github.com/myselfsislam/qonnect-tool/blob/main/app.py): Python HTTP app · Owns routes, rendering, search, and access decisions. · `app.py`

### Data Operations

- **Google Sheets**: external data source · Source of truth for lookup data.
- [Sheet synchronizer](https://github.com/myselfsislam/qonnect-tool/blob/main/sync_sheets_to_json.py): ingestion job · Materializes sheet data for local application use. · `sync_sheets_to_json.py`
- **Local JSON data**: data boundary · Application-facing representation of synchronized sheet data.
- [Cache warmer](https://github.com/myselfsislam/qonnect-tool/blob/main/warm_cache_local.py): precomputation job · Prepares local data/cache before traffic. · `warm_cache_local.py`

### Deployment & SSL

- [Application container](https://github.com/myselfsislam/qonnect-tool/blob/main/Dockerfile): container image · Packages the Python application runtime. · `Dockerfile`
- **Google Cloud**: deployment platform
- [SSL renewal unit](https://github.com/myselfsislam/qonnect-tool/blob/main/ssl-renewal/Dockerfile): operational container · Independently renews certificates. · `ssl-renewal/Dockerfile`
- [Certificate renewal](https://github.com/myselfsislam/qonnect-tool/blob/main/ssl-renewal/renew.sh): renewal script · `ssl-renewal/renew.sh`

## Connections

- Browser → Application server: HTTP requests
- Application server → Search views: renders
- Application server → App views: renders
- Search views → Search interaction: loads
- Search views → Shared styling: uses
- App views → Shared styling: uses
- Sheet synchronizer → Google Sheets: reads
- Sheet synchronizer → Local JSON data: writes
- Cache warmer → Local JSON data: prepares from
- Application server → Local JSON data: loads lookup data
- Application container → Application server: packages
- Google Cloud → Application container: runs
- SSL renewal unit → Certificate renewal: executes
- Google Cloud → SSL renewal unit: operates independently
