# valyrian24052/tag architecture

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

- Interactive diagram: https://gitdiagram.com/valyrian24052/tag
- Repository: https://github.com/valyrian24052/tag

## Overview

##### Project type and purpose
- This is a full-stack, containerized Python web application (“Tag”), acting as a WIP AI personal assistant.
- The frontend is a simple Quart-served HTML/CSS interface; the backend is a Quart app in Python that calls Azure Cognitive Services (AI).
- Infrastructure is defined in Bicep files for Azure Container Apps, Container Registry, monitoring, and security roles.
- CI/CD is handled by GitHub workflows building, testing, and deploying the container.

##### File structure
- src/
- Dockerfile, .dockerignore, gunicorn.conf.py
- quartapp/ with chat.py, static/, templates/
- requirements.txt
- infra/
- main.bicep, parameters
- core/ai/cognitiveservices.bicep
- core/host/* (container-app, container-apps-environment, registry)
- core/monitor/loganalytics.bicep
- core/security (registry-access, role)
- docker-compose.yaml for local multi-container dev
- .devcontainer for VS Code remote dev
- GitHub workflows (.github/workflows) for lint, test, Azure Bicep validation, Docker build/deploy
- tests/ for pytest, snapshot tests of the chat streams

##### README
- Confirms it’s an AI personal assistant using “Tag” name.

##### Detail and essential elements
- Registry, Container-Apps-Environment, Security Role, Log Analytics, Cognitive Services.
- Separate concerns:
- Code (src/) vs. infra (infra/) vs. tests vs. CI vs. local dev.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% End User
    EndUser["End User Browser"]:::user
    click EndUser "https://github.com/valyrian24052/tag/blob/main/src/quartapp/templates/index.html"
    
    %% Application Layer
    subgraph "Container Apps Environment" 
        direction TB
        TagWebApp["Tag Web App<br/>(Quart + Gunicorn)"]:::app
        TagWebApp -->|"HTTP Request"| Cognitives
        TagWebApp -->|"Logs & Metrics"| LogAnalytics
    end
    click TagWebApp "https://github.com/valyrian24052/tag/tree/main/src/Dockerfile"
    click TagWebApp "https://github.com/valyrian24052/tag/blob/main/src/gunicorn.conf.py"
    click TagWebApp "https://github.com/valyrian24052/tag/blob/main/src/quartapp/chat.py"
    click TagWebApp "https://github.com/valyrian24052/tag/blob/main/src/quartapp/static/styles.css"
    click TagWebApp "https://github.com/valyrian24052/tag/blob/main/src/quartapp/templates/index.html"
    
    %% Azure Infra
    subgraph "Azure Infrastructure" 
        direction TB
        Registry["Azure Container Registry"]:::azure
        Env["Container Apps Environment"]:::azure
        Security["Security Roles & Registry Access"]:::azure
        Cognitives["Azure Cognitive Services"]:::azure
        LogAnalytics["Azure Log Analytics"]:::azure
    end
    click Registry "https://github.com/valyrian24052/tag/blob/main/infra/core/host/container-registry.bicep"
    click Env "https://github.com/valyrian24052/tag/blob/main/infra/core/host/container-apps-environment.bicep"
    click Security "https://github.com/valyrian24052/tag/blob/main/infra/core/security/registry-access.bicep"
    click Security "https://github.com/valyrian24052/tag/blob/main/infra/core/security/role.bicep"
    click Cognitives "https://github.com/valyrian24052/tag/blob/main/infra/core/ai/cognitiveservices.bicep"
    click LogAnalytics "https://github.com/valyrian24052/tag/blob/main/infra/core/monitor/loganalytics.bicep"
    click InfraRoot "https://github.com/valyrian24052/tag/blob/main/infra/main.bicep"
    click InfraRoot "https://github.com/valyrian24052/tag/blob/main/infra/main.parameters.json"
    
    %% CI/CD Pipeline
    subgraph "CI/CD & GitHub Actions" 
        direction TB
        Check["Lint & Test"]:::cicd
        BicepValidate["Bicep Validate"]:::cicd
        Deploy["Build & Deploy"]:::cicd
    end
    click Check "https://github.com/valyrian24052/tag/blob/main/.github/workflows/python-check.yaml"
    click BicepValidate "https://github.com/valyrian24052/tag/blob/main/.github/workflows/azure-bicep-validate.yaml"
    click Deploy "https://github.com/valyrian24052/tag/blob/main/.github/workflows/azure-dev.yaml"
    
    %% Developer & Local Dev
    subgraph "Developer Environment" 
        direction TB
        IDE["Local IDE"]:::dev
        DevContainer["Dev Container"]:::dev
        DockerCompose["docker-compose"]:::dev
    end
    click DevContainer "https://github.com/valyrian24052/tag/blob/main/.devcontainer/devcontainer.json"
    click DockerCompose "https://github.com/valyrian24052/tag/blob/main/docker-compose.yaml"
    
    %% Tests
    subgraph "Tests" 
        direction TB
        PyTest["pytest Tests"]:::test
        Snapshots["Snapshot Tests"]:::test
    end
    click PyTest "https://github.com/valyrian24052/tag/blob/main/tests/test_app.py"
    click PyTest "https://github.com/valyrian24052/tag/blob/main/tests/conftest.py"
    click Snapshots "https://github.com/valyrian24052/tag/tree/main/tests/snapshots/test_app/"
    
    %% Relationships
    EndUser -->|"HTTPS"| TagWebApp
    TagWebApp -->|"> calls AI endpoint"| Cognitives
    TagWebApp -->|"> logs to"| LogAnalytics
    Check -->|triggers| Deploy
    BicepValidate -->|validates| Deploy
    Deploy -->|pushes image| Registry
    Deploy -->|deploy| Env
    IDE -->|push code| Check
    DevContainer -->|run locally| DockerCompose
    DockerCompose -->|mocks infra| TagWebApp
    
    %% Styles
    classDef dev fill:#E8F0FE,stroke:#4285F4,color:#1A73E8;
    classDef cicd fill:#FFF4E5,stroke:#FBBC05,color:#BFA327;
    classDef azure fill:#E8F5E9,stroke:#34A853,color:#0F9D58;
    classDef app fill:#FCE8E6,stroke:#EA4335,color:#D93025;
    classDef user fill:#EDE7F6,stroke:#673AB7,color:#5E35B1;
    classDef test fill:#F3E5F5,stroke:#9C27B0,color:#8E24AA;
```
