Boilerplate for Rails 5

Needs for Rails 5 Boilerplate

I’ve been working with Ruby on Rails more than 3 years and I started feel I need a good template to make a rocket start. What I need for the boilerplate is…

  • New Rails version
  • UI: Bootstrap, FontAwesome
  • Nice template engine (Slim or Haml)
  • Includes only basic functions (not fancy features)
  • MySQL
  • Better to have a basic user authentication (Devise gem)

I could find some good boilerplate for Rails, but they’re a bit different from my needs. Some are too small and some are too big to start with. So finally, I created my own Rails 5 boilerplate.

Rails5 Boilerplate top page

Please take a look at Github here:


I chose gems only needed seriously, because there are great gems but you may not use it.


MVC + Service + Decorator

  • Models: app/models
  • Views: app/views
  • Controllers: app/controllers
  • Services: app/services
  • Decorators: app/decorators

The services helps you to keep your class small. The transactions that does not depends on any other models, or that needs to interact with 2 or 3 models, it’s better to put your codes into service class. So that you can separate the codes, and you can keep your model and controller smaller.

And about the decorators, basically it’s better not to put your codes for views into models. The models should have the codes for business logics. But you may need to make some methods to the models, and if it’s not suitable for models, you can put them into decorators folders. It’s like an helper files for the models.

How to use?

$ git clone
$ cd rails5-boilerplate
$ bundle install

After configure your credentials for database connections,

$ bundle exec rake db:create
$ bundle exec rake db:migrate
$ bin/rails server

And you can see the boilerplate top page. You can get more details info from the Github page (Rails5 boilerplate).

Please try it and tell me any suggestions if any. I’m happy if you could give me github star. Thanks.