Repository layout
Package overview
re_ucm_core
Purpose: Define core domain models and interfaces that are shared across all packages. Location:re_ucm_core/lib/
Key contents:
re_ucm_lib
Purpose: Provide shared services that implement common business logic used across the application. Location:re_ucm_lib/lib/
Key contents:
- PortalFactory (
portals/portal_factory.dart:3) - Central registry for all portal implementations - PortalSession (
portals/portal_session.cg.dart:7) - MobX-observable wrapper for portal state - RecentBooksService (
recent_books/recent_books_service.cg.dart:10) - Tracks recently viewed books - SettingsService (
settings/settings_service.dart:7) - Manages app settings and portal credentials
re_ucm_core, mobx, sembast
re_ucm_app
Purpose: Main Flutter application containing UI, features, and application-level logic. Location:re_ucm_app/lib/
Key contents:
presentation/- UI components and controllersdomain/- Business logic (if needed)data/- Data sources (if needed)
re_ucm_core, re_ucm_lib, flutter, portal packages
re_ucm_author_today
Purpose: Portal module implementing Author.Today book source. Location:re_ucm_author_today/lib/
Key contents:
- Portal class (
re_ucm_author_today.dart:6) - ImplementsPortal<ATSettings> - Service class (
author_today_service.dart:11) - ImplementsPortalService<ATSettings> - Settings model - Extends
PortalSettings, stores auth tokens - API client - Retrofit-based HTTP client for portal API
- Domain logic - Parsers, decryption, validation
re_ucm_core, dio, retrofit
Dependency graph
re_ucm_corehas zero dependencies on other ReUCM packagesre_ucm_libdepends only onre_ucm_core- Portal packages depend only on
re_ucm_core re_ucm_appdepends on all other packages
Adding new portal modules
When the number of portal modules grows, they will be moved to a dedicated directory structure:README.md:43), portal modules will be reorganized into a separate directory as more are added.
Monorepo tooling
Workspace management
The rootpubspec.yaml manages shared dependencies:
pubspec.lock file, ensuring consistent dependency versions.
Code generation
Several packages use code generation:- MobX -
*.cg.dartfiles for reactive state management - Retrofit - API client generation
- JSON serialization - Model serialization/deserialization
Development workflow
- Core changes - Modify
re_ucm_core/when adding new domain concepts - Service changes - Update
re_ucm_lib/for shared business logic - Portal changes - Work in specific portal package (e.g.,
re_ucm_author_today/) - App changes - Implement features in
re_ucm_app/
Package conventions
Naming
- Core package:
re_ucm_core - Library package:
re_ucm_lib - Portal packages:
re_ucm_<portal_name>(lowercase, underscores) - App package:
re_ucm_app
File organization
- Use barrel files (e.g.,
book.dart,portal.dart) to re-export related models - Group by feature/domain, not by technical role
- Keep
lib/directory relatively flat for small packages
Code generation files
- Generated files use
.cg.dartextension - Source files use
.dartextension - Always commit generated files to version control
Benefits of this structure
Modularity
Each portal is an independent package that can be:- Developed separately
- Tested in isolation
- Updated without affecting others
- Disabled by removing from registration
Reusability
- Core models shared across all portals
- Services reused by all features
- UI components shared across features
Maintainability
- Clear boundaries between packages
- Minimal coupling between portal implementations
- Changes isolated to relevant packages
Scalability
- Easy to add new portals
- Feature folders scale independently
- Services remain focused and simple