# oussamateyib/helloworld architecture

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

- Interactive diagram: https://gitdiagram.com/oussamateyib/helloworld
- Repository: https://github.com/oussamateyib/helloworld

## Overview

##### Project type and purpose
- This is a minimal Android native application written in C that uses the raylib graphics library to render “Hello, World!” on screen.
- There is no server-side component or database—this is a purely client-side, embedded graphics demo.

##### File structure
- Top-level files:
- AndroidManifest.xml → declares the application, permissions, uses-sdk, and native activity entry point.
- CMakeLists.txt → describes how to compile `src/main.c` into a native library and package it into an APK.
- README.md & LICENSE → project documentation and license.
- `src/`
- `main.c` → application logic & calls into raylib for rendering.
- No Java/Kotlin sources—this relies on the Android Native Activity (or a custom `main.c` entry) to bootstrap.

##### Extract key insights from the README
- Build dependencies: Android SDK/NDK, CMake (≥3.5), Ninja, JDK, raylib (prebuilt static libs per ABI).
- Environment vars: ANDROID_HOME, ANDROID_EXTERNAL_HOME (raylib headers & libs), KEYSTORE settings.
- Build flow:
a. `cmake -B <BuildDir> -DCMAKE_TOOLCHAIN_FILE=<NDK>/...android.toolchain.cmake -DANDROID_ABI=<ABI> -DANDROID_PLATFORM=<API-Level>`
b. `cmake --build <BuildDir>` → compiles native code into `.so`, packages into APK.
c. `--target install_apk` → adb install.

a. Main components:
- Developer workstation (host) with Android SDK/NDK, CMake, Ninja, raylib external files.
- Build system (CMake + Ninja) orchestrating:
– Compiling `main.c` + raylib static libs → native shared library (`libhello.so`)
– Packaging `.so` + AndroidManifest + res/ → APK
- Target Android device/emulator:
– Android OS & ART runtime
– Native Activity loader (or custom launcher) loads `libhello.so`
– raylib engine invoked via C entry point to render graphics
b. Relationships & data flow:
1. Developer invokes CMake on host
2. CMake uses Android toolchain to cross-compile C code & link against raylib
3. APK is assembled and signed (using keystore)
4. APK is deployed via adb to the device
5. On launch, Android OS starts the native activity, the C `main()` runs, raylib renders to the EGL surface
c. Architectural patterns & principles:
- Single static native module (monolith)
- Separation of concerns: build-time (host) vs. runtime (device)
- Static linking of third-party graphics library (raylib) per ABI
d. Key technologies & frameworks:
- Android NDK & Native Activity
- CMake + Ninja toolchain
- raylib (graphics library)
- Android SDK (packaging, signing, resource management)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Host Build System
    subgraph "Host Build System"
        DeveloperWorkstation["Developer Workstation"]:::host
        EnvVars["Env Vars (ANDROID_HOME, ANDROID_EXTERNAL_HOME, KEYSTORE)"]:::host
        CMake["CMake Toolchain"]:::host
        AndroidNDK["Android SDK/NDK"]:::host
        RaylibExternals["raylib External Libs"]:::host
        Ninja["Ninja Build Tool"]:::host
        Source["src/main.c"]:::host
        CMakeListsNode["CMakeLists.txt"]:::host
    end

    DeveloperWorkstation --> EnvVars
    DeveloperWorkstation --> CMake
    Source --> CMake
    CMake --> AndroidNDK
    CMake --> RaylibExternals
    CMake --> Ninja
    CMake --> CMakeListsNode

    %% Compilation Output
    NativeLib["Native Shared Library (libhello.so)"]:::artifact

    CMake -->|"compile & link"| NativeLib

    %% Artifact Packaging
    subgraph "Artifact Packaging"
        AndroidManifestNode["AndroidManifest.xml"]:::artifact
        Resources["res/"]:::artifact
        APK["Android Package (APK)"]:::artifact
    end

    NativeLib -->|"link into APK"| APK
    AndroidManifestNode -->|"include manifest"| APK
    Resources -->|"include resources"| APK

    %% Deployment
    APK -->|"adb install"| Device

    %% Device Runtime
    subgraph "Device Runtime"
        Device["Android Device/Emulator"]:::runtime
        ART["Android OS & ART Runtime"]:::runtime
        Loader["Native Activity Loader"]:::runtime
        AppNative["libhello.so Loaded"]:::runtime
        RaylibRuntime["raylib Graphics Engine"]:::runtime
        GPU["GPU Surface (EGL)"]:::runtime
    end

    Device --> ART
    ART --> Loader
    Loader -->|"loads native library"| AppNative
    AppNative -->|"calls into"| RaylibRuntime
    RaylibRuntime -->|"renders to"| GPU

    %% Documentation
    subgraph "Project Documentation"
        README["README.md"]:::doc
        License["LICENSE"]:::doc
        Gitignore[".gitignore"]:::doc
    end

    DeveloperWorkstation --> README
    DeveloperWorkstation --> License
    DeveloperWorkstation --> Gitignore

    %% Click Events
    click CMakeListsNode "https://github.com/oussamateyib/helloworld/blob/main/CMakeLists.txt"
    click AndroidManifestNode "https://github.com/oussamateyib/helloworld/blob/main/AndroidManifest.xml"
    click Source "https://github.com/oussamateyib/helloworld/blob/main/src/main.c"
    click Resources "https://github.com/oussamateyib/helloworld/tree/main/res/"
    click README "https://github.com/oussamateyib/helloworld/blob/main/README.md"
    click License "https://github.com/oussamateyib/helloworld/tree/main/LICENSE"
    click Gitignore "https://github.com/oussamateyib/helloworld/blob/main/.gitignore"

    %% Styles
    classDef host fill:#add8e6,stroke:#000,stroke-width:1px
    classDef artifact fill:#90ee90,stroke:#000,stroke-width:1px
    classDef runtime fill:#ffa500,stroke:#000,stroke-width:1px
    classDef doc fill:#d3d3d3,stroke:#000,stroke-width:1px
```
