Generates a Clean Architecture-based feature module for book content viewer functionality. A large-scale feature module that includes all core e-book viewer features such as PDF page rendering, bookmarks, scribbles, markers, reading progress management, TTS, and in-app purchases.
Quick Start#
mason make feature-book_content_viewer \
--project_name my_app \
--org_name myorg \
--feature_name book_content_viewer
# Generate with custom entity name
mason make feature-book_content_viewer \
--feature_name ebook_viewer \
--primary_entity EbookContent \
--secondary_entity ViewerProgress
Variables#
| Variable | Type | Default | Description |
|---|---|---|---|
project_name | string | - | Project name (snake_case) |
org_name | string | - | Organization name |
org_tld | string | com | Top-level domain |
feature_name |
string | book_content_viewer | Feature module name (snake_case) |
primary_entity |
string | BookContent | Primary domain entity name (PascalCase) |
secondary_entity |
string | ReadingProgress | Secondary domain entity name (PascalCase) |
Generated Structure#
feature/application/{feature_name}/
âââ lib/
â âââ {feature_name}.dart
â âââ src/
â âââ data/ # Repository implementation
â âââ domain/ # Entity, UseCase, Repository Interface
â âââ presentation/ # BLoC, Page, Widget
â âââ route/ # GoRouter TypedRoute
â âââ di/ # Dependency Injection
âââ test/ # Unit, BDD tests
Backend Module#
A Serverpod backend module is generated alongside:
backend/ { { project_name } } _server/lib/src/feature/ { { feature_name } } /
âââ endpoint/ # CRUD endpoints
âââ service/ # Business logic
âââ model/ # Entity, DTO (.spy.yaml)
âââ exception/ # Exception handling
âââ validation/ # Input validation
âââ test/ # Tests
Key Components#
Domain#
- Entities: PageViewModel, PdfImageCacheManager
- UseCases: Book(Get, CheckPurchase), Bookmark(Toggle, Get, Update, Delete), Scribble(Save/Load/Delete Local, Upload/Download Server, Merge/Split), Marker(Create, Update, Delete, GetPage, GetTotal), PDF(Download, Merge, ClearCache), Payment(ChargeWallet, GetPackages, GetBalance, GetCoupons, ValidateCoupon, Purchase), Progress(Get, Update), TTS(Speak, Stop), ScreenProtectToggle
-
Repositories:
IBookContentViewerRepository,IBookmarkRepository,IPdfMarkerRepository,IS3OperationRepository,IScribbleRepository,ITextHighlightRepository
Presentation#
-
BLoC:
BookContentViewerBloc,ScribbleBloc,ViewerPaymentBloc - Pages: BookContentViewerPage
Customization#
Changing the feature_name variable automatically updates all file names, class names, and import paths:
mason make feature-book_content_viewer --feature_name pdf_viewer