# nandha172/static-site-infra-aquatrivy-githubactions architecture

> Architecture diagram of the GitHub repository nandha172/static-site-infra-aquatrivy-githubactions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nandha172/static-site-infra-aquatrivy-githubactions
- Repository: https://github.com/nandha172/static-site-infra-aquatrivy-githubactions

## Overview

##### Project Type and Purpose
- This is an Infrastructure-as-Code project that uses Terraform to provision and deploy a static website (index.html, style.css, app.js) to AWS S3 behind a CloudFront CDN.
- The GitHub repo holds Terraform modules (`modules/s3-cloudfront`) and environment-specific configs (`envs/dev`), plus a GitHub Actions workflow to automate deployments.

##### File Structure
- Top level:
- `.github/workflows/static-site-githubactions.yml` → CI/CD pipeline
- `app.js`, `index.html`, `style.css` → front-end assets
- `modules/s3-cloudfront/` → reusable Terraform module defining S3 + CloudFront
- `envs/dev/` → environment-specific Terraform code (backend.tf, main.tf, provider.tf, outputs.tf, variables.tf, tfplan)
- Patterns:
- “modules” folder → Terraform module pattern
- “envs/dev” → separate IaC workspace/environment
- CI/CD integration via GitHub Actions

##### Extract Additional Insights from the README
- The README title (“My-Second-Terraform_project”) confirms the repo’s focus on Terraform.

##### Main Components & Relationships
a. Components
1. GitHub Repository
2. GitHub Actions CI/CD
3. Terraform (envs/dev workspace)
4. Terraform Module (s3-cloudfront)
5. AWS Account
– S3 Bucket (static site hosting)
– CloudFront Distribution (CDN)
6. Internet / End Users
b. Interactions
- Developer → pushes code → GitHub repo
- GitHub Actions → triggers on push → invokes Terraform init/plan/apply (using envs/dev)
- Terraform → calls `modules/s3-cloudfront` → provisions S3 bucket & CloudFront
- CI/CD → uploads `index.html`, `style.css`, `app.js` to S3
- End user → DNS → CloudFront → fetches from S3
c. Architectural Patterns
- Infrastructure as Code (Terraform modules + environments)
- Modular design: reusable module for S3 + CloudFront
- CI/CD pipeline for automated provisioning & deployment
d. Key Technologies
- Terraform (HCL)
- AWS: S3, CloudFront
- GitHub Actions for CI/CD

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source & Pipeline
    subgraph "Source & Pipeline"
        GitHubRepo["GitHub Repository"]:::code
        StaticAssets["Front-End Assets"]:::code
        GithubActions["GitHub Actions CI/CD"]:::code
    end

    %% Infrastructure as Code
    subgraph "Infrastructure as Code" 
        Terraform["Terraform (envs/dev)"]:::iac
        Module["Terraform Module: s3-cloudfront"]:::iac
    end

    %% AWS Cloud Infrastructure
    subgraph "AWS Cloud Infrastructure"
        S3["AWS S3 Bucket"]:::aws
        CF["AWS CloudFront Distribution"]:::aws
    end

    %% Clients
    Internet["End Users / Internet"]:::client

    %% Connections
    GitHubRepo -->|"push code"| GithubActions
    GitHubRepo --> StaticAssets
    StaticAssets -->|"picked by pipeline"| GithubActions
    GithubActions -->|"terraform init/plan/apply"| Terraform
    Terraform -->|"calls module: s3-cloudfront"| Module
    Module -->|"provisions"| S3
    Module -->|"provisions"| CF
    GithubActions -->|"upload assets"| S3
    Internet -->|"HTTP GET"| CF
    CF -->|"fetch from"| S3

    %% Click Events
    click GitHubRepo "https://github.com/nandha172/static-site-infra-aquatrivy-githubactions/blob/main/README.md"
    click StaticAssets "https://github.com/nandha172/static-site-infra-aquatrivy-githubactions/blob/main/index.html"
    click GithubActions "https://github.com/nandha172/static-site-infra-aquatrivy-githubactions/blob/main/.github/workflows/static-site-githubactions.yml"
    click Terraform "https://github.com/nandha172/static-site-infra-aquatrivy-githubactions/blob/main/envs/dev/main.tf"
    click Module "https://github.com/nandha172/static-site-infra-aquatrivy-githubactions/blob/main/modules/s3-cloudfront/main.tf"

    %% Styles
    classDef code fill:#cdeffd,stroke:#036,stroke-width:1px
    classDef iac fill:#d5f5d5,stroke:#093,stroke-width:1px
    classDef aws fill:#ffe5b4,stroke:#f80,stroke-width:1px
    classDef client fill:#f2f2f2,stroke:#999,stroke-width:1px
```
