api-filters

Community

Design list APIs with composable filters

AuthorjohinsDev
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It solves the problem of messy, duplicated list-query logic by providing a consistent three-layer feature structure and a reusable filtering mechanism for paginated endpoints.

Core Features & Use Cases

  • Router → Service → Repository separation: keep tRPC wiring, business rules, and Drizzle database access cleanly partitioned so each layer is easier to evolve and test.
  • Composable filter classes: implement one filter per key and apply them consistently across both row queries and total-count queries.
  • Pagination contract with filtered totals: return { rows, total } where the total matches the active filters, using the same filter set for both queries.
  • Use case: refactor an existing inline Drizzle router into a features/<name>/ folder shape, then add new list filters without touching unrelated router/service code.

Quick Start

Tell the AI to scaffold a new @loyalty/api feature folder using the filters pattern so a list endpoint supports filterable search and returns paginated rows plus a filter-aware total count.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: api-filters
Download link: https://github.com/johinsDev/loyalty-app/archive/main.zip#api-filters

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.