Task: Creator Discovery & Search — Relevance, Indexes, Safe Public DTOs (Hard)
Overview
Discover needs a real search API. Ship indexed, ranked-ish discovery with filters, featured stub, strict public DTOs (no PII), and abuse-resistant pagination — not ILIKE %q% full scans without indexes/docs.
Scope (must all ship)
Endpoints
GET /api/v1/creators/search?q&category&page&limit&sort
GET /api/v1/creators/featured?limit — deterministic stub (recently onboarded / manual flag)
- Public only; no auth required
Query behavior
- Match handle prefix + displayName (document ranking: exact handle > prefix > displayName)
- Category filter
- Exclude non-onboarded / deleted users
sort: relevance | newest | popular (popular may stub via subscriberCount if available)
- Empty
q returns paginated onboarded catalog
Performance
- Add DB indexes supporting prefix search (e.g.
LOWER(handle) text_pattern_ops / trigram if extension OK — document choice)
- Cap
q length; sanitize %/_ wildcards
- Limit max page size
DTO security
- Public creator card: handle, displayName, bio excerpt, avatar, category, counts — never email/password/tokens
Testing (≥12)
- Prefix handle match
- Category filter
- Non-onboarded excluded
- Empty q pagination
- Featured limit
- Wildcard injection doesn’t explode results
- PII absent from response (assert keys)
- sort newest
- Invalid category 400 or empty (document)
Deliverables
CreatorSearchService, indexes/migration, Swagger, docs/creator-search.md, ≥12 tests
Acceptance Criteria
Out of scope
- Elasticsearch/OpenSearch cluster
- Personalized recommendations
Task: Creator Discovery & Search — Relevance, Indexes, Safe Public DTOs (Hard)
Overview
Discover needs a real search API. Ship indexed, ranked-ish discovery with filters, featured stub, strict public DTOs (no PII), and abuse-resistant pagination — not
ILIKE %q%full scans without indexes/docs.Scope (must all ship)
Endpoints
GET /api/v1/creators/search?q&category&page&limit&sortGET /api/v1/creators/featured?limit— deterministic stub (recently onboarded / manual flag)Query behavior
sort:relevance | newest | popular(popularmay stub via subscriberCount if available)qreturns paginated onboarded catalogPerformance
LOWER(handle) text_pattern_ops/ trigram if extension OK — document choice)qlength; sanitize%/_wildcardsDTO security
Testing (≥12)
Deliverables
CreatorSearchService, indexes/migration, Swagger,docs/creator-search.md, ≥12 testsAcceptance Criteria
Out of scope