# panda-program-web/scrum architecture

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

- Interactive diagram: https://gitdiagram.com/panda-program-web/scrum
- Repository: https://github.com/panda-program-web/scrum

## Overview

##### Overall Layers
- UI Layer
- Application (Use-Case) Layer
- Domain (Core) Layer
- Infrastructure Layer

##### Main Components
a. UI Layer
b. Application Layer
- Use-Case Engine: orchestrates commands and queries.
c. Domain Layer
- Core Domain Model: entities (Employee, Product, Project, Team), business rules, domain events.
d. Infrastructure Layer
- Adapters and Repositories: persistence (JSON/LowDB), external services.

##### Relationships and Data Flows
- UI → Application: “invoke use case”
- Application → Domain: “execute business logic”
- Application → Infrastructure: “load/save data”
- Infrastructure → Domain: “hydrate/persist entities”

##### Architectural Patterns and Principles
- Layered Architecture: strict direction of dependencies (UI → App → Domain ← Infra)
- Separation of Concerns: UI only handles interaction, Use-Case encapsulates workflow, Domain encapsulates rules, Infra handles I/O.
- Dependency Inversion: Application and Domain define interfaces; Infrastructure implements them.

##### Technologies and Frameworks (to annotate
- TypeScript (all layers)
- CLI framework (Node)
- Next.js (Web UI)
- LowDB/JSON storage (Infra)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        UI_CLI["CLI & Web UI"]:::uiLayer
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        UseCase["Use-Case Handlers"]:::appLayer
        QueryService["Query Services"]:::appLayer
        InitScenario["Initialization Scenarios"]:::appLayer
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        CoreModel["Core Domain Model"]:::domainLayer
        CommonUtils["Common Utilities"]:::domainLayer
        CompanyDomain["Company Domain"]:::domainLayer
        ScrumDomain["Scrum Domain"]:::domainLayer
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        CLIAdapter["CLI Adapters"]:::infraLayer
        WebAdapter["Web Adapters"]:::infraLayer
        JSONRepo["JSON Repositories"]:::infraLayer
        ExternalLowDB["External LowDB Setup"]:::infraLayer
    end

    %% Connections
    UI_CLI -->|"invoke use case"| UseCase
    UseCase -->|"execute business logic"| CoreModel
    UseCase -->|"execute business logic"| CompanyDomain
    UseCase -->|"execute business logic"| ScrumDomain
    UseCase -->|"load/save data"| JSONRepo
    QueryService -->|"load data"| JSONRepo
    InitScenario -->|"setup initial state"| CoreModel
    JSONRepo -->|"hydrate/persist entities"| CoreModel
    CLIAdapter -->|"input/output"| UI_CLI
    WebAdapter -->|"input/output"| UI_CLI

    %% Click Events
    click UI_CLI "https://github.com/panda-program-web/scrum/tree/main/apps/cli/src"
    click UseCase "https://github.com/panda-program-web/scrum/tree/main/packages/use-case/src/application/use-case"
    click QueryService "https://github.com/panda-program-web/scrum/tree/main/packages/use-case/src/application/query-service"
    click InitScenario "https://github.com/panda-program-web/scrum/tree/main/packages/use-case/src/application/scenario/init"
    click CoreModel "https://github.com/panda-program-web/scrum/tree/main/packages/core/src"
    click CommonUtils "https://github.com/panda-program-web/scrum/tree/main/packages/core/src/common"
    click CompanyDomain "https://github.com/panda-program-web/scrum/tree/main/packages/core/src/company"
    click ScrumDomain "https://github.com/panda-program-web/scrum/tree/main/packages/core/src/scrum"
    click CLIAdapter "https://github.com/panda-program-web/scrum/tree/main/packages/gateway/src/adapter/cli"
    click WebAdapter "https://github.com/panda-program-web/scrum/tree/main/packages/gateway/src/adapter/web"
    click JSONRepo "https://github.com/panda-program-web/scrum/tree/main/packages/gateway/src/repository/json"
    click ExternalLowDB "https://github.com/panda-program-web/scrum/tree/main/packages/gateway/src/external/lowdb"

    %% Styles
    classDef uiLayer fill:#ccf,stroke:#333,stroke-width:1px
    classDef appLayer fill:#cfc,stroke:#333,stroke-width:1px
    classDef domainLayer fill:#fcc,stroke:#333,stroke-width:1px
    classDef infraLayer fill:#fc9,stroke:#333,stroke-width:1px
```
