The Boundary ActiveAdmin Forces: HTML Admin vs API Controllers
ActiveAdmin needs a full Rails web boundary, while API-only endpoints need a lean controller. Compare the two paths to see where sessions, assets, and browser protections belong.
HerokuCharlie GleasonTutorial
Modern Rails applications can combine a Rails 5 API-only backend, ActiveAdmin for CMS capabilities, and a Create React App frontend in one Heroku-hosted project. The tutorial addresses the tension between Rails API mode, which omits views and middleware, and ActiveAdmin’s need to serve HTML and use cookies, flash, sessions, and assets. It restores those pieces by switching ApplicationController to ActionController::Base, adding forgery protection and middleware, reintroducing sprockets, and defining a separate ApiController that retains ActionController::API. The frontend uses Create React App, API proxying during development, React Router for client-side routes, and a build process that serves the compiled app from Rails on Heroku, including a React 404 for unmatched paths. A smoothie-recipes example demonstrates the resulting setup.
Rails API-only mode removes views and middleware that ActiveAdmin requires, while a modern frontend may not need Rails’s asset pipeline or templating system. The tutorial also seeks to combine the API, CMS, frontend, and deployment configuration in a single Heroku-hosted project.
Create a Rails 5 app with API-only mode, restore ActiveAdmin’s required controller behavior, middleware, cookies, sessions, flash, and Sprockets, and use a separate API controller for lightweight API endpoints. Add a Create React App client with development API proxying, React Router, and deployment build steps so the compiled frontend is served alongside Rails on Heroku.
ActiveAdmin can be used with an API-only Rails app by changing ApplicationController to ActionController::Base, enabling forgery protection, restoring required middleware, and reintroducing sprockets/railtie.
A separate ApiController inheriting from ActionController::API preserves the slim API behavior for controllers that do not need ActiveAdmin’s full Rails stack.
Create React App supports development API proxying, while React Router provides client-side routes and a React 404 for paths that Rails does not catch.
Summaries are generated from the original by a language model. Check the original before relying on it.
See the idea
ActiveAdmin needs a full Rails web boundary, while API-only endpoints need a lean controller. Compare the two paths to see where sessions, assets, and browser protections belong.
Keep reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
One useful email. Unsubscribe anytime.