Rails 5 API + ActiveAdmin + Create React App on Heroku
App built following Charlie Gleason's tutorial.
- Create Rails app in API mode
- Make
ApplicationControllerinherit fromActionController::Base - Add
ApiController(our controllers will inherit from this one) - Add middleware config for
Flash,CookiesandCookieStoretoapplication.rb(see) - Add Devise and ActiveAdmin gems, and install
create-react-app client- Add config to
package.jsonto proxy API calls to Rails backend (see)
- Create Rails models and relationships
- Generate ActiveAdmin resources and permit params
- Set up Rails routes
- Seed database
- Limit retrieved data in controllers (only retrieve what we need for the frontend)
- Add
web:command to start React (see) - Add
api:command to start Rails (see) - Run Procfile locally with:
heroku local -f Procfile.dev - Create Rake task to run Procfile.dev (see)
- Normal React app implementation
- Add
package.jsonto the root folder to tell Heroku how to compile React (see) - Use
heroku-postbuildcommand to run scripts
- Add
config/secrets.ymlwithsecret_key_baserequired by Devise - Use Heroku buildpacks to run two build processes in a specific order (Node first)
- Tell Rails to pass any HTML requests that it doesn't catch to React (see)
- Implement React Router