phoenix-json-api

Automate JSON API patterns in Phoenix controllers, routers, and responses.

149|15|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-json-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-json-api
Source: https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/phoenix-json-api
Command: npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-json-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardize and secure JSON API development in Phoenix by providing enforced patterns, consistent error handling, and scalable rendering for API responses.

Core Features & Use Cases

  • API pipeline and routing guidelines to ensure JSON-only endpoints with proper CSRF handling and session avoidance.
  • Structured error rendering via a FallbackController and consistent changeset errors.
  • Pagination, versioning, and token-based authentication patterns for production-grade APIs.
  • Real-world use: building a versioned posts API with public/private endpoints and standardized responses.

Quick Start

Scaffold an API endpoint using the api pipeline and implement JSON responses with proper error handling.

Frequently Asked Questions about phoenix-json-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a versioned JSON API in Phoenix?

Structure a versioned JSON API in Phoenix by routing requests through versioned scopes within an api pipeline. This approach organizes controllers and routing logic to maintain backward compatibility while separating public and private endpoints.

What is the best way to handle JSON API errors in Elixir?

Handle JSON API errors in Elixir by implementing a FallbackController to centralize structured error rendering. This ensures changeset validation failures produce consistent JSON output across all endpoints rather than raw validation responses.

How do I add Bearer token authentication to a Phoenix controller?

Add Bearer token authentication to a Phoenix controller by enforcing it within the api pipeline. This secures private endpoints by intercepting requests and validating tokens before the controller action executes.

Does building a JSON API with Phoenix require disabling CSRF protection?

Building a JSON API with Phoenix requires proper CSRF handling and session avoidance configured in the api pipeline. This stateless approach ensures endpoints process JSON-only interactions without browser session overhead.

How do I implement pagination for API responses in Elixir?

Implement pagination for API responses in Elixir by applying standardized pagination patterns within Phoenix controllers. This structures large dataset queries to return paginated JSON metadata alongside the requested resource records.