# pharo-project/pharo architecture

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

- Interactive diagram: https://gitdiagram.com/pharo-project/pharo
- Repository: https://github.com/pharo-project/pharo

## Overview

##### Major Components
- Bootstrapping & Build Tools: The “bootstrap” directory (with its many shell and Smalltalk scripts) drives the creation of a Pharo image. Also note the “scripts” directory and Jenkinsfile in the root that show automated build pipelines.
- Resources & Assets: Fonts and Unicode support files in the “resources” folder, along with documentation in “doc”, provide static assets and guidance.
- Versioning & Community Support: The repository also contains GitHub configuration files (issue templates, contribution guidelines) that support collaboration.
- External Dependencies: Note the existence of a separate repository for the virtual machine. The README makes clear that the VM source is elsewhere (pharo-vm repository) while this repo builds the image.

##### Out the Relationships
- Source Code Packaging: Show that the image itself contains all the code from the “src” directory, which is organized as a set of baseline packages (e.g., BaselineOfPharo, BaselineOfKernel, BaselineOfMorphic, etc.). Indicate dependencies between these packages where appropriate (for instance, the Kernel provides fundamental classes that are extended by nearly all layers).
- Automated Builds & Deployment: Illustrate the continuous integration pipeline (using Jenkins and GitHub workflows) that pulls from the repository, builds images (both 32-bit and 64-bit), and then uploads them to the files.pharo.org site.

##### Architectural Patterns & Design Principles
- Modularity & Package Isolation: Emphasize that the system is built from a multitude of loosely coupled packages (the “Tonel” format means each package is a directory of classes and methods) that interact through well‐defined dependencies.
- Bootstrapping / Self-hosting: The system “builds itself” via an elaborate bootstrap process – a central design principle.
- Separation of Concerns: The code is separated between the environment (runtime/core) and the interface (UI/morphic tools) and also between testing (SUnit, Debuggers) and user libraries.

##### Be Detailed Yet Clear
- Do not shy from drawing as many components as possible given the size of the “src” folder. You might not detail every single package, but group them logically (e.g., “Collections”, “Debugger” and “Morphic & UI Tools”) and note that each group can be expanded if needed.
- Connections are clear: the bootstrap process triggers compilation and merging of packages, the CI system oversees this process and uploads final artifacts, and the external VM underpins the entire runtime environment.

- Supporting components like “Resources/Documentation” and “Community/Versioning” are connected to the base repository.
- A clearly separate module for the Virtual Machine (external) that supports running the Pharo image.

## Diagram (Mermaid)

```mermaid
flowchart TB

    %% Build & Deployment Subgraph
    subgraph "Build & Deployment"
        BS1["Bootstrap Directory"]:::build
        BS2["Bootstrap Scripts"]:::build
        S["Scripts Directory"]:::build
        JF["Jenkins CI (Jenkinsfile)"]:::build
        BS1 --> BS2
        BS2 -->|"Executes"| PI
        JF -->|"Triggers CI"| PI
        S -->|"Includes Build Tools"| PI
    end

    %% Core Language & Runtime Subgraph
    subgraph "Core Language & Runtime"
        SRC["Source Code Packages (src)"]:::core
        PI["Pharo Image Creation"]:::image
        SRC -->|"Compiles into"| PI
        KCL["Kernel & Core Libraries"]:::core
        UIT["UI/IDE & Tools"]:::core
        TFT["Testing & Frameworks"]:::core
        PI -->|"Contains"| KCL
        PI -->|"Contains"| UIT
        PI -->|"Contains"| TFT
        KCL -->|"BaseFor"| UIT
        KCL -->|"BaseFor"| TFT
    end

    %% Resources & Documentation Subgraph
    subgraph "Resources & Documentation"
        RES["Resources"]:::resources
        DOC["Documentation"]:::resources
        RES -->|"ProvidesAssets"| PI
        DOC -->|"Guides"| PI
    end

    %% Versioning & Community Subgraph
    subgraph "Versioning & Community"
        GITHUB["GitHub Config (.github)"]:::version
        CONTR["CONTRIBUTING.md"]:::version
        COCD["CODE_OF_CONDUCT.md"]:::version
        GITHUB -->|"SupportsCollaboration"| JF
    end

    %% External Integration Subgraph
    subgraph "External Integration"
        REA["README.md (VM Info)"]:::ext
        EXT["External Virtual Machine"]:::ext
        FD["Deployment Endpoint (files.pharo.org)"]:::ext
        REA -->|"IndicatesVM"| EXT
        EXT -->|"RunsImage"| PI
        PI -->|"UploadsImage"| FD
    end

    %% Class Definitions for Styling
    classDef build fill:#add8e6,stroke:#0000ff,stroke-width:2px;
    classDef core fill:#90ee90,stroke:#008000,stroke-width:2px;
    classDef resources fill:#ffeb99,stroke:#ffaa00,stroke-width:2px;
    classDef version fill:#e6e6e6,stroke:#999999,stroke-width:2px;
    classDef ext fill:#d3bdf0,stroke:#8e44ad,stroke-width:2px;
    classDef image fill:#f0d9ff,stroke:#800080,stroke-width:2px;

    %% Click Events
    click BS1 "https://github.com/pharo-project/pharo/tree/Pharo13/bootstrap"
    click BS2 "https://github.com/pharo-project/pharo/tree/Pharo13/bootstrap/scripts"
    click S "https://github.com/pharo-project/pharo/tree/Pharo13/scripts"
    click JF "https://github.com/pharo-project/pharo/tree/Pharo13/Jenkinsfile"
    click SRC "https://github.com/pharo-project/pharo/tree/Pharo13/src"
    click RES "https://github.com/pharo-project/pharo/tree/Pharo13/resources"
    click DOC "https://github.com/pharo-project/pharo/tree/Pharo13/doc"
    click GITHUB "https://github.com/pharo-project/pharo/blob/Pharo13/.github"
    click CONTR "https://github.com/pharo-project/pharo/blob/Pharo13/CONTRIBUTING.md"
    click COCD "https://github.com/pharo-project/pharo/blob/Pharo13/CODE_OF_CONDUCT.md"
    click REA "https://github.com/pharo-project/pharo/blob/Pharo13/README.md"
```
