How nikbulavin/cashsense works
Main Components
• Mobile Application Layer: Represented by the “mobile” module that contains the entry point (CsApplication, MainActivity) and UI integration.
• Feature Modules: Each distinct feature (e.g., Category, Home, Settings, Subscription, Transaction, Transfer, Wallet) is encapsulated as a separate module (found in the “feature” directory). Each feature module has its own UI screens, view models, dialogs, and navigation definitions.
• Core Modules:
• Core Domain: Contains business logic and use cases in “core/domain”.
• Core Data: Contains repository patterns, data models, and data sources (“core/data”).
• Core Database: Manages SQLite/Room schemas, DAO definitions, migration logic (“core/database”).
• Core Datastore and Proto: Manages local preferences and proto definitions (“core/datastore-proto”, “core/datastore”).
• Core Model: Defines the common data structures used across the app (“core/model”).
• Core Network: Handles API communication via Retrofit and network data sources (“core/network”).
• Core Notifications & Shortcuts: Manages notifications and Android shortcuts (“core/notifications”, “core/shortcuts”).
• Build and Configuration Modules: “build-logic” holds Gradle convention plugins that standardize build configurations across modules.
• Work Module: Contains background processing components such as workers and initializers (“work”).
Relationships and Data Flow
• The Mobile layer is the “shell” of the application that ties together feature modules through navigation (CsNavHost, TopLevelDestination) and provides the overall application context.
• Each Feature module interacts with core modules:
• They use core/domain use cases to trigger business logic.
• They communicate with core/data and core/database for local data persistence.
• They leverage core/network for remote API interaction.
• They integrate UI components defined in core/designsystem and core/ui.
• The Build and Configuration layer supports the entire project by providing standardized Gradle plugins and build conventions.
• Background services, such as those in the Work module, run tasks (e.g., deleting outdated rates) that may also trigger updates in the core layers.
Architectural Patterns and Design Principles
• A Modular (feature-based) architecture: Each functionality is split into its own module, which improves maintainability and reusability.
• Clean Architecture Principles:
• Presentation (UI in mobile and feature modules)
• Domain (business logic in core/domain)
• Data (repositories and data sources in core/data, core/database, core/network)
• Separation of Build Logic: The “build-logic” module centralizes Gradle conventions for consistency.
• Use of Dependency Injection (DI): Although not explicitly shown in every file, the presence of “di” (dependency injection) packages in network, datastore, database, etc., indicate that DI is a central design principle.