# adrielcafe/voyager architecture

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

- Interactive diagram: https://gitdiagram.com/adrielcafe/voyager
- Repository: https://github.com/adrielcafe/voyager

## Overview

##### Project Type & Purpose
- The project is an open-source, multiplatform navigation library built for Jetpack Compose. It enables scalable single-activity apps with features like screen stacking, transitions, bottom sheet, tab, and nested navigation as well as integrations with various dependency injection and state management frameworks (Hilt, Koin, Kodein, LiveData, RxJava, etc.).
- The README highlights that the library supports Android, iOS, Desktop, and Web platforms and also has deep documentation along with many sample projects. This confirms that the library is both highly modular and designed to work across multiple platforms.

##### File Structure
- The file tree is organized across multiple directories:
- Core library modules: e.g., voyager-core, which holds the fundamental navigation APIs, lifecycle management, screen stacks, and other platform-agnostic code in commonMain, androidMain, iosMain, etc.
- Integration modules: e.g., voyager-hilt, voyager-koin, voyager-kodein, voyager-livedata, voyager-rxjava, and voyager-screenmodel. Each of these modules is responsible for integrating the core navigation functionality with different DI frameworks and state management approaches.
- Specialized navigation modules: e.g., voyager-bottom-sheet-navigator, voyager-tab-navigator, and voyager-transitions, which add specific navigation UI patterns and transition animations.
- Samples and documentation: Directories like samples, docs, and the build configuration files (build.gradle.kts, gradle wrapper) help both in demonstrating usage and in building the project.
- Notice the common multiplatform structure (commonMain, androidMain, iosMain, etc.) in several modules, reflecting the cross-platform design.

a. Core Navigation Engine:
- Inside this block, note sub-components like:
- Screen & Navigation Registries
- Lifecycle and Back Press Handlers
- Transition and Animation logic
b. Integration Modules (Extensions):
- Surround the core block with additional blocks representing integration modules:
- “Voyager Hilt” (for Hilt integration)
- “Voyager Koin” (for Koin integration)
- “Voyager Kodein” (for Kodein integration)
- “Voyager LiveData” and “Voyager RxJava” (for reactive state management)
- “Voyager ScreenModel” (for ViewModel-style screen management)
c. Specialized Navigators:
- Create dedicated blocks for “Bottom Sheet Navigator,” “Tab Navigator,” and “Transitions Module.” These modules are built on top of the core navigation API to provide specialized navigation flows and transitions.
d. Platform-Specific Layers:
- Since the project is multiplatform, add “Platform Abstraction Layers” with subdivisions for Android, iOS, Desktop, Web, etc. These layers can be shown as separate segments that interface with the core logic. For instance, show that the “Voyager Core” has platform-specific implementations (androidMain, iosMain, etc.) and that integration modules may also provide platform adapters (such as Android-specific Manifest and code in androidMain).
e. Samples & Documentation:
f. Build & Configuration:
- Optionally, include a small block for “Build & Config” (build.gradle.kts, gradle, etc.) to note the cohesive build system that binds all modules.

##### Relationships and Interactions
- The integration modules and specialized navigators depend on the core navigation module.
- The multiplatform layers interface with the core to provide platform-specific behavior.
- Samples depend on the combined exported APIs of the core plus integration modules.
- Make clear the layered architecture: at the center is the core library; around it are extension points (for DI, state, specialized navigation); and on the periphery are platform-specific implementations.

- Annotations that briefly capture the role of each component (for instance: “Handles screen registration and navigation stack management” for the core).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "Core Layer"
        VC("Voyager Core – Navigation & Lifecycle"):::core
    end

    %% Integration Modules
    subgraph "Integration Modules"
        VH("Voyager Hilt – DI Integration"):::integration
        VK("Voyager Koin – DI Integration"):::integration
        VKd("Voyager Kodein – DI Integration"):::integration
        VLD("Voyager LiveData – Reactive State Integration"):::integration
        VR("Voyager RxJava – Reactive State Integration"):::integration
        VSM("Voyager ScreenModel – ViewModel-style Screen Management"):::integration
    end

    %% Specialized Navigators
    subgraph "Specialized Navigators"
        BS("Bottom Sheet Navigator"):::specialized
        TN("Tab Navigator"):::specialized
        TM("Transitions Module"):::specialized
    end

    %% Platform Abstraction Layers
    subgraph "Platform Abstraction Layers"
        A("Android"):::platform
        I("iOS"):::platform
        D("Desktop"):::platform
        W("Web"):::platform
    end

    %% Demonstrations & Documentation
    subgraph "Demonstrations & Documentation"
        S("Samples"):::demo
        Doc("Documentation"):::demo
    end

    %% Build & Configuration
    BC("Build & Configuration"):::build

    %% Relationships - Integration Modules depend on Core
    VH -->|"extends"| VC
    VK -->|"extends"| VC
    VKd -->|"extends"| VC
    VLD -->|"extends"| VC
    VR -->|"extends"| VC
    VSM -->|"extends"| VC

    %% Specialized Navigators using Core
    BS -->|"uses"| VC
    TN -->|"uses"| VC
    TM -->|"uses"| VC

    %% Platform layers provide specific implementations to Core
    A -->|"platformImpl"| VC
    I -->|"platformImpl"| VC
    D -->|"platformImpl"| VC
    W -->|"platformImpl"| VC

    %% Demonstrations depend on Core
    S -->|"demonstrates"| VC
    Doc -->|"documents"| VC

    %% Build & Configuration builds all modules
    BC -->|"builds"| VC
    BC -->|"builds"| VH
    BC -->|"builds"| VK
    BC -->|"builds"| VKd
    BC -->|"builds"| VLD
    BC -->|"builds"| VR
    BC -->|"builds"| VSM
    BC -->|"builds"| BS
    BC -->|"builds"| TN
    BC -->|"builds"| TM
    BC -->|"builds"| A
    BC -->|"builds"| I
    BC -->|"builds"| D
    BC -->|"builds"| W
    BC -->|"builds"| S
    BC -->|"builds"| Doc

    %% Click Events for Component Mapping
    click VC "https://github.com/adrielcafe/voyager/tree/main/voyager-core"
    click VH "https://github.com/adrielcafe/voyager/tree/main/voyager-hilt"
    click VK "https://github.com/adrielcafe/voyager/tree/main/voyager-koin"
    click VKd "https://github.com/adrielcafe/voyager/tree/main/voyager-kodein"
    click VLD "https://github.com/adrielcafe/voyager/tree/main/voyager-livedata"
    click VR "https://github.com/adrielcafe/voyager/tree/main/voyager-rxjava"
    click VSM "https://github.com/adrielcafe/voyager/tree/main/voyager-screenmodel"
    click BS "https://github.com/adrielcafe/voyager/tree/main/voyager-bottom-sheet-navigator"
    click TN "https://github.com/adrielcafe/voyager/tree/main/voyager-tab-navigator"
    click TM "https://github.com/adrielcafe/voyager/tree/main/voyager-transitions"
    click S "https://github.com/adrielcafe/voyager/tree/main/samples"
    click Doc "https://github.com/adrielcafe/voyager/tree/main/docs"
    click BC "https://github.com/adrielcafe/voyager/blob/main/build.gradle.kts, gradle"

    %% Styling
    classDef core fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef integration fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef specialized fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef platform fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef demo fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef build fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
