How phongwild/nettromdex works
Main Components
• Frontend (User Interface):
• Flutter UI elements including: screens (found under lib/feature/screens), widgets (lib/feature/widgets and lib/core_ui), and design system components.
• Navigation and routing: Managed by the router modules (lib/feature/router and lib/global/router).
• State management: Implemented via Cubits (in lib/feature/cubit) that maintain UI state (auth, manga listings, detail pages, etc.).
• Domain/Business Logic Layer:
• Use cases (lib/domain/usecase) that encapsulate business rules (for example, account authentication and manga retrieval).
• Domain repositories (lib/domain/repository) which define interfaces to be implemented in the data layer.
• Environment configuration (lib/domain/env_config) for handling API endpoints and different URL types.
• Data/Repository Layer:
• Model definitions and request/response handling, based in lib/data/models and lib/data/request.
• Repository implementations (lib/data/repository) that communicate with remote services.
• Network/External Integration:
• REST client and networking modules (lib/core/networking) that integrate with MangaDex API.
• Usage of interceptors (logger, retry, session management, error handling) to manage HTTP requests.
• Socket communications (lib/core/socket) for real-time features such as updating chapters.
• Core Services & Utilities:
• Caching and local storage (lib/core/cache, with secure storage and shared preferences).
• Analytics and tracking (lib/core/analytics) including integration with Firebase.
• Dependency injection and initialization (lib/global/init_app) that structure how various parts of the application are wired together.
• Global configurations such as internationalization (l10n files, lib/global/l10n) and theming (lib/core_ui/app_theme).
Relationships and Interactions
• The UI (presentation layer) interacts with Cubits/blocs, which in turn call the domain use cases.
• Use cases invoke repository functions; repositories abstract the data sources (network API calls or local caches).
• The networking layer handles HTTP requests with configurable interceptors to manage common error handling, session management, and logging.
• Analytics and socket connection modules run in parallel to capture user events and real-time updates.
• All dependencies are managed via the dependency injector (lib/global/init_app/injector* files) to provide controllable service construction and mocking for testing.
Highlighting Architectural Patterns and Design Principles
• Layered/Clean Architecture: Present a clear separation between presentation, domain, and data layers. This improves maintainability and testability.
• Dependency Injection: Used for wiring together services and managers.
• Repository Pattern: Abstracts data sources (remote MangaDex API and local caches) behind well-defined interfaces.
• State Management: Implemented using Cubit (or a similar pattern) for managing UI state in reaction to data changes.
• Multi-platform Configuration: Note that the project contains directories for Android, iOS, Linux, macOS, Windows, and Web, highlighting Flutter’s cross-platform nature.