# sitevision/sitevision-apps architecture

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

- Interactive diagram: https://gitdiagram.com/sitevision/sitevision-apps
- Repository: https://github.com/sitevision/sitevision-apps

## Overview

This project is a monorepo for various Sitevision libraries and tools that support building Sitevision WebApps and RESTApps. The repository contains multiple interrelated packages such as an API library that offers both client and server utilities, babel presets for React on both client and server, ESLint configurations, a “create-sitevision-app” scaffolding tool, and a set of scripts (sitevision‑scripts) that cover build, deploy, testing, and other development tasks.

##### Overall Structure – The Monorepo
– API (located in packages/api)
– Babel Presets (react-client and react-server)
– Create Sitevision App (scaffolding tool)
– ESLint Configuration Packages (recommended, typescript, webapp-react)
– Sitevision Scripts (tooling and build/deploy utilities)

##### Main Components and Their Roles
- API Package:
– Inside this node, subdivide it to highlight its internal layers:
▪ Client Layer: Contains modules such as requester, toasts, etc.
▪ Common Layer: Offers shared functionality like events, router, security, app logic.
▪ Public API Layer: Exposes numerous server utilities (for example, ArchiveUtil, ChannelUtil, UserUtil, many other util modules).
▪ Server Layer: Includes modules related to server-side functions (like appData, headless, hooks, OAuth2, privileged operations, storage, AI integration, etc.).

- Babel Presets:
– Group together the babel-preset-react-client and babel-preset-react-server packages.

- Create-Sitevision-App Tool:
– Mark this package as a scaffolding or CLI tool that a developer would run to quickly bootstrap new Sitevision applications.
– Connect this tool with the API and configuration packages (indicating that generated apps will use the utilities provided by these libraries).

- ESLint and Prettier Configurations:
– Represent the various ESLint config packages (eslint-config-recommended, eslint-config-typescript, eslint-config-webapp-react) as configuration tools that help maintain code quality across the apps.
– These should be shown as supporting tools that feed into every package/application built within the monorepo.

- Sitevision Scripts:
– Display its responsibilities: building, deploying (with both production and development scripts), testing, signing, transpiling, and asset management.

##### Interactions and Data Flow
- Links from the build and deploy scripts (sitevision-scripts) toward project packaging, testing, and deployment – indicating automation.

##### Architectural Patterns and Technologies
- That the project uses Lerna for package management and Yarn (the .yarn folder and yarn releases indicate Yarn 4.5.0 is used).
- That the API package itself adheres to a modular design separating client, common, public API, and server utilities. This design enables reusability and clear separation of concerns.
- That the babel presets, ESLint configurations, and scripts are utility layers that help maintain consistency during development, testing, and production deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Developer
    Developer["Developer"]:::external

    %% Monorepo container
    subgraph "Sitevision Apps Monorepo"
        %% Create Sitevision App Tool
        CSA["Create Sitevision App"]:::cli

        %% API Package with internal layers
        subgraph "API Package"
            APIC_Client["API - Client Modules"]:::api
            APIC_Common["API - Common Modules"]:::api
            APIC_Public["API - Public API"]:::api
            APIC_Server["API - Server Utilities"]:::api
        end

        %% Babel Presets for React
        subgraph "Babel Presets for React"
            Babel_Client["react-client"]:::config
            Babel_Server["react-server"]:::config
        end

        %% ESLint Configuration Packages
        subgraph "ESLint Configurations"
            ESLint_Recommended["eslint-config-recommended"]:::config
            ESLint_Typescript["eslint-config-typescript"]:::config
            ESLint_WebappReact["eslint-config-webapp-react"]:::config
        end

        %% Sitevision Scripts Tooling
        SScript["Sitevision Scripts"]:::tool
    end

    %% External interactions
    Developer -->|"initiates"| CSA

    %% Interactions from Create Sitevision App to other components
    CSA -->|"integrates"| APIC_Public
    CSA -->|"uses"| Babel_Client
    CSA -->|"uses"| Babel_Server
    CSA -->|"includes"| ESLint_Recommended
    CSA -->|"includes"| ESLint_Typescript
    CSA -->|"includes"| ESLint_WebappReact

    %% Internal API Package relationships
    APIC_Client -->|"calls"| APIC_Public
    APIC_Public -->|"calls"| APIC_Server
    APIC_Client -->|"uses"| APIC_Common
    APIC_Server -->|"uses"| APIC_Common

    %% Sitevision Scripts orchestration
    SScript -->|"orchestrates"| APIC_Public
    SScript -->|"orchestrates"| Babel_Client
    SScript -->|"orchestrates"| Babel_Server
    SScript -->|"orchestrates"| ESLint_Recommended
    SScript -->|"orchestrates"| ESLint_Typescript
    SScript -->|"orchestrates"| ESLint_WebappReact

    %% Click Events for Component Mappings
    click APIC_Client "https://github.com/sitevision/sitevision-apps/tree/main/packages/api"
    click APIC_Common "https://github.com/sitevision/sitevision-apps/tree/main/packages/api"
    click APIC_Public "https://github.com/sitevision/sitevision-apps/tree/main/packages/api"
    click APIC_Server "https://github.com/sitevision/sitevision-apps/tree/main/packages/api"

    click Babel_Client "https://github.com/sitevision/sitevision-apps/tree/main/packages/babel-preset-react-client"
    click Babel_Server "https://github.com/sitevision/sitevision-apps/tree/main/packages/babel-preset-react-server"

    click CSA "https://github.com/sitevision/sitevision-apps/tree/main/packages/create-sitevision-app"

    click ESLint_Recommended "https://github.com/sitevision/sitevision-apps/tree/main/packages/eslint-config-recommended"
    click ESLint_Typescript "https://github.com/sitevision/sitevision-apps/tree/main/packages/eslint-config-typescript"
    click ESLint_WebappReact "https://github.com/sitevision/sitevision-apps/tree/main/packages/eslint-config-webapp-react"

    click SScript "https://github.com/sitevision/sitevision-apps/tree/main/packages/sitevision-scripts"

    %% Class Definitions for Colors
    classDef api fill:#f4cccc,stroke:#b45f06,stroke-width:2px;
    classDef config fill:#c9daf8,stroke:#073763,stroke-width:2px;
    classDef cli fill:#ead1dc,stroke:#b13045,stroke-width:2px;
    classDef tool fill:#d9ead3,stroke:#6aa84f,stroke-width:2px;
    classDef external fill:#fff2cc,stroke:#bf9000,stroke-width:2px;
```
