# johan-smal/dev-portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/johan-smal/dev-portfolio
- Repository: https://github.com/johan-smal/dev-portfolio

## Overview

##### Main Components

A. Frontend Layer:
- Static Assets (HTML, CSS, JS)
- HTMX for dynamic interactions
- TailwindCSS + DaisyUI for styling
- React/TSX templates for component structure

B. Infrastructure Layer:
- AWS Lambda for serverless compute
- API Gateway for request handling
- S3 for static file hosting
- Route53 for DNS management
- CloudFront (implied by the infrastructure setup)

C. Build/Development Layer:
- LocalStack for local development
- esbuild for bundling
- Terraform for infrastructure management

**Rectangle with rounded corners: AWS Services**
**Hexagons: Build tools**
**Rectangles: Application components**
**Diamonds: External services/tools**

##### Component Relationships to Highlight

**Client Browser**
- ↓ ↑
**CloudFront**
- ↓ ↑
**API Gateway ←→ Lambda Function (Hono.js Server)**
- ↓ ↑               ↓
**Route53          S3 Bucket (Static Assets)**

##### Important Architectural Patterns to Emphasize

- Serverless Architecture
- JAMstack approach (JavaScript, APIs, Markup)
- Infrastructure as Code
- Component-based frontend structure

Create three main sections:

##### Additional Notes

- Version/technology badges where relevant
- Separation between local development and production environments
- Role of Terraform in managing infrastructure

Remember to include annotations for:
- Security groups and IAM roles
- Environment variables and configuration
- Build and deployment workflows
- Local development setup with LocalStack

This will provide a complete picture of both the runtime architecture and the development experience.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Production["Production Environment"]
        direction TB
        Client[Client Browser]
        CF[CloudFront Distribution]
        R53["Route 53 DNS"]:::aws
        AG["API Gateway"]:::aws
        Lambda["Lambda Function"]:::aws
        S3["S3 Bucket"]:::aws
        
        Client --> CF
        CF --> R53
        CF --> AG
        CF --> S3
        AG --> Lambda
        Lambda --> S3
    end

    subgraph Development["Development Environment"]
        direction TB
        LS["LocalStack"]:::dev
        DevEnv["Local Dev Server"]:::dev
        DevBrowser["Development Browser"]:::dev
        
        DevBrowser --> DevEnv
        DevEnv --> LS
    end

    subgraph BuildDeploy["Build & Deploy Pipeline"]
        direction TB
        TF["Terraform IaC"]:::infra
        ESBuild["esBuild Bundler"]:::build
        
        subgraph FrontendAssets["Frontend Layer"]
            direction TB
            Static["Static Assets"]:::frontend
            Templates["React/TSX Templates"]:::frontend
            Components["Component Library"]:::frontend
            Pages["Page Components"]:::frontend
            Routes["Application Routes"]:::frontend
            Styles["TailwindCSS + DaisyUI"]:::frontend
            Entry["Application Entry"]:::frontend
        end
        
        ESBuild --> Production
        TF --> Production
    end

    %% Component Mappings
    click Static "https://github.com/Johan-smal/dev-portfolio/tree/master/public"
    click Templates "https://github.com/Johan-smal/dev-portfolio/tree/master/src/templates"
    click Components "https://github.com/Johan-smal/dev-portfolio/tree/master/src/templates/components"
    click Pages "https://github.com/Johan-smal/dev-portfolio/tree/master/src/templates/pages"
    click Routes "https://github.com/Johan-smal/dev-portfolio/tree/master/src/routes"
    click Styles "https://github.com/Johan-smal/dev-portfolio/blob/master/tailwind.config.js"
    click Entry "https://github.com/Johan-smal/dev-portfolio/blob/master/src/index.ts"
    click Lambda "https://github.com/Johan-smal/dev-portfolio/blob/master/infra/lambda.tf"
    click AG "https://github.com/Johan-smal/dev-portfolio/blob/master/infra/gateway.tf"
    click S3 "https://github.com/Johan-smal/dev-portfolio/blob/master/infra/s3.tf"
    click R53 "https://github.com/Johan-smal/dev-portfolio/blob/master/infra/custom_domain/route53.tf"
    click LS "https://github.com/Johan-smal/dev-portfolio/blob/master/docker-compose.yaml"
    click TF "https://github.com/Johan-smal/dev-portfolio/blob/master/main.tf"

    %% Styling
    classDef aws fill:#FF9900,stroke:#232F3E,color:white
    classDef frontend fill:#3B82F6,stroke:#1D4ED8,color:white
    classDef dev fill:#10B981,stroke:#065F46,color:white
    classDef infra fill:#8B5CF6,stroke:#5B21B6,color:white
    classDef build fill:#6B7280,stroke:#374151,color:white

    %% Legend
    subgraph Legend
        direction TB
        L1["AWS Services"]:::aws
        L2["Frontend Components"]:::frontend
        L3["Development Tools"]:::dev
        L4["Infrastructure as Code"]:::infra
        L5["Build Tools"]:::build
    end
```
