# yannik207/backend_infra_learning architecture

> Architecture diagram of the GitHub repository yannik207/backend_infra_learning, 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/yannik207/backend_infra_learning
- Repository: https://github.com/yannik207/backend_infra_learning

## Overview

##### Project type and purpose
- This is a small learning-focused backend + infra project: a Python webserver (in `webserver/`) backed by a PostgreSQL database, with all infrastructure managed via Terraform (in `infra/`). There is no front-end/UI—only an API server and its supporting infra.

##### File structure
Top-level:
- Dockerfile + build.sh + cloudbuild.yaml – container build & CI/CD
- infra/ – Terraform definitions to provision PostgreSQL API
- webserver/ – Python API code (entry point: `main.py`)
- pyproject.toml – Python dependencies/config

infra/ layout:
- main.tf + variables.tf – root Terraform configuration
- postgres_api/ – module defining Cloud SQL/Postgres and any API gateway or network
– api.tf, postgres.tf, workload.tf, variables.tf

##### README for additional insights
- Very brief: “just a learning project to become more familiar with backend and infra.”
- No explicit architecture docs; everything must be inferred.

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Developer & Version Control"
    Dev["Developer"]:::repo
    Git["Git Repository"]:::repo
    Config["pyproject.toml"]:::repo
  end
  Dev -->|"push code"| Git
  Git --> Config

  subgraph "CI/CD"
    CfgCI["cloudbuild.yaml"]:::cicd
    CB["Cloud Build"]:::cicd
    BuildScript["build.sh"]:::cicd
    DockerfileNode["Dockerfile"]:::cicd
    Registry["Container Registry"]:::cicd
  end
  Git -->|"trigger build"| CfgCI
  CfgCI --> CB
  CB -->|"invoke build.sh"| BuildScript
  CB -->|"use Dockerfile"| DockerfileNode
  CB -->|"push image"| Registry

  CB -->|"provision infra"| TF["Terraform"]:::infra

  subgraph "Infra Provisioning"
    TF
    subgraph "Postgres API Module"
      API["API Gateway & Network"]:::infra
      PGres["Cloud SQL Postgres"]:::infra
      WL["Workload Permissions"]:::infra
      VarM["Module Variables"]:::infra
    end
    TF --> API
    TF --> PGres
    TF --> WL
    TF --> VarM
  end

  Registry -->|"pull image"| Runtime["Cloud Run / GKE"]:::runtime

  subgraph "Runtime"
    WS["Python Webserver"]:::runtime
  end
  Runtime -->|"connect"| PGres

  classDef infra fill:#ADD8E6,stroke:#000;
  classDef cicd fill:#90EE90,stroke:#000;
  classDef runtime fill:#FFA500,stroke:#000;
  classDef repo fill:#D3D3D3,stroke:#000;

  click WS "https://github.com/yannik207/backend_infra_learning/blob/main/webserver/main.py"
  click WS "https://github.com/yannik207/backend_infra_learning/blob/main/webserver/__init__.py"
  click Config "https://github.com/yannik207/backend_infra_learning/blob/main/pyproject.toml"
  click DockerfileNode "https://github.com/yannik207/backend_infra_learning/tree/main/Dockerfile"
  click BuildScript "https://github.com/yannik207/backend_infra_learning/blob/main/build.sh"
  click CfgCI "https://github.com/yannik207/backend_infra_learning/blob/main/cloudbuild.yaml"
  click TF "https://github.com/yannik207/backend_infra_learning/blob/main/infra/main.tf"
  click VarM "https://github.com/yannik207/backend_infra_learning/blob/main/infra/variables.tf"
  click API "https://github.com/yannik207/backend_infra_learning/blob/main/infra/postgres_api/api.tf"
  click PGres "https://github.com/yannik207/backend_infra_learning/blob/main/infra/postgres_api/postgres.tf"
  click WL "https://github.com/yannik207/backend_infra_learning/blob/main/infra/postgres_api/workload.tf"
  click VarM "https://github.com/yannik207/backend_infra_learning/blob/main/infra/postgres_api/variables.tf"
```
