# cpeggy/poa architecture

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

- Interactive diagram: https://gitdiagram.com/cpeggy/poa
- Repository: https://github.com/cpeggy/poa

## Overview

##### Project type and purpose
- From the file tree and README, this is a small, monolithic Python web application (likely Flask or a similar micro‐framework) that serves a simple web UI and proxies user queries to three external services:
- Google Custom Search API (requires API Key + Search Engine ID)
- Google Programmable Search Engine
- Google Gemini API
- There is no separate front-end repo or SPA; the entire UI and back-end live in docs/app.py, and dependencies are listed in requirements.txt.

##### File structure
- Top level files:
- .gitignore (standard VCS ignore file)
- README.md (instructions for API key setup and app usage)
- requirements.txt (Python library dependencies)
- docs/app.py: contains the entire web application code (routes, views, config pages, API-calling logic).
- No dedicated “static” or “templates” folders, so templates may be inlined or in docs/.
- No database folder or config, so the app is likely stateless and relies on environment/config variables for API keys.

##### README for additional insights
- The README walks users through obtaining three API credentials and then instructs them to input them via the app’s “API Settings” page.
- There is no mention of persistent storage, caching layer, or other microservices.

##### Elements
- Clear labels for each component and sub-component
- User → Web App (HTTP Request)
- Web App → External APIs (API calls)
- External APIs → Web App (API responses)
- Web App → Browser (rendered HTML/JSON)
- Hosting environment / Web App (e.g., blue container)

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["User Browser"]:::client
    server["Render.com Web Server"]:::webapp
    EnvVars["Environment Variables"]:::config

    subgraph "Monolithic Web App"
        MonolithicWebApp["Monolithic Web App"]:::webapp
        config["Configuration Handler"]:::sub
        routes["Routing"]:::sub
        api["API Client"]:::sub
        templ["Templating Engine"]:::sub
    end

    GCS["Google Custom Search API"]:::external
    GPSE["Google Programmable Search Engine"]:::external
    GMAI["Google Gemini API"]:::external

    Browser -->|"HTTP Request"| server
    server -->|"forwards Request"| routes
    EnvVars -->|"loads API keys"| config
    routes -->|"uses config"| config
    routes -->|"routes to handlers"| api
    routes -->|"routes to handlers"| templ
    api -->|"calls /search"| GCS
    api -->|"calls /search"| GPSE
    api -->|"calls /ai"| GMAI
    GCS -->|"response"| api
    GPSE -->|"response"| api
    GMAI -->|"response"| api
    templ -->|"renders response"| server
    server -->|"HTTP Response"| Browser

    click MonolithicWebApp "https://github.com/cpeggy/poa/blob/main/docs/app.py"
    click Dependencies "https://github.com/cpeggy/poa/blob/main/requirements.txt"
    click SetupGuide "https://github.com/cpeggy/poa/blob/main/README.md"
    click IgnoreRules "https://github.com/cpeggy/poa/blob/main/.gitignore"

    Dependencies["Dependency Definitions"]:::config
    SetupGuide["Setup and Configuration Guide"]:::config
    IgnoreRules["Version Control Ignore Rules"]:::config

    classDef client fill:#b3e5fc,stroke:#0288d1,color:#000;
    classDef webapp fill:#bbdefb,stroke:#1976d2,color:#000;
    classDef sub fill:#e3f2fd,stroke:#64b5f6,color:#000;
    classDef external fill:#ffe0b2,stroke:#fb8c00,color:#000;
    classDef config fill:#c8e6c9,stroke:#388e3c,color:#000;
```
