# koster/cms architecture

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

- Interactive diagram: https://gitdiagram.com/koster/cms
- Repository: https://github.com/koster/cms

## Overview

##### Project type and purpose
- This is a Unity Package (“test-package” / “CMS”) delivered via the Unity Package Manager (manifest.json & package.json).
- It provides a Content Management System (CMS) as a runtime library (Runtime/CMS) plus Unity Editor extensions (Runtime/Editor).

##### File structure
- Top-level:
- manifest.json & package.json – Unity Package metadata
- Runtime/ – contains all Unity-compatible code
- Runtime/CMS/ – the core CMS runtime assembly (CMS.asmdef)
- CMS.cs – main entry point
- Common/ – data structures & utilities (tags, reflection helpers, SFX definitions)
- CMS.asmdef / CMS.asmdef.meta – defines a Unity assembly for runtime code
- Runtime/Editor/ – editor-only code (no asmdef, but built into the Editor when package is installed)
- CMSMenuItems.cs – menu commands exposing CMS features in the Unity Editor
- README.md – minimal description; no internal architecture doc

##### Key architecture insights from structure
- Two main assemblies:
a. Runtime Assembly (“CMS”) – compiled into game builds
b. Editor Assembly – runs only inside Unity Editor, depends on Runtime Assembly
- Common utilities (tags, reflection) are shared by both Editor and Runtime code
- Separation enforced by asmdef files and Unity Package Manager

##### Elements
- Package Manager → Assembly loading
- Editor Assembly → Runtime API calls
- Game Scripts → Runtime API calls

## Diagram (Mermaid)

```mermaid
flowchart TD
    Metadata["Unity Package Metadata<br/>package.json, manifest.json"]:::pkg
    subgraph "Unity Editor Host"
        EditorAssembly["Editor Assembly: CMSMenuItems"]:::editor
    end
    subgraph "Unity Runtime Host"
        RuntimeAssembly["Runtime Assembly: CMS"]:::runtime
        GameScripts["Game Scene Scripts"]:::runtime
    end
    Common["Common Utilities"]:::common
    Doc["Package Documentation: README.md"]:::doc
    External1["UnityEngine"]:::external
    External2["UnityEditor"]:::external

    Metadata --> EditorAssembly
    Metadata --> RuntimeAssembly
    EditorAssembly --> RuntimeAssembly
    EditorAssembly --> Common
    RuntimeAssembly --> Common
    GameScripts --> RuntimeAssembly
    External1 --> RuntimeAssembly
    External1 --> GameScripts
    External2 --> EditorAssembly

    click Metadata "https://github.com/koster/cms/blob/main/package.json"
    click Metadata "https://github.com/koster/cms/blob/main/package.json.meta"
    click Metadata "https://github.com/koster/cms/blob/main/manifest.json"
    click Metadata "https://github.com/koster/cms/blob/main/Runtime/manifest.json"

    click RuntimeAssembly "https://github.com/koster/cms/blob/main/Runtime/CMS.asmdef"
    click RuntimeAssembly "https://github.com/koster/cms/blob/main/Runtime/CMS.asmdef.meta"
    click RuntimeAssembly "https://github.com/koster/cms/blob/main/Runtime/CMS/CMS.cs"
    click RuntimeAssembly "https://github.com/koster/cms/blob/main/Runtime/CMS/CMS.cs.meta"

    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/AnythingTag.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/AnythingTag.cs.meta"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/CMSEntityPfb.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/CMSEntityPfb.cs.meta"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/NullEntity.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/NullEntity.cs.meta"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/ReflectionUtil.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/ReflectionUtil.cs.meta"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/SFXDefinition.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/SFXDefinition.cs.meta"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/SFXTag.cs"
    click Common "https://github.com/koster/cms/blob/main/Runtime/CMS/Common/SFXTag.cs.meta"

    click EditorAssembly "https://github.com/koster/cms/blob/main/Runtime/Editor/CMSMenuItems.cs"
    click EditorAssembly "https://github.com/koster/cms/blob/main/Runtime/Editor/CMSMenuItems.cs.meta"

    click Doc "https://github.com/koster/cms/blob/main/README.md"
    click Doc "https://github.com/koster/cms/blob/main/README.md.meta"

    classDef pkg fill:#cccccc,stroke:#333,stroke-width:1px
    classDef editor fill:#b3ffb3,stroke:#2d7f2d,stroke-width:1px
    classDef runtime fill:#b3d9ff,stroke:#1a4d99,stroke-width:1px
    classDef common fill:#ffffb3,stroke:#999900,stroke-width:1px
    classDef external fill:#e6e6e6,stroke:#666666,stroke-width:1px
    classDef doc fill:#cce5ff,stroke:#335f91,stroke-width:1px
```
