# juanjesusalejosillero/proyecto-integrado-asir architecture

> Architecture diagram of the GitHub repository juanjesusalejosillero/proyecto-integrado-asir, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/juanjesusalejosillero/proyecto-integrado-asir
- Repository: https://github.com/juanjesusalejosillero/proyecto-integrado-asir

## Overview

##### Project type and purpose
- This is a “serverless” static website deployment pipeline. It uses Hugo to generate a static site from Markdown, Terraform to provision AWS infrastructure, and GitHub Actions as a GitOps-style CI/CD engine. The result is a fully automated flow: on each push to the GitHub repo, the site is rebuilt and redeployed to AWS (S3 + CloudFront), all managed as code.

##### File structure
- Top-level items:
- .github/workflows/workflow.yaml → GitHub Actions CI/CD definition
- Terraform/ → contains IAM, S3, CloudFront, remote‐state, variables, providers definitions
- “Blog de Juanje”/ → Hugo site source (config.toml, archetypes, content, static assets, theme submodule)
- img/ → repository images (Diagrama.png, Portada.png)
- Patterns & conventions:
- Hugo’s default layout under “Blog de Juanje” follows its content → static → themes separation
- Terraform folder uses separate .tf files for each resource group (S3, CloudFront, state backend)

##### README for additional insights
- It explicitly lists AWS services (IAM, ACM, S3, CloudFront, AWS CLI), Terraform, Hugo, and GitHub Actions.
- The goal: on each commit, trigger a GitHub Action that runs Terraform (apply/plan), then Hugo build, then AWS CLI sync + CloudFront invalidation.
- Infrastructure resides in us-east-1 and uses remote state locking via Terraform backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer and Repository
    Dev["Developer Workstation"]:::developer
    Repo["GitHub Repository"]:::repo

    Dev -->|"push code"| Repo
    Repo -->|"on push"| Workflow

    %% CI/CD Engine
    Workflow["GitHub Actions Runner (CI/CD pipeline)"]:::ci

    %% Terraform (IaC) Subgraph
    subgraph "Terraform (IaC)" 
        Providers["Terraform Providers & Backend"]:::iac
        RemoteState["Terraform Remote-State Backend & Locking"]:::iac
        TFVars["Terraform Input Variables"]:::iac
        BucketTF["Terraform S3 Bucket Provisioning"]:::iac
        CFTF["Terraform CloudFront & ACM Certificate"]:::iac
    end

    %% Hugo SSG Subgraph
    subgraph "Hugo (Static Site Generator)"
        HugoConfig["Hugo Config (config.toml)"]:::hugo
        HugoContent["Hugo Content"]:::hugo
        HugoArch["Hugo Archetypes"]:::hugo
        HugoStatic["Hugo Static Assets"]:::hugo
        HugoTheme["Hugo Theme"]:::hugo
    end

    %% AWS Managed Services Subgraph
    subgraph "AWS Managed Services (us-east-1)"
        IAMCreds["AWS IAM Credentials"]:::aws
        S3BucketAWS["S3 Bucket: static-website"]:::aws
        DynamoDB["DynamoDB Table (State Locking)"]:::aws
        ACMCert["ACM Certificate"]:::aws
        CFDist["CloudFront Distribution"]:::aws
    end

    %% Operations Steps
    Sync["AWS CLI Sync (aws s3 sync)"]:::ops
    Invalidate["CloudFront Invalidation"]:::ops

    %% Flows
    Workflow -->|"terraform init/plan/apply"| Providers
    Workflow -->|"terraform init/plan/apply"| RemoteState
    Workflow -->|"terraform init/plan/apply"| TFVars
    Workflow -->|"terraform init/plan/apply"| BucketTF
    Workflow -->|"terraform init/plan/apply"| CFTF

    Providers -->|"uses AWS provider"| IAMCreds
    RemoteState -->|"remote-state backend"| S3BucketAWS
    RemoteState -->|"locking"| DynamoDB
    BucketTF -->|"provisions"| S3BucketAWS
    CFTF -->|"provisions"| CFDist
    CFTF -->|"provisions"| ACMCert

    Workflow -->|"hugo build --minify"| HugoConfig
    Workflow -->|"hugo build --minify"| HugoContent
    Workflow -->|"hugo build --minify"| HugoArch
    Workflow -->|"hugo build --minify"| HugoStatic
    Workflow -->|"hugo build --minify"| HugoTheme

    HugoTheme -->|"outputs public/ files"| Sync
    Sync -->|"deploy to bucket"| S3BucketAWS
    Sync -->|"trigger"| Invalidate
    Invalidate -->|"invalidate cache"| CFDist

    Workflow -->|"uses IAM creds"| IAMCreds

    %% Documentation & Assets
    README["Project Documentation (README.md)"]:::doc
    IMG["Repository Images"]:::doc

    Repo --> README
    Repo --> IMG

    %% Click Events
    click Workflow "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/.github/workflows/workflow.yaml"
    click Providers "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Terraform/providers.tf"
    click RemoteState "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Terraform/remote-state.tf"
    click TFVars "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Terraform/variables.tf"
    click BucketTF "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Terraform/bucket-s3.tf"
    click CFTF "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Terraform/cloudfront.tf"
    click HugoConfig "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/Blog de Juanje/config.toml"
    click HugoContent "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/tree/main/Blog de Juanje/content/"
    click HugoArch "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/tree/main/Blog de Juanje/archetypes/"
    click HugoStatic "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/tree/main/Blog de Juanje/static/"
    click HugoTheme "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/tree/main/Blog de Juanje/themes/"
    click README "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/blob/main/README.md"
    click IMG "https://github.com/juanjesusalejosillero/proyecto-integrado-asir/tree/main/img/"

    %% Styles
    classDef developer fill:#E0F7FA,stroke:#006064
    classDef repo fill:#BBDEFB,stroke:#0D47A1
    classDef ci fill:#C8E6C9,stroke:#1B5E20
    classDef iac fill:#FFF3E0,stroke:#E65100
    classDef hugo fill:#E1BEE7,stroke:#4A148C
    classDef aws fill:#E3F2FD,stroke:#0D47A1
    classDef ops fill:#FFE0B2,stroke:#E65100
    classDef doc fill:#F5F5F5,stroke:#616161
```
