# caias/monorepo-temp architecture

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

- Interactive diagram: https://gitdiagram.com/caias/monorepo-temp
- Repository: https://github.com/caias/monorepo-temp

## Overview

##### Project Type Analysis
This is a monorepo project using Yarn Berry (indicated by .yarnrc.yml and .yarn directory) with multiple Next.js applications and shared resources. The project appears to be a frontend-focused monorepo with shared configurations and UI components.

##### Main Components

A. Applications Layer:
- next-latest
- next (Pages Router)
- next15
Each should be represented as a distinct service container

B. Shared Resources Layer:
- UI Component Library (libs/ui)
- Configuration Modules:
- TypeScript configs
- ESLint configs

C. Infrastructure Layer:
- SST (Serverless Stack) configuration
- Environment management
- Build and deployment workflows

**┌─────────────┐  ┌─────────────┐  ┌─────────────┐**
- next-latest │  │    next     │  │   next15    │
- ┘  └─────────────┘  └─────────────┘
- ↓               ↓               ↓
- ┴───────────────┘
- ↓

**┌─────────────────────────────────────┐**
- Shared UI Lib            │
- ┤
- Flex Components │ Text Components   │
- ┘

**┌─────────────────────────────────────┐**
- Infrastructure Layer         │
- ┬──────────────────────┤
- SST Config  │   GitHub Actions     │
- ┴──────────────────────┘

##### Specific Elements

- Blue: Next.js applications
- Green: Shared UI components
- Yellow: Configuration modules
- Gray: Infrastructure components

b. Connection Types:

c. Labels and Annotations:
- Version information for Next.js apps
- Shared component categories
- Configuration scope indicators

##### Important Details to Highlight

- Monorepo Package Management:
- Yarn Berry workspace relationships
- Turborepo pipeline connections

- Environment Configuration:
- Three environment setups (dev/qa/prod)
- SST integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef app fill:#3498db,stroke:#2980b9,color:white
    classDef shared fill:#2ecc71,stroke:#27ae60,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef env fill:#e74c3c,stroke:#c0392b,color:white

    %% Applications Layer
    subgraph Apps
        NextLatest["Next.js Latest App"]:::app
        NextPages["Next.js Pages Router"]:::app
        Next15["Next.js 15"]:::app
    end

    %% Shared Resources Layer
    subgraph SharedResources
        subgraph UILib["UI Component Library"]
            FlexComp["Flex Components"]:::shared
            TextComp["Text Components"]:::shared
            UIUtils["UI Utilities"]:::shared
        end

        subgraph Configs["Configuration Modules"]
            ESLint["ESLint Config"]:::config
            TSConfig["TypeScript Config"]:::config
        end
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        SST["SST Configuration"]:::infra
        GHActions["GitHub Actions"]:::infra
        
        subgraph EnvConfig["Environment Configuration"]
            DevEnv["Development"]:::env
            QAEnv["QA"]:::env
            ProdEnv["Production"]:::env
        end
    end

    %% Package Management
    YarnConfig["Yarn Configuration"]:::config
    TurboConfig["Turbo Configuration"]:::config

    %% Relationships
    NextLatest & NextPages & Next15 --> UILib
    UILib --> FlexComp & TextComp & UIUtils
    Apps --> Configs
    Apps --> EnvConfig
    Infrastructure --> Apps
    YarnConfig --> Apps
    TurboConfig --> Apps

    %% Click Events
    click NextLatest "https://github.com/caias/monorepo-temp/tree/main/apps/next-latest"
    click NextPages "https://github.com/caias/monorepo-temp/tree/main/apps/next"
    click Next15 "https://github.com/caias/monorepo-temp/tree/main/apps/next15"
    click UILib "https://github.com/caias/monorepo-temp/tree/main/libs/ui"
    click FlexComp "https://github.com/caias/monorepo-temp/tree/main/libs/ui/src/Flex"
    click TextComp "https://github.com/caias/monorepo-temp/tree/main/libs/ui/src/Text"
    click UIUtils "https://github.com/caias/monorepo-temp/tree/main/libs/ui/src/utils"
    click ESLint "https://github.com/caias/monorepo-temp/tree/main/config/eslint"
    click TSConfig "https://github.com/caias/monorepo-temp/tree/main/config/typescript"
    click SST "https://github.com/caias/monorepo-temp/blob/main/sst.config.ts"
    click GHActions "https://github.com/caias/monorepo-temp/blob/main/.github/workflows/test-deploy.yaml"
    click DevEnv "https://github.com/caias/monorepo-temp/blob/main/envs/.env.dev"
    click QAEnv "https://github.com/caias/monorepo-temp/blob/main/envs/.env.qa"
    click ProdEnv "https://github.com/caias/monorepo-temp/blob/main/envs/.env.prod"
    click YarnConfig "https://github.com/caias/monorepo-temp/blob/main/.yarnrc.yml"
    click TurboConfig "https://github.com/caias/monorepo-temp/blob/main/turbo.json"

    %% Legend
    subgraph Legend
        L1["Application"]:::app
        L2["Shared Component"]:::shared
        L3["Configuration"]:::config
        L4["Infrastructure"]:::infra
        L5["Environment"]:::env
    end
```
