phoenix-json-api
Installation
SKILL.md
Phoenix JSON API
RULES — Follow these with no exceptions
- Use the
:apipipeline — don't mix HTML and JSON pipelines; API routes skip CSRF, sessions, and browser headers - Render errors as structured JSON —
{:error, changeset}must become{"errors": {...}}; never return raw text or HTML errors - Use offset/limit for pagination — never return unbounded collections; default to a sensible limit (e.g., 20)
- Version APIs via URL prefix (
/api/v1/) — not headers; URL versioning is visible, cacheable, and debuggable - Use
FallbackControllerfor consistent error handling — every action returns{:ok, result}or{:error, reason}; the fallback renders errors - Authenticate via Bearer tokens in
Authorizationheader — not cookies; API clients don't have browser sessions - Use
json/2helper — ensuresContent-Type: application/json; avoidrenderfor simple JSON responses