# favger/layerhub-io architecture

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

- Interactive diagram: https://gitdiagram.com/favger/layerhub-io
- Repository: https://github.com/favger/layerhub-io

## Overview

##### Project type and purpose
- This is a frontend-centric monorepo (managed by pnpm/turborepo) that provides a core “canvas & design engine,” object definitions, download utilities, and React/Vue wrappers, together with three demo applications (Next.js, React SPA, Vue SPA). Its purpose is to enable interactive design editing (graphics, text, video, presentation) in multiple frameworks.

##### File structure
- Top-level: pnpm-workspace.yaml, turbo.json, lockfiles – defines a monorepo.
- packages/
- core: the rendering & editing engine (controllers, parsers, state, utils)
- objects: a library of static object classes (Background, Image, Text, Video, etc.)
- downloader: asset-download utility
- react: React bindings for core (hooks, context, canvas component)
- vue: Vue plugin/wrapper for core
- types: shared TypeScript definitions
- apps/
- next-editor: Next.js demo with SSR/CSR pages, API route, custom components, contexts & hooks
- react-editor: React SPA demo (webpack + Nginx config), Redux store slices for editor state, services (Pixabay, Pexels)
- vue-editor: Vue 3 SPA demo (Vite config), single-file components (App.vue, Editor.vue)

##### README
- Confirms a monorepo setup: “pnpm i”, “pnpm build”, “pnpm dev” per app.
- No backend or database – purely client libraries & example apps.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Infrastructure
    Root["Monorepo Root\n(pnpm & Turbo)"]:::infra

    %% Packages Cluster
    subgraph "Packages"
        Core["Core Engine\n(packages/core)"]:::core
        Objects["Objects Library\n(packages/objects)"]:::core
        Downloader["Downloader Utility\n(packages/downloader)"]:::core
        ReactPkg["React Bindings\n(packages/react)"]:::framework
        VuePkg["Vue Plugin\n(packages/vue)"]:::framework
        TypesPkg["Shared Types\n(packages/types)"]:::core
    end

    %% Apps Cluster
    subgraph "Demo Applications"
        NextApp["Next.js Editor\n(apps/next-editor)"]:::app
        ReactApp["React SPA Editor\n(apps/react-editor)"]:::app
        VueApp["Vue SPA Editor\n(apps/vue-editor)"]:::app
    end

    %% External Services
    Pixabay["Pixabay API"]:::external
    Pexels["Pexels API"]:::external

    %% Build-time relationships
    Root -->|build-time| Core
    Root -->|build-time| Objects
    Root -->|build-time| Downloader
    Root -->|build-time| ReactPkg
    Root -->|build-time| VuePkg
    Root -->|build-time| TypesPkg
    Root -->|build-time| NextApp
    Root -->|build-time| ReactApp
    Root -->|build-time| VueApp

    %% Run-time imports
    NextApp -->|"import"| Core
    NextApp -->|"import"| Objects
    NextApp -->|"import"| Downloader
    NextApp -->|"import"| ReactPkg
    NextApp -->|"import"| TypesPkg

    ReactApp -->|"import"| Core
    ReactApp -->|"import"| Objects
    ReactApp -->|"import"| Downloader
    ReactApp -->|"import"| ReactPkg
    ReactApp -->|"import"| TypesPkg

    VueApp -->|"import"| Core
    VueApp -->|"import"| Objects
    VueApp -->|"import"| Downloader
    VueApp -->|"import"| VuePkg
    VueApp -->|"import"| TypesPkg

    %% External API calls
    ReactApp -->|"API call"| Pixabay
    ReactApp -->|"API call"| Pexels

    %% Click Events
    click Root "https://github.com/favger/layerhub-io/blob/main//pnpm-workspace.yaml"
    click Core "https://github.com/favger/layerhub-io/tree/main//packages/core"
    click Objects "https://github.com/favger/layerhub-io/tree/main//packages/objects"
    click Downloader "https://github.com/favger/layerhub-io/tree/main//packages/downloader"
    click ReactPkg "https://github.com/favger/layerhub-io/tree/main//packages/react"
    click VuePkg "https://github.com/favger/layerhub-io/tree/main//packages/vue"
    click TypesPkg "https://github.com/favger/layerhub-io/tree/main//packages/types"
    click NextApp "https://github.com/favger/layerhub-io/tree/main//apps/next-editor"
    click ReactApp "https://github.com/favger/layerhub-io/tree/main//apps/react-editor"
    click VueApp "https://github.com/favger/layerhub-io/tree/main//apps/vue-editor"

    %% Styles
    classDef infra fill:#cccccc,stroke:#888888,color:#000000;
    classDef core fill:#cce5ff,stroke:#6699cc,color:#000000;
    classDef framework fill:#d4eed8,stroke:#4caf50,color:#000000;
    classDef app fill:#ffe5cc,stroke:#ff9933,color:#000000;
    classDef external fill:#e5ccff,stroke:#aa66cc,color:#000000;
```
