# m10rten/suite architecture

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

- Interactive diagram: https://gitdiagram.com/m10rten/suite
- Repository: https://github.com/m10rten/suite

## Overview

##### Main Components

a. Package Layer:
- Node Packages (grouped by functionality)
- Data Validation (@mvdlei/tzod, @mvdlei/zod-query)
- Web Utilities (@mvdlei/web, @mvdlei/edge)
- React Hooks (@mvdlei/hooks)
- Infrastructure (@mvdlei/env, @mvdlei/log)
- Security (@mvdlei/key)
- Error Handling (@mvdlei/iglo)
- Feature Management (@mvdlei/pg-toggle)

b. Applications Layer:
- App (Next.js)
- API Service
- Link Service
- Internal Templates

c. Services Layer:
- gRPC Services
- Reyn Event System
- Database Services (PostgreSQL)

##### Relationships to Highlight

- Package Dependencies:
- Shared utilities and types
- Application Dependencies:
- Which applications consume which packages
- External service integrations

**┌─────────────────────────────────────────────────────────────┐**
- Applications Layer                       │
- ┬───────────────┬──────────────┬─────────────┤
- Showcase App │   Link App    │   API App    │  Internal   │
- (Next.js)   │  (Next.js)    │  (Vercel)    │  Templates  │
- ┬───────┴───────┬───────┴──────┬───────┴─────────────┘

**┌───────▼───────────────▼──────────────▼────────────────────┐**
- Package Layer                           │
- ┬─────────────┬────────────┬────────────────┤
- Web Utilities│    React    │   Data     │  Infrastructure│
- (@mvdlei/web)│   Hooks     │ Validation │    & Utils     │
- ┬───────┴─────────────┴────────────┴────────┬───────┘

**┌──────▼───────────────────────────────────────────▼───────┐**
- Services Layer                         │
- ┬──────────────────┬────────────────────┬─┤
- gRPC Services │   Reyn Events    │  PostgreSQL DB     │ │
- ┴──────────────────┴────────────────────┴─┘

##### Additional Elements

- Version information for major components
- External dependencies and integrations
- Deployment environments (Vercel, etc.)

##### Technical Details

- Database connections (PostgreSQL)
- Authentication flows
- API endpoints and routes
- Build and deployment pipelines
- Testing infrastructure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Applications Layer"
        ShowcaseApp["Showcase App (Next.js)"]
        LinkApp["Link App (Next.js)"]
        APIApp["API App (Vercel)"]
        InternalTemplates["Internal Templates"]
    end

    subgraph "Package Layer"
        subgraph "Data Validation"
            Tzod["@mvdlei/tzod"]
            ZodQuery["@mvdlei/zod-query"]
        end

        subgraph "Web Utilities"
            WebPkg["@mvdlei/web"]
            EdgePkg["@mvdlei/edge"]
        end

        subgraph "Core Packages"
            Hooks["@mvdlei/hooks"]
            Env["@mvdlei/env"]
            Log["@mvdlei/log"]
            Key["@mvdlei/key"]
            Iglo["@mvdlei/iglo"]
            PgToggle["@mvdlei/pg-toggle"]
        end
    end

    subgraph "Services Layer"
        GRPC["gRPC Services"]
        Reyn["Reyn Event System"]
        Database["PostgreSQL DB"]
    end

    subgraph "Infrastructure"
        BuildConfig["Build Configuration"]
        WorkspaceConfig["Workspace Config"]
        CICD["CI/CD Workflows"]
        Docker["Docker Config"]
    end

    %% Application Dependencies
    ShowcaseApp --> WebPkg
    ShowcaseApp --> Hooks
    LinkApp --> WebPkg
    LinkApp --> Database
    APIApp --> EdgePkg
    APIApp --> Tzod

    %% Package Dependencies
    WebPkg --> Env
    EdgePkg --> Log
    PgToggle --> Database
    Tzod --> Iglo
    ZodQuery --> Tzod

    %% Service Connections
    GRPC --> Database
    Reyn --> GRPC
    
    %% Infrastructure Connections
    BuildConfig --> ShowcaseApp
    BuildConfig --> LinkApp
    BuildConfig --> APIApp
    Docker --> Database
    CICD --> BuildConfig

    %% Click Events
    click ShowcaseApp "https://github.com/m10rten/suite/tree/main/apps/showcase"
    click APIApp "https://github.com/m10rten/suite/tree/main/apps/api"
    click LinkApp "https://github.com/m10rten/suite/tree/main/apps/link"
    click InternalTemplates "https://github.com/m10rten/suite/tree/main/apps/internal/_template"
    click Tzod "https://github.com/m10rten/suite/tree/main/packages/tzod"
    click ZodQuery "https://github.com/m10rten/suite/tree/main/packages/zod-query"
    click WebPkg "https://github.com/m10rten/suite/tree/main/packages/web"
    click EdgePkg "https://github.com/m10rten/suite/tree/main/packages/edge"
    click Hooks "https://github.com/m10rten/suite/tree/main/packages/hooks"
    click Env "https://github.com/m10rten/suite/tree/main/packages/env"
    click Log "https://github.com/m10rten/suite/tree/main/packages/log"
    click Key "https://github.com/m10rten/suite/tree/main/packages/key"
    click Iglo "https://github.com/m10rten/suite/tree/main/packages/iglo"
    click PgToggle "https://github.com/m10rten/suite/tree/main/packages/pg-toggle"
    click GRPC "https://github.com/m10rten/suite/tree/main/services/grpc"
    click Reyn "https://github.com/m10rten/suite/tree/main/services/reyn"
    click Database "https://github.com/m10rten/suite/tree/main/apps/link/src/prisma"
    click BuildConfig "https://github.com/m10rten/suite/blob/main/turbo.json"
    click WorkspaceConfig "https://github.com/m10rten/suite/blob/main/pnpm-workspace.yaml"
    click CICD "https://github.com/m10rten/suite/tree/main/.github/workflows"
    click Docker "https://github.com/m10rten/suite/blob/main/docker-compose.yaml"

    %% Styling
    classDef app fill:#90EE90,stroke:#333,stroke-width:2px
    classDef package fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef service fill:#FFD700,stroke:#333,stroke-width:2px
    classDef infrastructure fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef security fill:#FFB6C1,stroke:#333,stroke-width:2px

    class ShowcaseApp,LinkApp,APIApp,InternalTemplates app
    class Tzod,ZodQuery,WebPkg,EdgePkg,Hooks,Env,Log,Iglo,PgToggle package
    class GRPC,Reyn,Database service
    class BuildConfig,WorkspaceConfig,CICD,Docker infrastructure
    class Key security
```
