LogoSkills

feature-book_content_viewer

book_content_viewer feature brick โ€” book content viewer (mason make feature-book_content_viewer). Use when scaffolding or extending the kobic book viewer module.

feature-book_content_viewer#

ํ•œ๋งˆ๋””๋กœ (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

์ „์ž์ฑ… ๋ทฐ์–ด ํ™”๋ฉด์„ ์ฒ˜์Œ๋ถ€ํ„ฐ ์†์œผ๋กœ ๋งŒ๋“œ๋Š” ๋Œ€์‹ , ๋ฏธ๋ฆฌ ์งœ๋‘” ์„ค๊ณ„๋„๋กœ ํ•œ ๋ฒˆ์— ์ฐ์–ด๋‚ด๋Š” ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ๋งˆ์น˜ ๋ชจ๋ธ ํ•˜์šฐ์Šค ๊ณจ์กฐ๋ฅผ ์ž๋™์œผ๋กœ ์„ธ์›Œ ์ฃผ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ, ์ฑ…์„ ๋„˜๊ธฐ๊ณ  ์ฝ๋Š” ํ™”๋ฉด์— ํ•„์š”ํ•œ ๊ธฐ๋ณธ ๋ผˆ๋Œ€์™€ ๋ถ€ํ’ˆ(์„œ๋ฒ„ ์—ฐ๊ฒฐ, ํ™”๋ฉด, ๋ฐ์ดํ„ฐ ์ €์žฅ ๋“ฑ)์„ ์ž๋™์œผ๋กœ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค. ๊ฐœ๋ฐœ์ž๋Š” ์ด ์œ„์— ์„ธ๋ถ€ ๊ธฐ๋Šฅ๋งŒ ๋‹ค๋“ฌ์œผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

๋ฌด์—‡์„ยท์–ธ์ œ (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

  • ๋ฌด์—‡์„ ํ•ด ์ฃผ๋‚˜์š”: ์ „์ž์ฑ…(PDF) ๋ทฐ์–ด์— ํ•„์š”ํ•œ ํ•ต์‹ฌ ๊ธฐ๋Šฅ๋“ค์„ ํ•œ ๋ฒˆ์— ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํŽ˜์ด์ง€ ๋„˜๊ธฐ๊ธฐ(PDF ๋ Œ๋”๋ง), ์ฑ…๊ฐˆํ”ผ(๋ถ๋งˆํฌ), ์†๊ธ€์”จ ๋ฉ”๋ชจ(ํ•„๊ธฐ), ํ˜•๊ด‘ํŽœ(๋งˆ์ปค), ์–ด๋””๊นŒ์ง€ ์ฝ์—ˆ๋Š”์ง€ ๊ธฐ๋ก(์ฝ๊ธฐ ์ง„ํ–‰๋ฅ ), ์Œ์„ฑ์œผ๋กœ ์ฝ์–ด ์ฃผ๊ธฐ(TTS), ์•ฑ ์•ˆ์—์„œ ์ฑ…์„ ๊ตฌ๋งคํ•˜๋Š” ๊ฒฐ์ œ ๊ธฐ๋Šฅ๊นŒ์ง€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
  • ํ•จ๊ป˜ ๋งŒ๋“ค์–ด ์ฃผ๋Š” ๊ฒƒ: ํ™”๋ฉด(์•ฑ)๋ฟ ์•„๋‹ˆ๋ผ ๋’ค์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ์„œ๋ฒ„ ์ชฝ ๋ชจ๋“ˆ๋„ ๊ฐ™์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
  • ์–ธ์ œ ์“ฐ๋‚˜์š”: ์ƒˆ ์ „์ž์ฑ… ๋ทฐ์–ด ๊ธฐ๋Šฅ์„ ์ฒ˜์Œ ๋งŒ๋“ค๊ธฐ ์‹œ์ž‘ํ•  ๋•Œ, ๋˜๋Š” ๊ธฐ์กด ๋ทฐ์–ด ๋ชจ๋“ˆ์„ ํ™•์žฅํ•˜๊ฑฐ๋‚˜ ๋น„์Šทํ•œ ํ™”๋ฉด์„ ๋น ๋ฅด๊ฒŒ ๋˜ ํ•˜๋‚˜ ๋งŒ๋“ค ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ์–ด๋–ป๊ฒŒ ์‹œ์ž‘ํ•˜๋‚˜์š”: ์ •ํ•ด์ง„ ๋ช…๋ น์–ด(mason make ...) ํ•œ ์ค„์„ ์‹คํ–‰ํ•˜๋ฉด, ์ฑ… ์ด๋ฆ„์ด๋‚˜ ๋ชจ๋“ˆ ์ด๋ฆ„ ๊ฐ™์€ ๊ฐ’์— ๋งž์ถฐ ํŒŒ์ผ๊ณผ ํด๋”๊ฐ€ ์ž๋™์œผ๋กœ ์ฑ„์›Œ์ง‘๋‹ˆ๋‹ค.

ํ•ต์‹ฌ ์šฉ์–ด (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

์šฉ์–ด์‰ฌ์šด ์„ค๋ช…
feature (ํ”ผ์ฒ˜)ํ•˜๋‚˜์˜ ๊ธฐ๋Šฅ ๋ฌถ์Œ. ์—ฌ๊ธฐ์„œ๋Š” "์ „์ž์ฑ… ๋ทฐ์–ด" ๊ธฐ๋Šฅ ํ•œ ์„ธํŠธ๋ฅผ ๋งํ•ฉ๋‹ˆ๋‹ค.
brick / mason make๋ฏธ๋ฆฌ ๋งŒ๋“ค์–ด ๋‘” ํ‹€(brick)๋กœ ์ฝ”๋“œ๋ฅผ ์ž๋™ ์ƒ์„ฑํ•˜๋Š” ๋„๊ตฌ. ๋นตํ‹€๋กœ ๋นต์„ ์ฐ์–ด๋‚ด๋Š” ๊ฒƒ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.
PDF rendering (๋ Œ๋”๋ง)PDF ํŒŒ์ผ์„ ํ™”๋ฉด์— ๋ณด๊ธฐ ์ข‹๊ฒŒ ๊ทธ๋ ค์„œ ๋„์›Œ ์ฃผ๋Š” ์ž‘์—….
Bookmark (๋ถ๋งˆํฌ)์ฑ…๊ฐˆํ”ผ. ๋‚˜์ค‘์— ๋‹ค์‹œ ์ฐพ์•„์˜ฌ ์ˆ˜ ์žˆ๊ฒŒ ํŽ˜์ด์ง€๋ฅผ ํ‘œ์‹œํ•ด ๋‘๋Š” ๊ธฐ๋Šฅ.
Scribble (์Šคํฌ๋ฆฌ๋ธ”)ํ™”๋ฉด์— ์ง์ ‘ ์†์œผ๋กœ ์“ฐ๋Š” ๋ฉ”๋ชจ๋‚˜ ๊ทธ๋ฆผ(ํ•„๊ธฐ).
Marker (๋งˆ์ปค)ํ˜•๊ด‘ํŽœ์ฒ˜๋Ÿผ ๋ณธ๋ฌธ์— ์ƒ‰์น ํ•ด ๊ฐ•์กฐ ํ‘œ์‹œ๋ฅผ ๋‚จ๊ธฐ๋Š” ๊ธฐ๋Šฅ.
Reading progress (์ฝ๊ธฐ ์ง„ํ–‰๋ฅ )์ฑ…์„ ์–ด๋””๊นŒ์ง€ ์ฝ์—ˆ๋Š”์ง€ ์œ„์น˜๋ฅผ ๊ธฐ์–ตํ•ด ๋‘๋Š” ๊ธฐ๋Šฅ.
TTSText To Speech, ๊ธ€์ž๋ฅผ ์†Œ๋ฆฌ ๋‚ด์–ด ์ฝ์–ด ์ฃผ๋Š” ์Œ์„ฑ ์ฝ๊ธฐ ๊ธฐ๋Šฅ.
In-app purchase (์ธ์•ฑ ๊ฒฐ์ œ)์•ฑ ์•ˆ์—์„œ ์ฑ…์ด๋‚˜ ์ด์šฉ๊ถŒ์„ ๋ฐ”๋กœ ๊ตฌ๋งคํ•˜๋Š” ๊ฒฐ์ œ ๊ธฐ๋Šฅ.
Backend / Serverpodํ™”๋ฉด ๋’ค์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ์ฃผ๊ณ ๋ฐ›๋Š” ์„œ๋ฒ„. Serverpod๋Š” ๊ทธ ์„œ๋ฒ„๋ฅผ ๋งŒ๋“œ๋Š” ๋„๊ตฌ์ž…๋‹ˆ๋‹ค.
Entity (์—”ํ‹ฐํ‹ฐ)๋‹ค๋ฃจ๋Š” ํ•ต์‹ฌ ๋ฐ์ดํ„ฐ ํ•œ ๋ฉ์–ด๋ฆฌ(์˜ˆ: ์ฑ… ํ•œ ๊ถŒ, ์ง„ํ–‰ ์ƒํ™ฉ)๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ด๋ฆ„.
Clean Architecture์ฝ”๋“œ๋ฅผ ์—ญํ• ๋ณ„๋กœ ์นธ์„ ๋‚˜๋ˆ  ๊น”๋”ํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋Š” ์„ค๊ณ„ ๋ฐฉ์‹. ์ •๋ฆฌ์ •๋ˆ๋œ ์„œ๋ž์žฅ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.
snake_case / PascalCase ์ด๋ฆ„์„ ์ ๋Š” ํ‘œ๊ธฐ ๊ทœ์น™. ๋‹จ์–ด๋ฅผ ๋ฐ‘์ค„๋กœ ์ž‡๊ฑฐ๋‚˜(์˜ˆ: book_content), ๋‹จ์–ด๋งˆ๋‹ค ์ฒซ ๊ธ€์ž๋ฅผ ๋Œ€๋ฌธ์ž๋กœ(์˜ˆ: BookContent) ์”๋‹ˆ๋‹ค.

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#

VariableTypeDefaultDescription
project_namestring-Project name (snake_case)
org_namestring-Organization name
org_tldstringcomTop-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

Modern path. Generate this feature full-stack with cob compose -m feature.yaml โ€” the backend comes from the backend_feature brick (13 backend: file toggles) plus one b-entity per models.entities, and cob auto-registers routes + the melos workspace. See the plugin README โ†’ Generation Workflows.

Backend genericization (Epic #83). This feature has no dedicated has_X flag in the embedded serverpod_backend brick yet โ€” Epic #83 wired backend has_X for store, chat, ai_chat, and book_content_reader only (broader frontendโ†”backend gating is a planned S2 follow-up, coco-de/bricks#85). A composed backend module is still produced via backend_feature when declared in feature.yaml.

primary_entity / secondary_entity are not raw Mason brick vars โ€” pass them via cob apply --primary-entity/--secondary-entity or declare them under models.entities in feature.yaml.

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