How andriawan24/wordle-id-kmp works
• Mobile Client (Compose Multiplatform)
• Common Source Code: Contains shared business logic, domain models, use cases, data sources, dependency injection (Koin), and presentation (viewmodels, UI components, theme, etc.).
• Platform-Specific Implementations:
• Android Module: Looks after Android-specific UI parts (AndroidManifest.xml, activity classes like MainActivity.kt, platform-specific resources).
• iOS Module: Contains iOS-specific code (MainViewController.kt, iOS-specific UI files, ContentView.swift, etc.).
• Backend Server
• Server Code: This comprises the main application entry (Application.kt), routing (Routing.kt, MainRoutes.kt), database integration (Database.kt, data.db), network services (WordService.kt), and supporting utilities (CsvHelper.kt, Serialization.kt).
• Data Persistence Components: Represented by the Database file and the resource folder where the data.db is stored.
• External Dependencies & Shared Infrastructure
• Gradle and Build Scripts: Represent the build configuration (build.gradle.kts files in multiple modules, gradle wrapper, etc.) which tie together the multiplatform build process.
• Configuration and Assets: Include configuration for both mobile (res/ folders, iOS assets) and server (documentation.yaml, logback.xml).
Establish the relationships and interactions
• The Mobile Client interacts with the Backend Server through network APIs. This is defined in the common module through classes like WordleApiService and NetworkHelper.
• The Domain and Data layers within the client communicate with the Presentation layer via ViewModels to drive the UI on both Android and iOS.
• Dependency Injection (via Koin) ties together the modules within the client, ensuring proper initialization and configuration.
• The Backend Server exposes REST endpoints (configured in Routing.kt and MainRoutes.kt) which the mobile client consumes. The server handles data logic, persistence, and business rules.
• Build systems and configuration components (Gradle scripts, project configuration files) serve as the foundation to compile, package, and deploy the application across different platforms.
Important architectural patterns and design principles
• Modular/Layered architecture in the client: Separation between presentation (UI), domain (use cases, models), and data (networking and local data sources).
• MVVM Pattern: Evident by the use of components like GameViewModel and composable UI components.
• Dependency Injection: Using Koin to manage dependencies across modules.
• Client-Server Architecture: The mobile client is decoupled from the backend server, communicating over defined APIs.
• Multiplatform shared code: Common business logic is maintained in a shared module to maximize code reuse across Android and iOS.
Specific technologies and frameworks
• For the client: Compose Multiplatform, Kotlin, and shared resources along with platform-specific UI frameworks (Android’s native UI components, iOS using Swift/SwiftUI integration).
• For the server: Kotlin, likely Ktor or a similar lightweight server framework (inferred from the structure and naming in the server folder), as well as logging (logback.xml) and database access components.
• Build Tools: Gradle with Kotlin DSL (build.gradle.kts) and the Gradle wrapper.
• Clear, descriptive labels for each of the components (e.g., “Compose Shared Module”, “Android UI”, “iOS Integration”, “API Gateway”, “Database”, etc.).
Final advice
• Be very detailed – break down the project into as many components as logical based on the file structure.
• Both platform-specific differences and shared logic.
• Showing how different layers interact (e.g., data flows from the API to the repository, and then to the viewmodel and UI).