# juansfm/cpp42 architecture

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

- Interactive diagram: https://gitdiagram.com/juansfm/cpp42
- Repository: https://github.com/juansfm/cpp42

## Overview

##### Project type and purpose
- This is an educational monorepo for “C++ modules from 42.”
- It contains a series of standalone exercises (ex00, ex01, …) organized by module (CPP00, CPP01, … CPP09).
- Each exercise folder holds source code (.cpp/.hpp), a Makefile, and a main.cpp to demonstrate or test the exercise.

##### File structure
- Top level:
- .gitignore
- README.md (“# CPP42 – C++ modules from 42”)
- Directories: CPP00, CPP01, …, CPP09
- Under each CPPXX:
- ex00, ex01, … (one folder per exercise)
- Each exercise folder always has:
– Makefile (build instructions)
– .cpp and .hpp files (implementation and headers)
– main.cpp (entry point/testing)
- There is no shared “src” or “lib” beyond these per-exercise directories, nor any external services or databases.

##### README
- Very brief: confirms these are C++ module exercises for the 42 curriculum.

a. Main components:
- Repository (root)
- Module containers: CPP00, CPP01, … CPP09
- Inside each container: Exercise sub-modules (ex00, ex01, …)
- Build system: Makefiles invoking the C++ compiler
- Runtime: Console executable produced by each exercise’s Makefile
b. Relationships & interactions:
- Developer → modifies source files in an exercise folder
- Makefile → compiles source & headers → produces executable
- Executable → standard I/O (console)
- No cross-module code reuse (each exercise is independent)
c. Architectural patterns / principles:
- Monorepo of isolated, self-contained modules
- Convention-over-configuration: each exercise follows the same directory layout
- Reproducible builds via per-folder Makefiles
d. Key technologies:
- C++ (g++/clang++)
- Make (Makefiles)
- Git (version control)

##### Step-by-step for the principal software engineer
4. For a representative exercise, expand it:
– List source files (.cpp/.hpp)
5. “All exercises follow this pattern; none share code.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    Developer["Developer"]:::actor
    Developer --> src00_0

    subgraph "Repository"
        gitignore[".gitignore"]:::source
        readme["README.md"]:::source

        subgraph "CPP00"
            style CPP00 fill:#e0f7fa,stroke:#000
            subgraph "ex00"
                style CPP00_ex00 fill:#ffffff
                src00_0["megaphone.cpp"]:::source
                mk00_0["Makefile"]:::build
                main00_0["main.cpp"]:::source
                src00_0 --> mk00_0
                mk00_0 --> compile00_0["Compiler"]:::build
                compile00_0 --> exe00_0["Executable"]:::exe
                exe00_0 --> console["Console I/O"]:::runtime
            end
            subgraph "ex01"
                style CPP00_ex01 fill:#ffffff
                src01_Cx["Contact.cpp"]:::source
                hdr01_Cx["Contact.hpp"]:::source
                mk01_1["Makefile"]:::build
                main01_1["main.cpp"]:::source
                src01_Cx & hdr01_Cx --> mk01_1
                mk01_1 --> compile01_1["Compiler"]:::build
                compile01_1 --> exe01_1["Executable"]:::exe
                exe01_1 --> console
            end
        end

        subgraph "CPP01"
            style CPP01 fill:#e0f7fa,stroke:#000
            subgraph "ex00"
                style CPP01_ex00 fill:#ffffff
                src10_Z["Zombie.cpp"]:::source
                hdr10_Z["Zombie.hpp"]:::source
                mk10_0["Makefile"]:::build
                main10_0["main.cpp"]:::source
                src10_Z & hdr10_Z --> mk10_0
                mk10_0 --> compile10_0["Compiler"]:::build
                compile10_0 --> exe10_0["Executable"]:::exe
                exe10_0 --> console
            end
            subgraph "ex03"
                style CPP01_ex03 fill:#ffffff
                src13_HA["HumanA.cpp"]:::source
                hdr13_HA["HumanA.hpp"]:::source
                mk13_3["Makefile"]:::build
                main13_3["main.cpp"]:::source
                src13_HA & hdr13_HA --> mk13_3
                mk13_3 --> compile13_3["Compiler"]:::build
                compile13_3 --> exe13_3["Executable"]:::exe
                exe13_3 --> console
            end
        end

        subgraph "CPP03"
            style CPP03 fill:#e0f7fa,stroke:#000
            subgraph "ex02"
                style CPP03_ex02 fill:#ffffff
                src32_CT["ClapTrap.cpp"]:::source
                hdr32_CT["ClapTrap.hpp"]:::source
                src32_FR["FragTrap.cpp"]:::source
                hdr32_FR["FragTrap.hpp"]:::source
                mk32_2["Makefile"]:::build
                main32_2["main.cpp"]:::source
                src32_CT & hdr32_CT & src32_FR & hdr32_FR --> mk32_2
                mk32_2 --> compile32_2["Compiler"]:::build
                compile32_2 --> exe32_2["Executable"]:::exe
                exe32_2 --> console
            end
        end

        subgraph "CPP09"
            style CPP09 fill:#e0f7fa,stroke:#000
            subgraph "ex02"
                style CPP09_ex02 fill:#ffffff
                src92_PM["PmergeMe.cpp"]:::source
                hdr92_PM["PmergeMe.hpp"]:::source
                mk92_2["Makefile"]:::build
                main92_2["main.cpp"]:::source
                src92_PM & hdr92_PM --> mk92_2
                mk92_2 --> compile92_2["Compiler"]:::build
                compile92_2 --> exe92_2["Executable"]:::exe
                exe92_2 --> console
            end
        end
    end

    classDef module fill:#e0f7fa,stroke:#000;
    classDef build fill:#c8e6c9,stroke:#000;
    classDef source fill:#fff9c4,stroke:#000;
    classDef exe fill:#ffccbc,stroke:#000;
    classDef runtime fill:#ffe0b2,stroke:#000;
    classDef actor fill:#e1bee7,stroke:#000;

    click gitignore "https://github.com/juansfm/cpp42/blob/main/.gitignore"
    click readme "https://github.com/juansfm/cpp42/blob/main/README.md"
    click CPP00 "https://github.com/juansfm/cpp42/tree/main/CPP00/"
    click CPP01 "https://github.com/juansfm/cpp42/tree/main/CPP01/"
    click CPP03 "https://github.com/juansfm/cpp42/tree/main/CPP03/"
    click CPP09 "https://github.com/juansfm/cpp42/tree/main/CPP09/"
    click src00_0 "https://github.com/juansfm/cpp42/blob/main/CPP00/ex00/megaphone.cpp"
    click mk00_0 "https://github.com/juansfm/cpp42/tree/main/CPP00/ex00/Makefile"
    click main00_0 "https://github.com/juansfm/cpp42/blob/main/CPP00/ex00/main.cpp"
    click src01_Cx "https://github.com/juansfm/cpp42/blob/main/CPP00/ex01/Contact.cpp"
    click hdr01_Cx "https://github.com/juansfm/cpp42/blob/main/CPP00/ex01/Contact.hpp"
    click mk01_1 "https://github.com/juansfm/cpp42/tree/main/CPP00/ex01/Makefile"
    click src10_Z "https://github.com/juansfm/cpp42/blob/main/CPP01/ex00/Zombie.cpp"
    click hdr10_Z "https://github.com/juansfm/cpp42/blob/main/CPP01/ex00/Zombie.hpp"
    click mk10_0 "https://github.com/juansfm/cpp42/tree/main/CPP01/ex00/Makefile"
    click main10_0 "https://github.com/juansfm/cpp42/blob/main/CPP01/ex00/main.cpp"
    click src13_HA "https://github.com/juansfm/cpp42/blob/main/CPP01/ex03/HumanA.cpp"
    click hdr13_HA "https://github.com/juansfm/cpp42/blob/main/CPP01/ex03/HumanA.hpp"
    click mk13_3 "https://github.com/juansfm/cpp42/tree/main/CPP01/ex03/Makefile"
    click main13_3 "https://github.com/juansfm/cpp42/blob/main/CPP01/ex03/main.cpp"
    click src32_CT "https://github.com/juansfm/cpp42/blob/main/CPP03/ex02/ClapTrap.cpp"
    click hdr32_CT "https://github.com/juansfm/cpp42/blob/main/CPP03/ex02/ClapTrap.hpp"
    click src32_FR "https://github.com/juansfm/cpp42/blob/main/CPP03/ex02/FragTrap.cpp"
    click hdr32_FR "https://github.com/juansfm/cpp42/blob/main/CPP03/ex02/FragTrap.hpp"
    click mk32_2 "https://github.com/juansfm/cpp42/tree/main/CPP03/ex02/Makefile"
    click main32_2 "https://github.com/juansfm/cpp42/blob/main/CPP03/ex02/main.cpp"
    click src92_PM "https://github.com/juansfm/cpp42/blob/main/CPP09/ex02/PmergeMe.cpp"
    click hdr92_PM "https://github.com/juansfm/cpp42/blob/main/CPP09/ex02/PmergeMe.hpp"
    click mk92_2 "https://github.com/juansfm/cpp42/tree/main/CPP09/ex02/Makefile"
    click main92_2 "https://github.com/juansfm/cpp42/blob/main/CPP09/ex02/main.cpp"
```
