# quangchien99/jetpack-compose-tutorials architecture

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

- Interactive diagram: https://gitdiagram.com/quangchien99/jetpack-compose-tutorials
- Repository: https://github.com/quangchien99/jetpack-compose-tutorials

## Overview

##### Main Components
- “Tutorial Modules” – Each module (e.g. Basics, Unit Testing, UI Testing, Navigation) is an independent feature or chapter that demonstrates a specific aspect of Compose. For example, the Basics module contains subpackages for material widgets, layouts, state handling, gestures, graphics, theming, semantics and animations.
- “Testing Modules” – Separate modules are present for unit tests (Tutorial2-1Unit-Testing) and UI tests (Tutorial2-2UI-Testing) to validate behavior of Compose components and interactions.
- “Navigation Module” – Contains examples that manage navigation flows and back-stack behaviors using Jetpack Compose’s navigation patterns.
- “Common Resources” – These include Gradle build scripts, AndroidManifest.xml, resources (drawables, themes, strings) and configuration files. They support all tutorial modules and define properties and dependencies.
- “External Tools/Build System” – Gradle (with gradle.properties, settings.gradle, Gradle Kotlin DSL scripts) orchestrates the build and dependency management.

##### Relationships and Interactions
- The navigation module is central in demonstrating how different tutorials could be interconnected or presented sequentially in the app. It might also show how deep linking and back-stack management are done.
- Data flows from the ViewModels (for example in the Basics module) to the Composable UI components, all within the Jetpack Compose paradigm.
- Testing modules (unit and UI tests) “hook into” the corresponding production modules. Their architecture shows a separation of concerns where test packages (including mocks, coroutine test rules, etc.) validate UI and business logic.

##### Architectural Patterns and Design Principles
- Modularization: Each tutorial chapter is separated into its own module (and further sub-packaged by topics like layout, gestures, graphics). This makes the project highly modular and extensible.
- Separation of Concerns: Even though it’s a learning playground, the project separates UI composition (Jetpack Compose), navigation, state management, and testing so that each can be examined in isolation.
- Emphasis on Composable Functions: The project structure reflects multiple layers of Composable UI elements (custom modifiers, layouts, theming) and separates them conceptually out from business logic and tests.

##### Relevant Technologies, Frameworks, and Libraries
- Jetpack Compose is the central UI toolkit.
- Material components and Compose’s own “Material Widgets” are used extensively.
- Testing frameworks such as JUnit (for Unit Testing), Espresso or Compose UI Test (for UI Testing), and libraries like MockK for mocking in tests.
- Gradle (Kotlin DSL) is used for build configuration alongside ProGuard rules.
- Android-specific resources and AndroidManifest.xml files are included in each module.

– From ViewModels to UI components.
– From navigation components to individual tutorial screens.
– From Testing modules back to their target modules.
- Clearly label interactions such as “state flow,” “user interaction,” “navigation routing,” and “dependency injection” if applicable.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Production Modules Cluster
    subgraph "Production Modules"
        BM["Basics & Material (UI, ViewModel)"]:::tutorial
        NM["Navigation Module"]:::navigation
    end

    %% Testing Modules Cluster
    subgraph "Testing Modules"
        UT["Unit Testing"]:::testing
        UIT["UI Testing"]:::testing
    end

    %% Common Resources & Build System Cluster
    subgraph "Common Resources & Build System"
        CR0["Common Resources & Build System"]:::config
        F1["build.gradle.kts"]:::config
        F2["gradle.properties"]:::config
        F3["gradle"]:::config
        F4["settings.gradle"]:::config
        F5["gradlew"]:::config
        F6["gradlew.bat"]:::config
        CR0 -->|"contains"| F1
        CR0 -->|"contains"| F2
        CR0 -->|"contains"| F3
        CR0 -->|"contains"| F4
        CR0 -->|"contains"| F5
        CR0 -->|"contains"| F6
    end

    %% Interactions
    CR0 -->|"configures"| BM
    CR0 -->|"configures"| NM
    CR0 -->|"configures"| UT
    CR0 -->|"configures"| UIT

    NM -->|"navigates"| BM

    UT -->|"hooks"| BM
    UIT -->|"hooks"| BM

    %% Click Events
    click BM "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/Tutorial1-1Basics"
    click UT "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/Tutorial2-1Unit-Testing"
    click UIT "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/Tutorial2-2UI-Testing"
    click NM "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/Tutorial3-1Navigation"
    click F1 "https://github.com/quangchien99/jetpack-compose-tutorials/blob/master/build.gradle.kts"
    click F2 "https://github.com/quangchien99/jetpack-compose-tutorials/blob/master/gradle.properties"
    click F3 "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/gradle"
    click F4 "https://github.com/quangchien99/jetpack-compose-tutorials/blob/master/settings.gradle"
    click F5 "https://github.com/quangchien99/jetpack-compose-tutorials/tree/master/gradlew"
    click F6 "https://github.com/quangchien99/jetpack-compose-tutorials/blob/master/gradlew.bat"

    %% Styles
    classDef tutorial fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef navigation fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef testing fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef config fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
