Base application for Ruby on Rails 6 projects. Built to minimize the time spent writing boilerplate code and performing repetitive setup tasks.
Base application for Ruby on Rails 6 projects. Built to minimize the time spent writing boilerplate code and performing repetitive setup tasks.
Base or "skeleton" application for Ruby on Rails 6.1 projects. Built to minimize the time spent writing boilerplate code and performing repetitive setup tasks.
It comes with a preselected set of tools which I believe to be the most effective and widely used. If you are looking for greater flexibility, an application template which uses Rails's templating system such as Rails Composer should be a better fit as it allows the user to choose which templating engine, test framework, JS framework and other tools to use.
Although this project is opinionated regarding tool choices, community feedback and contributions are always welcome and highly appreciated.
It consists of a Rails 6.1.4 app, including:
A selection of useful gems for development and debugging such as rubocop, brakeman, awesome_print, byebug, and better_errors.
Preconfigured test environment, including:
Preconfigured authentication with the Devise gem.
Preconfigured authorization with the Pundit gem.
Internationalization (i18n)
jQuery
HTML Layouts developed with Bootstrap 3 (bootstrap-sass gem) to use as a starting point, including:
Controller concerns such as SkipAuthorization.
User-friendly error messages (flash) on exceptions such as
ActiveRecord::DeleteRestrictionError and Pundit::NotAuthorizedErrorand.
User management interface for admins in /admin/users with pagination
(kaminari gem) and searching/filtering
(ransack
gem). Accessible only by
users with "admin" role.
Seed users for the development environment.
Contact form built with the mail_form gem.
E-mails "sent" in the development environment are saved as html files in
tmp/letter_opener (letter_opener
gem).
The following JavaScript libraries:
data-confirm confirmation by a
better-looking version.SCSS utility classes for alignment, spacing and font size standardization. See app/assets/stylesheets/utility-classes.scss.
High test coverage.
Setup tasks such as configuring time zones, default locale and action mailer (e.g., SMTP or transactional e-mail service) are not included in the following steps as they are not specific to this base app.
Fork this repository.
Clone the forked repository to your machine.
Rename the application:
config/application.rb
from ZenRailsBaseApp to your application name, in camel case.zen_rails_base_app by your_app_name ZEN_RAILS_BASE_APP by YOUR_APP_NAMEProject Name by the project's name[email protected] manually by the different e-mail addresses
that should send and receive e-mails in various parts of the
application.Run bundle install to install the gems listed in the Gemfile and their
dependencies.
Run yarn install to install the front end (JavaScript) packages listed
in packages.json and their dependencies.
Configure the databases:
If using PostgreSQL, uncomment the pg gem from the Gemfile. If
using MySQL, uncomment the mysql2 gem.
Uncomment the section of config/database.yml corresponding to your
chosen DBMS.
If you don't have a DB user (with a password) yet, create one.
Edit the following fields ofconfig/database.yml:
database.developmentdatabase.testdefault.usernamedefault.passwordBefore attempting to run the application or its test suite, run rails db:create db:migrate db:seed within the project's root directory. That will
create the following seed users:
[email protected] / password: Devpass1[email protected] / password: Devpass1Customise the authentication setup. You may want to change one or more of the following items:
User model also has role, first_name, and last_name attributes. User model has an enum
attribute called role. Its possible values are :user and :admin. The
default value is :user.Customize the application colors by overwriting Bootstrap's variables in
app/assets/stylesheets/global.scss.
Remove unused items from the application, such as gems from the Gemfile,
RSpec helpers, custom matchers and shared examples from spec/support.
Consider going through the Zen Rails Security Checklist before deploying the application to production.
Dockerfile.global.js and
zen-utils.js.Bug reports
Please use the issue tracker to report any bugs.
Developing
Released under the MIT License.
No open issues yet, or sync has not completed.