# minhlk/nuxt-s3-deployment architecture

> Architecture diagram of the GitHub repository minhlk/nuxt-s3-deployment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minhlk/nuxt-s3-deployment
- Repository: https://github.com/minhlk/nuxt-s3-deployment

## Overview

##### Main Components

A. Frontend Layer:
- Nuxt.js Application (SSR/SSG)
- Components structure
- Vue layouts and pages

B. Infrastructure Layer:
- CloudFront Distribution
- S3 Bucket (Static hosting)
- API Gateway (planned)
- GitHub Actions (CI/CD)
- IAM/OIDC (Authentication)

**[Client Tier]**
- ↓ ↑
**[Distribution Tier]**
- ↓ ↑
**[Storage/Compute Tier]**

##### Specific Component Relationships

**Users → CloudFront → S3 Bucket (static assets)**
- → API Gateway (for /api routes)

##### Deployment Flow Section
**GitHub Actions → OIDC → AWS → S3/CloudFront**

##### Key Elements to Emphasize

a. Frontend Architecture:
- Nuxt.js application structure
- Separation between pages, components, and stores
- Server API endpoint (/server/api)

b. AWS Infrastructure:
- CloudFront distribution serving as the main entry point
- S3 bucket for static asset hosting
- Future Route53 integration (marked as planned)
- API Gateway integration (marked as planned)

c. DevOps Flow:
- GitHub Actions workflows for deployment
- OIDC authentication flow
- Environment-specific deployments (dev/prod)

Create distinct sections for:

##### Important Notes

- Environment indicators (dev/prod)
- Configuration references (cloudfront-s3.yml)
- Docker container boundary (Dockerfile present)

##### Technical Details

- Nuxt.js SSR/SSG configuration
- API endpoints structure
- S3 bucket configuration
- CloudFront distribution settings
- GitHub Actions workflow paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        User((User))
    end

    subgraph "AWS Infrastructure"
        CF[CloudFront]:::aws
        S3[(S3 Bucket)]:::aws
        APIG["API Gateway<br/>(Planned)"]:::planned
        R53["Route53<br/>(Planned)"]:::planned
    end

    subgraph "Nuxt.js Application"
        NX[Nuxt.js SSR/SSG]:::app
        subgraph "Frontend Components"
            COMP[Components]:::frontend
            PAGES[Pages]:::frontend
            LAYOUT[Layouts]:::frontend
            STORE[Store Management]:::frontend
        end
        subgraph "Server Components"
            API[API Endpoints]:::backend
        end
        APP[Application Entry]:::app
    end

    subgraph "CI/CD Pipeline"
        GHA[GitHub Actions]:::cicd
        OIDC{{"IAM/OIDC<br/>Auth"}}:::security
        SCAN[CodeQL Security<br/>Scanning]:::security
        DOCKER[Docker Container]:::cicd
    end

    %% Relationships
    User --> R53
    R53 -.-> CF
    User --> CF
    CF --> S3
    CF --> APIG
    APIG -.-> API
    
    NX --> APP
    APP --> COMP
    APP --> PAGES
    APP --> LAYOUT
    APP --> STORE
    APP --> API

    GHA --> OIDC
    OIDC --> CF
    OIDC --> S3
    GHA --> DOCKER
    GHA --> SCAN

    %% Click Events
    click NX "https://github.com/minhlk/nuxt-s3-deployment/blob/main/app/nuxt.config.ts"
    click COMP "https://github.com/minhlk/nuxt-s3-deployment/tree/main/app/components/"
    click STORE "https://github.com/minhlk/nuxt-s3-deployment/blob/main/app/stores/color.ts"
    click LAYOUT "https://github.com/minhlk/nuxt-s3-deployment/blob/main/app/layouts/default.vue"
    click PAGES "https://github.com/minhlk/nuxt-s3-deployment/tree/main/app/pages/"
    click API "https://github.com/minhlk/nuxt-s3-deployment/tree/main/app/server/api/"
    click CF "https://github.com/minhlk/nuxt-s3-deployment/blob/main/infra/cloudfront-s3.yml"
    click GHA "https://github.com/minhlk/nuxt-s3-deployment/blob/main/.github/workflows/deploy-frontend.yml"
    click DOCKER "https://github.com/minhlk/nuxt-s3-deployment/tree/main/Dockerfile"
    click SCAN "https://github.com/minhlk/nuxt-s3-deployment/blob/main/.github/workflows/codeql.yml"
    click APP "https://github.com/minhlk/nuxt-s3-deployment/blob/main/app/app.vue"

    %% Styles
    classDef aws fill:#FF9900,stroke:#232F3E,color:white
    classDef app fill:#00DC82,stroke:#00B368,color:white
    classDef frontend fill:#41B883,stroke:#34495E,color:white
    classDef backend fill:#3498DB,stroke:#2980B9,color:white
    classDef cicd fill:#2ECC71,stroke:#27AE60,color:white
    classDef security fill:#9B59B6,stroke:#8E44AD,color:white
    classDef planned stroke-dasharray: 5 5

    %% Legend
    subgraph Legend
        L1[AWS Services]:::aws
        L2[Application]:::app
        L3[Frontend]:::frontend
        L4[Backend]:::backend
        L5[CI/CD]:::cicd
        L6[Security]:::security
        L7[Planned]:::planned
    end
```
