How dev-tatsuya/flutter-qiita-client works
Project Type and Purpose
• The project is a Flutter mobile client application that interacts with the Qiita API.
• It implements a layered architecture using Domain, Infra, and Presentation layers. The app is built with Riverpod for state management as highlighted by the accompanying article in the README.
• Additionally, the project is set up with comprehensive testing layers – including Unit, Widget (visual regression), and End-to-End tests (via Maestro) – and is integrated with GitHub Actions for CI execution.
File Structure
• Native Code: The directories “android” and “ios” contain platform-specific configuration and build files. These represent the mobile client wrappers.
• Main Flutter Code: Under the “lib” directory, you have distinct subdirectories:
– domain: Contains Models (e.g., qiita_post.dart, qiita_user.dart, tag.dart), Repository Interfaces, and Service definitions. This is your “business logic” layer.
– infra: Implements the repository and API service functionality including network exception handling and data model serialization. This layer interacts with the external Qiita API.
– presentation: Contains the UI components (pages, widgets, state management, etc.) including the main entry point (app.dart) and various screen implementations.
• Testing: The “test” folder is structured with subdirectories that mirror the code structure—unit tests, widget tests (golden tests), and mocks. There is also a “.maestro” folder for Maestro-based E2E tests.
• CI/CD: The “.github/workflows” contains YAML files for executing unit tests, E2E tests, and visual regression tests (VRT) through GitHub Actions.
• Configuration & Build Tools: Files like Makefile, pubspec.yaml, and .env.template manage build commands, dependencies, and environment variables.
A. Frontend (Presentation Layer):
• “lib/presentation” module representing UI screens, base pages, widget components, and the navigation (page_dispatcher.dart).
• How this layer is the entry point (via lib/main.dart and app.dart) both on native (android / ios) wrappers and Flutter UI.
B. Domain Layer (Business Logic):
• “lib/domain” folder including models (qiita_post, qiita_user, tag) and the repository interface (post_repository.dart) along with service abstractions.
C. Infra Layer (Data Access & API):
• “lib/infra” components which implement the repository (post_repository_impl.dart) and API service (api_service_impl.dart) and handle API calls to Qiita (qiita_api.dart) and error handling.
D. External Services:
• External Qiita API as a service accessed by the Infra layer.
E. Testing and CI/CD Modules:
• Separate testing components:
– Unit tests in the “test” directory that validate both business logic and presentation behavior.
– Widget tests (VRT) using packages like golden_toolkit with image comparison, along with their reporting via reg-suit.
– Integration/E2E tests using Maestro (defined in the “.maestro” directory) to simulate complete UX flows.
• CI jobs as separately triggered components (via GitHub Actions workflows) that automatically execute tests, generate coverage reports, and deploy artifacts.
Relationships and Interactions
• Domain layer components (repositories and service abstractions) with their Infra implementations responsible for web/API calls.
• From the Infra layer, indicate the connection to the external Qiita API.
• For testing, show separate “test modules” that mirror these layers and simulate interactions, as well as CI/CD pipelines triggering these tests.
Architectural Patterns or Design Principles
• Use of clean architecture to separate concerns: UI (presentation) → business logic (domain) → data/API (infra).
• Use of dependency injection or interfaces for the repository and API service that allow for clear isolability and stubbing/mocking in tests.
• Mention that state management is handled via Riverpod (as inferred from the supporting documentation).
Final Advice
• Verify that every key part referenced in the file tree and README (such as the Maestro E2E tests, GitHub Actions workflows, and the separation of concerns in the lib folder) is represented.