# waynegoosen/azure-streamlit-poc architecture

> Architecture diagram of the GitHub repository waynegoosen/azure-streamlit-poc, 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/waynegoosen/azure-streamlit-poc
- Repository: https://github.com/waynegoosen/azure-streamlit-poc

## Overview

##### Project type and purpose
- This is a full-stack proof-of-concept (PoC) web application built with Python’s Streamlit framework, containerized with Docker, deployed and hosted on Microsoft Azure, and managed end-to-end via GitHub Actions and Terraform.
- Purpose: Provide a boilerplate for a self-hosted, access-controlled Streamlit app on Azure with automated build/deploy workflows.

##### File structure
- Top-level:
- .devcontainer/ – VS Code Dev Container configuration
- .github/workflows/ – GitHub Actions CI/CD pipelines
- app/ – the Streamlit application, including its Dockerfile and Python code
- infra/ – Terraform code and helper scripts to provision Azure resources
- Patterns:
- Single container micro-application (Streamlit)
- GitOps style: code → GitHub Actions → container registry + Terraform → Azure
- Key config files:
- app/Dockerfile
- infra/*.tf (providers.tf, main.tf, web-app.tf, variables.tf, locals.tf)
- GitHub Actions YAML files for Docker image build/push and Terraform plan/apply/destroy

##### README for additional insights
- Architecture overview mentions:
- Interactive web-based frontend
- Python-based backend (same container)
- GitHub Container Registry (GHCR) for storing images
- Hosting on Azure App Service
- Deployment via GitHub Actions
- Technology stack: Python, Streamlit, Docker, Terraform, Azure, GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Layer
    subgraph "Developer Environment"
        DevContainer["Dev Container (VS Code + Docker)"]:::developer
        GitHubRepo["GitHub Repository"]:::developer
    end

    %% CI/CD Layer
    subgraph "CI/CD Pipelines"
        GCIBuild["GitHub Actions: Docker Build & Publish"]:::cicd
        TerraformPlan["GitHub Actions: Terraform Plan/Apply"]:::cicd
        TerraformDestroy["GitHub Actions: Terraform Destroy"]:::cicd
    end

    %% Registry
    GHCR["GHCR (ghcr.io)"]:::registry

    %% Azure Infrastructure
    subgraph "Azure Subscription / Resource Group"
        ServicePrincipal["Azure AD Service Principal"]:::infra
        StorageAccount["Storage Account (logs/state)"]:::infra
        AppServicePlan["App Service Plan"]:::infra
        WebApp["App Service (Container)"]:::infra
    end

    %% End User
    EndUser["End User Browser"]:::user

    %% Flow Connections
    DevContainer -->|"push code"| GitHubRepo
    GitHubRepo -->|"triggers on push"| GCIBuild
    GitHubRepo -->|"triggers on push"| TerraformPlan
    GCIBuild -->|"build & publish image"| GHCR
    TerraformPlan -->|"provision infra"| ServicePrincipal
    ServicePrincipal -->|"auth with SP creds"| TerraformPlan
    TerraformPlan -->|"configures Web App to pull image"| WebApp
    GHCR -->|"container image"| WebApp
    EndUser -->|"HTTPS request"| WebApp

    %% Click Events
    click DevContainer "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/.devcontainer/devcontainer.json"
    click GitHubRepo "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/README.md"
    click GCIBuild "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/.github/workflows/docker-image-build-and-push.yml"
    click TerraformPlan "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/.github/workflows/terraform-plan-apply.yml"
    click TerraformDestroy "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/.github/workflows/terraform-destroy.yml"
    click GHCR "https://github.com/waynegoosen/azure-streamlit-poc/tree/main/images/"
    click WebApp "https://github.com/waynegoosen/azure-streamlit-poc/tree/main/app/Dockerfile"
    click ServicePrincipal "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/infra/scripts/credential.json"
    click StorageAccount "https://github.com/waynegoosen/azure-streamlit-poc/blob/main/infra/scripts/initialize.sh"

    %% Styles
    classDef developer fill:#D0E8FF,stroke:#000,stroke-width:1px
    classDef cicd fill:#FFD8B0,stroke:#000,stroke-width:1px
    classDef registry fill:#E0BBE4,stroke:#000,stroke-width:1px
    classDef infra fill:#C8E6C9,stroke:#000,stroke-width:1px
    classDef user fill:#E0E0E0,stroke:#000,stroke-width:1px
```
