What is Rails API mode?

Answer

Rails API mode creates a stripped-down Rails application optimized for JSON APIs, without views, asset pipeline, cookies, or browser session middleware. Create with rails new myapi --api. Controllers inherit from ActionController::API instead of ActionController::Base, which excludes view rendering and browser-specific middleware. Responses use render json:. Pair with Active Model Serializers or Jbuilder for structured JSON responses, or use jsonapi-serializer for JSON:API compliance. API mode is faster per request and smaller memory footprint than full Rails.