nextjs-data-access-layer
Installation
SKILL.md
Data Access Layer (DAL)
Priority: P1 (HIGH)
Centralize all data access (Database & External APIs) to ensure consistent security, authorization, and caching.
Workflow
- Create DAL module in
services/orlib/data.tswithimport 'server-only'. - Verify auth inside every DAL function using
await auth(). - Transform raw DB/API data into DTOs before returning to components.
- Wrap with
cache()from React to deduplicate requests within render cycle. - Taint-check sensitive objects to prevent accidental client exposure.