How poksyy/copay-app-frontend works
Project Type and Purpose
• This is an Android mobile application built with Kotlin and Jetpack Compose that serves as the frontend for a collaborative expense management solution.
• The application supports user authentication, expense splitting, group management, collaborative gifts, and price comparisons, with server-side logic handled by a separate backend repository.
Key Architectural Components
• UI / Presentation Layer:
• Components: Activities and Compose-based screens (e.g., SplashScreen, HubScreen, various Auth screens like LoginScreen, RegisterStepOneScreen, etc.).
• Reusable UI components (BottomNavigationBar, Buttons, InputField) and theme configurations.
• Navigation:
• Represented by components such as CopayNavHost and NavRoutes, which drive screen transitions.
• ViewModel / Business Logic Layer:
• Contains view models like AuthViewModel, ForgotPasswordViewModel, and SplashViewModel.
• Accompanied by factories (AuthViewModelFactory, ForgotPasswordViewModelFactory) to manage lifecycle-related aspects.
• Repository/Data Layer:
• Encapsulated in UserRepository and PasswordRepository, which abstract data access and business logic.
• Service / API Interaction Layer:
• Components like AuthService, ApiService, and RetrofitInstance manage network communications.
• DTOs (request and response classes) like UserLoginRequestDTO, ForgotPasswordDTO, JwtResponse, etc., facilitate data transfer between the mobile app and the backend.
• Utility/Support Components:
• Utility classes such as DataStoreManager and ConnectionManager help manage device storage and network connectivity.
• Additional classes for validation (UserValidation) and state management (e.g., AuthState) round out the architecture.
Relationships and Data Flow
• User Interaction: The end user interacts with the UI components.
• UI to ViewModel: The UI layers send user events to appropriate view models.
• ViewModel to Repository: View models mediate between the UI and repository layers, enforcing business logic.
• Repository to Service: Repositories call service methods to interact with remote APIs via Retrofit.
• External Backend: Represents the server-side component (mentioned in the README) that processes requests and manages user data.
• Utility Services: Global components (like DataStoreManager) assist across layers (e.g., managing token persistence or network state).
Architectural Patterns & Technologies
• The application follows an MVVM (Model-View-ViewModel) architecture.
• The repository pattern abstracts data sources and encapsulates business logic.
• Retrofit is used for network communication.
• The navigation is handled using the Jetpack Compose navigation component.
• Kotlin and Jetpack Compose are the core development technologies.