- Ruby 3.1.2
- Ruby on Rails 7.0.3.1
- PostgreSQL 14.0
- Redis 4.6.0
- Webpacker 4.3.0
- Hotwire 0.1.3
- Turbo 1.1.1 (yarn)
- Stimulus 3.0.1 (yarn)
- React 18.2.0 (yarn)
- Bootstrap 5.2.0 (yarn)
Building from scratch (Not cloning or forking)
$ ruby -v
$ rails -v
$ rails new PROJECT_NAME -d=postgresql --webpacker=react
$ pg_config --version
$ npm view react version
- Devise + Rolify + Cancan
- ViewComponent
- Action Text (trix)
- will_paginate
- Chartkick + Chart.js
- Groupdate
- Ahoy
- Geocoder + maxminddb
- PGHero
- Rspec + Simplecov
- Brakeman + bundler_audit
- Figaro
- bootstrap-icons
- react-cookienotice
PGHero: root/pghero (See /config/routes.rb)
Brakeman + bundler_audit
$ brakeman
$ brakeman -o brakeman.html
$ open brakeman.html
$ bundler-audit
Rspec + Simplecov
$ rspec
$ rspec spec/models/user_spec.rb
$ open coverage/index.html
Replace google analytics ID
If you don't want to verify email, comment out :confirmable in the user model and edit db/seeds
Search and replace in project:
rails_react_bootstrap
- config/cable.yml
- config/database.yml
- config/environments/production.rb
rails-react-bootstrap
- config/database.yml
- config/environments/production.rb
- package.json
- app/javascript/packs/components/cookieBanner.jsx
- app/views/devise/mailer/confirmation_instructions.html.erb
- app/views/devise/mailer/email_changed.html.erb
- app/views/devise/mailer/password_change.html.erb
- app/views/devise/mailer/reset_password_instructions.html.erb
- app/views/devise/mailer/unlock_instructions.html.erb
- app/views/layouts/mailer.html.erb
- app/views/layouts/application.html.erb
RAILSREACTBOOTSTRAP
- app/mailers/application_mailer.rb
- config/application.rb
- config/database.yml
- config/initializers/devise.rb
RRB
- app/views/devise/mailer/confirmation_instructions.html.erb
- app/views/pages/terms_and_conditions.html.erb
- app/views/pages/welcome.html.erb
- app/views/report_mailer/daily.html.erb
- app/views/shared/_footer.html.erb
Run
$ bundle install
$ yarn install
$ rails db:create
$ rails db:seed
$ rails s
$ bin/webpack-dev-server (separate tab)
Rename config/example_application.yml -> config/application.yml and define variables (figaro and .gitignore already set)
Resetting database
$ rails db:drop db:create db:migrate RAILS_ENV=development
$ rails db:seed
Importing Heroku database
$ rails db:environment:set RAILS_ENV=development
$ rails db:drop db:create db:migrate RAILS_ENV=development
$ heroku pg:backups capture DATABASE_URL
- DATABASE_URL is in your Heroku dashboard config variables. It is a valid Heroku option, so you do not need to change the above command
$ curl -o latest.dump `heroku pg:backups public-url`
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U LOCAL_USERNAME -d DATABASE_NAME latest.dump
- get YOUR_USERNAME on your local machine
- DATABASE_NAME can be your development/test/production db (Ex. rails_react_bootstrap_development) from your config/database.yml file.
The Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli
Buildpacks: heroku/nodejs | heroku/ruby
Add-ons (free): Heroku Postgres | Heroku Redis | Heroku Scheduler | Rollbar | Papertrail
example_application.yml -> personalize config vars in your heroku dashboard
$ heroku git:remote -a your_app_name
$ git remote rename heroku production
$ git push production master
$ heroku run rake db:schema:load
$ heroku run rake db:seed
$ heroku run rake db:migrate
$ heroku logs --tail
$ heroku restart
$ heroku run rails c
$ heroku run rake clean_ahoy
$ heroku run rake deliver_daily