Start your Rails app with some great defaults and gems out of the box.
Jumpstart is a Rails template, so you pass it in as an option when creating a new app.
You'll need the following installed to run the template successfully:
- Ruby 2.6+ (
rbenv
recommended Install rbenv) - bundler (
gem install bundler
) - Rails 6.0.0 (
gem install rails
) - Node.js LTS (
nvm
recommended Install nvm) - Yarn (
brew install yarn
or Install Yarn) - PostgreSQL (
Postgres.app
recommended on OSX https://postgresapp.com)
These are optional and nice to have, but the template will work without them:
- foreman (
gem install foreman
)- DO NOT ADD TO GEMFILE
- terminal-notifier (
gem install terminal-notifier
)- DO NOT ADD TO GEMFILE
To make this the default Rails application template on your system, create a ~/.railsrc
file with these contents:
-d postgresql --skip-coffee --skip-turbolinks -m https://raw.githubusercontent.com/web-ascender/rails-jumpstart/master/template.rb
To generate a Rails application using this template, pass the options below to rails new
, like this:
$ rails new myapp -d postgresql --skip-coffee --skip-turbolinks -m https://raw.githubusercontent.com/web-ascender/rails-jumpstart/master/template.rb
Remember that options must go after the name of the application ("myapp" in this case). The only database supported by this template is PostgreSQL.
If you’ve installed this template as your default (using ~/.railsrc
as described above), then all you have to do is run:
$ rails new myapp
Below is a summary of what this template does. You can check all the features by following the code in template.rb
webpack
(webpacker) to serve all JS and CSS- renames the default
app/javascript
folder toapp/webpacker
- configures default pack in
app/webpacker/packs/application.js
- sprockets (asset pipeline) is left intact to serve images only
- renames the default
- haml / hamlit for view templates
- bootstrap (v4) UI framework
- including jQuery and Popper.js dependencies
$
,jQuery
, andjquery
provided as window globals by default (for 3rd party compatibility)- Provide plugin and expose-loader
- devise for authentication
- generated devise bootstrap-themed views for user login, signup, forgot password, etc
User
model with additional first_name and last_name attributes
- Font Awesome 5 SVG icons
- Required one-time setup for PRO: https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers#installing-pro
- auto-detects if you have the PRO npm auth key configured, fallback to FontAwesome Free icons if PRO not detected
- sidekiq for background jobs
- Web UI mounted at
/admin/sidekiq
by default
- Web UI mounted at
- whenever for cron scheduling
- jb simple and fast JSON views (jbuilder replacement)
- httprb a fast Ruby HTTP client with a chainable API, streaming support, and more
- simple_form form helpers (with Bootstrap v4 theme)
- cocoon form helpers for dynamic nested forms
- local_time for easy formatting of user-facing timestamps
- active_link_to link helpers
- jQuery, jQuery UI
- jQuery UI DatePicker configured out-of-the-box
- also a custom
date_input
simple_form input helper
- also a custom
- select2 dropdown library (with Bootstrap v4 theme)
- axios Promise based HTTP client for AJAX requests
- Nice starter layout based on Bootstrap 4
- Top Shared Navbar
- User menu in upper-right (login, my account, my profile, logout)
- Bottom sticky footer
- Nice rails
flash
messages shown at the bottom of the screen (and auto-hide after a few seconds)
- dotenv-rails for loading ENV vars in development
- annotate for model/route documentation
- bullet for N+1 detection
- better_errors for nicer error pages in development
- awesome_print for nicer console output in development
- meta_request support for RailsPanel chrome extension
.foreman
andProcfile.dev
files to useforeman start
in development
- Devise OmniAuth Google OAuth2 (more info)
- Allows login via Google (in addition to normal devise database users)
This project works by hooking into the standard Rails application templates system, with some caveats. The entry point is the template.rb
file in the root of this repository.
Rails generators are very lightly documented; what you’ll find is that most of the heavy lifting is done by Thor. The most common methods used by this template are Thor’s directory
, copy_file
, template
, run
, insert_into_file
, and gsub_file
.