How chuymaster/thaivtuberranking-frontend works
Main Components Identification
• Frontend (Flutter UI):
• Presentational components are located under lib/pages (with subdirectories like channel, home, live, video_ranking, etc.) and include UI widgets, pages, and components.
• Administrative UI components found under lib/admin (pages for authentication, channel management, channel requests).
• Business Logic / View Models:
• Each feature (channel, channel ranking, channel registration, live, etc.) has its corresponding view model (e.g., channel_view_model.dart, home_view_model.dart, video_ranking_view_model.dart). These encapsulate UI state and business logic.
• Data Layer / Repositories:
• The repositories in each domain (e.g., channel_repository, channel_management_repository, channel_request_repository, video_ranking_repository) abstract API calls and local data manipulations.
• Service Layer:
• Shared services like analytics, URL launching, routing, and environment settings are implemented under lib/services.
• State Management / Providers:
• Global state and data are provided via lib/providers (e.g., channel_list_provider).
• Localization:
• The localization support is managed in lib/l10n and lib/gen_l10n using generated localization files plus a helper class (L10n).
• Configuration and Build:
• Build/deployment related files include Makefile, CI/CD pipelines in .github workflows, and web configuration in the web folder.
• Testing:
• Corresponding unit and widget tests are located in the test directory.
Relationships and Interactions
• The UI (Flutter widgets) interacts with the corresponding View Models which encapsulate the business logic.
• View Models call into Repositories that manage data fetching and processing from APIs or local data.
• Providers supply shared data, as seen in the channel_list provider.
• Services (analytics, routing, URL launching) support cross-cutting concerns and interact with both UI and backend endpoints.
• Localization modules (lib/l10n and gen_l10n) are integrated into UI widgets to manage language and translations.
• Administrative components are separated logically and may have distinct routing and authentication mechanisms, as evidenced by the different directories under lib/admin.
Architectural Patterns and Design Principles
• MVVM Pattern: Clear separation between UI (views) and business logic (view models).
• Repository Pattern: Abstraction of network/data operations to dedicated repository classes.
• Modular Design: Separation of concerns across pages, components, services, and providers.
• Localization and Internationalization: Central management of multi-language support.
• Automated Testing and CI/CD: Presence of tests, GitHub workflows for build, test, and deployment.
Technologies, Frameworks, and Libraries
• Flutter for Web (UI framework).
• Dart as the programming language.
• Mocking via Mockito (for unit tests).
• GitHub Actions for CI/CD automation, along with Netlify for deployment.
• Built-in localization framework provided by Flutter, leveraging ARB files.
• Firebase options file indicates potential integration for analytics or authentication.
• The Makefile for local command tasks and build orchestration.