# who1-dev/acs-project architecture

> Architecture diagram of the GitHub repository who1-dev/acs-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/who1-dev/acs-project
- Repository: https://github.com/who1-dev/acs-project

## Overview

##### Main Components
- Environments: The project segregates configurations into multiple environments (dev, staging, prod). Each environment has separate directories for compute and network resources.
- Compute and Network Modules: Under the “modules” folder, there are reusable Terraform configurations for compute and network. These modules encapsulate the repeated logic that each environment’s configuration uses.
- Environment Configurations: Each environment (dev, staging, prod) contains its own subfolders with Terraform configurations (e.g., main.tf, config.tf, variables.tf, outputs.tf) that refer to the modules and define environment-specific settings.
- CI/CD Workflows: The .github/workflows directory contains pipeline definitions (e.g., deploy.yml, tfsec.yml) that are likely used for automated deployment, linting, or security scanning.
- Terraform Backend Configuration: The README shows that the Terraform state is stored in an S3 bucket, which is a central backend component that the different environments reference.

##### Relationships and Interactions
- Both the compute and network configurations interact with the reusable modules (modules/compute and modules/network). This shows modularity and reuse within the architecture.
- The S3 bucket backend (as configured in config.tf and mentioned in the README) is a central resource that maintains the state, so it should be represented as a cross-cutting component linking all environments.

##### Important Architectural Patterns and Design Principles
- Modularity: The use of modules for network and compute ensures that infrastructure definitions are DRY (Don’t Repeat Yourself) and maintainable.
- Environment Separation: Different folders (dev, staging, prod) to isolate configurations and resources for each stage.
- Declarative Infrastructure: The entire system is managed by Terraform which emphasizes a declarative approach for infrastructure provisioning.
- CI/CD Integration: The existence of GitHub workflow configurations highlights the emphasis on continuous integration and continuous delivery processes.

##### Relevant Technologies and Tools
- Terraform: The primary tool used for provisioning infrastructure.
- GitHub Actions: Pipelines defined in the .github directory for deployment and security checks.
- AWS S3: Used as the backend store for Terraform state files.

## Diagram (Mermaid)

```mermaid
flowchart TD
    GH("GitHub Workflows"):::cicd
    S3("S3 Backend"):::backend
    CM("Compute Module"):::module
    NM("Network Module"):::module

    subgraph "Dev Environment"
        DNet("Dev Network"):::env
        DComp("Dev Compute"):::env
    end

    subgraph "Staging Environment"
        SNet("Staging Network"):::env
        SComp("Staging Compute"):::env
    end

    subgraph "Prod Environment"
        PNet("Prod Network"):::env
        PComp("Prod Compute"):::env
    end

    %% CI/CD triggers environments
    GH -->|"triggers"| DNet
    GH -->|"triggers"| SNet
    GH -->|"triggers"| PNet

    %% S3 Backend shared state connection to each environment's network
    S3 -->|"state"| DNet
    S3 -->|"state"| SNet
    S3 -->|"state"| PNet

    %% Within each environment, network provisions compute
    DNet -->|"provisions"| DComp
    SNet -->|"provisions"| SComp
    PNet -->|"provisions"| PComp

    %% Environment components refer to their modules
    DNet -->|"refers"| NM
    SNet -->|"refers"| NM
    PNet -->|"refers"| NM

    DComp -->|"refers"| CM
    SComp -->|"refers"| CM
    PComp -->|"refers"| CM

    %% Click Events
    click GH "https://github.com/who1-dev/acs-project/tree/main/.github/workflows"
    click DNet "https://github.com/who1-dev/acs-project/tree/main/dev/network"
    click DComp "https://github.com/who1-dev/acs-project/tree/main/dev/compute"
    click SNet "https://github.com/who1-dev/acs-project/tree/main/staging/network"
    click SComp "https://github.com/who1-dev/acs-project/tree/main/staging/compute"
    click PNet "https://github.com/who1-dev/acs-project/tree/main/prod/network"
    click PComp "https://github.com/who1-dev/acs-project/tree/main/prod/compute"
    click CM "https://github.com/who1-dev/acs-project/tree/main/modules/compute"
    click NM "https://github.com/who1-dev/acs-project/tree/main/modules/network"

    %% Styles
    classDef cicd fill:#cfe2ff,stroke:#0d6efd,stroke-width:2px
    classDef backend fill:#d1e7dd,stroke:#198754,stroke-width:2px
    classDef module fill:#fff3cd,stroke:#fd7e14,stroke-width:2px
    classDef env fill:#e2e3e5,stroke:#6c757d,stroke-width:2px
```
