feature-book_content_search#
한마디로#
책 안에서 원하는 내용을 찾아주는 "검색 기능"을 만들어 주는 도구입니다. 도서관에서 책 한 권을 통째로 읽지 않고도 색인 카드를 넘겨 원하는 페이지를 바로 찾는 것처럼, 이 기능은 책(PDF) 안의 글자를 빠르게 찾아 줍니다. 게다가 책 안에서 못 찾으면 구글, 네이버 같은 외부 검색까지 연결해 줍니다. 개발자가 일일이 손으로 만들 부분을 자동으로 한 번에 만들어 주는 "설계 도면 + 뼈대 자동 생성기"라고 보면 됩니다.
무엇을·언제#
-
무엇을 해주나요?
- 책(PDF) 안의 글자를 검색하는 기능의 기본 코드 골격을 자동으로 만들어 줍니다.
- 책 안 검색뿐 아니라 구글/네이버 같은 외부 검색 연결까지 함께 준비해 줍니다.
- 화면(앱 쪽)부터 서버(백엔드) 쪽까지 필요한 파일들을 한 세트로 만들어 줍니다.
-
언제 사용하나요?
- 새로 "책 내용 검색" 기능을 처음 만들기 시작할 때 (뼈대를 잡을 때).
- 이미 있는 책 내용 검색 모듈을 확장하거나 이름을 바꿔서 비슷한 기능을 또 만들 때.
핵심 용어#
| 용어 | 쉬운 설명 |
|---|---|
| feature(피처)/feature module | 하나의 완성된 기능 묶음. 여기서는 "책 내용 검색" 기능 한 세트 |
| brick(브릭) / mason | 미리 만들어 둔 코드 틀(brick)을 찍어내는 도구(mason). 붕어빵 틀과 반죽처럼, 같은 모양의 코드를 빠르게 생성 |
| scaffold(스캐폴드) | 건물의 비계처럼, 본격 작업 전 자동으로 세워 주는 코드 뼈대 |
| Clean Architecture | 코드를 역할별(화면/규칙/데이터)로 깔끔히 나눠 정리하는 설계 방식 |
| 전자책 등에 쓰는 문서 파일 형식. 여기서는 검색 대상이 되는 책 파일 | |
| Backend / Serverpod | 앱 뒤에서 데이터를 처리하는 서버. Serverpod는 그 서버를 만드는 도구 |
| Entity(엔터티) | 다루는 데이터의 핵심 개념. 예: "검색 결과" 한 건 |
| UseCase(유스케이스) | "구글에서 검색하기"처럼 사용자가 하는 하나의 동작 단위 |
| Repository(리포지토리) | 데이터를 가져오고 저장하는 창구 역할의 코드 |
| BLoC(블록) | 화면의 상태와 동작을 관리하는 부품(예: 검색 중/검색 완료 등을 챙김) |
| Page / Widget | 사용자가 보는 화면(Page)과 그 안의 작은 구성 조각(Widget) |
| GoRouter / Route | 앱에서 어느 화면으로 이동할지 길을 안내하는 길잡이 |
| Dependency Injection(DI) | 필요한 부품을 알아서 끼워 넣어 주는 연결 방식 |
| Unit / BDD test | 코드가 제대로 동작하는지 자동으로 점검하는 검사들 |
| snake_case / PascalCase | 이름 표기 규칙. 예: book_content_search(스네이크), PdfSearchResult(파스칼) |
Generates a Clean Architecture-based feature module for book content search functionality. Provides integrated search features including in-PDF text search and Google/Naver external search integration.
Quick Start#
mason make feature-book_content_search \
--project_name my_app \
--org_name myorg \
--feature_name book_content_search
# Generate with custom entity name
mason make feature-book_content_search \
--feature_name content_search \
--primary_entity ContentSearchResult
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_search | Feature module name (snake_case) |
primary_entity |
string | PdfSearchResult | Primary 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 thebackend_featurebrick (13backend:file toggles) plus oneb-entitypermodels.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_Xflag in the embeddedserverpod_backendbrick yet — Epic #83 wired backend has_X forstore,chat,ai_chat, andbook_content_readeronly (broader frontend↔backend gating is a planned S2 follow-up, coco-de/bricks#85). A composed backend module is still produced viabackend_featurewhen declared infeature.yaml.
primary_entity/secondary_entityare not raw Mason brick vars — pass them viacob apply --primary-entity/--secondary-entityor declare them undermodels.entitiesinfeature.yaml.
Key Components#
Domain#
- Entities: PdfSearchResult
- UseCases: SearchInGoogle, SearchInNaver, SearchInPdf
- Repository:
IBookContentSearchRepository
Presentation#
- BLoC:
BookContentSearchBloc - Pages: BookContentSearchPage
Customization#
Changing the feature_name variable automatically updates all file names, class names, and import paths:
mason make feature-book_content_search --feature_name content_search