How adrielcafe/voyager works
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).