Jason Charnes
Posted on May 18, 2020
When Chris and Andrew first told me about Rails Bytes I thought to myself, "sure Rails can frustrate me sometimes, but it doesn't suck..." 👀
Once I learned that it didn't mean "Rails bites," I stopped what I had set out to work on that raining Sunday and shifted all my attention to Rails Bytes.
Rails Bytes is a repository of hosted Ruby on Rails templates.
Ruby on Rails is omakase, and I like a lot of the decisions made for us. However, there are certain tweaks to the default stack that I often make in Rails applications.
- Sometimes I swap out Minitest for RSpec; sometimes, I don't.
- Sometimes I use Devise; sometimes, I don't.
- Sometimes I use Draper; sometimes, I don't.
- Sometimes I take payments with Pay; sometimes, I don't.
- I (mostly) always use Factory Bot and Pry.
I'm grateful for how easy it is to make these additions/changes in Ruby and Rails. However, it still takes time to find a library, look for the gem name (underscore or dash?), add it to my Gemfile, bundle install, and then go through all the library-specific setup instructions.
Chris and I started hacking on the free Jumpstart template in 2017 to make some of these decisions when starting a new Rails app. When I fizzled out, Chris open-sourced it and championed it into a fantastic resource for bootstrapping a new Rails application. Many developers have given back to Jumpstart, and it's a solid template.
The problem I've run into over the last couple of years, though, is that I often don't know what libraries I want to use until I've started building the application.
Rails Bytes shines, here.
I can use (or create!) pre-built Rails templates that do one thing, and they do it well.
If I want to add Devise to my existing application, I can run rails app:template LOCATION='https://railsbytes.com/script/X8Bsjx'
.
If I want to swap out Minitest for Rspec I can run rails app:template LOCATION='https://railsbytes.com/script/z0gsLX'
.
If I want to add TailwindCSS I can run rails app:template LOCATION='https://railsbytes.com/script/z5OsqV'
.
These templates don't just install a gem and run the rails g
command. Many of them also prompt you for extra configuration options and do the work required to get the libraries up and running. 🙌
In the case of Factory Bot and Draper, the templates ask you if you want to generate a Factory or Decorator for all your existing models. 🏄♂️
The benefit to tiny, single-focused templates is that they're composable! 😱 I watched Andrew wire up RSpec, Factory Bot, and Standard into a single template.
It's still early, but I'm excited about the future of Rails Bytes. I can't wait to see what templates my fellow Rubyists (you!) build to make our lives easier.
I host a podcast with Chris and work with Andrew at Podia, so I may be biased. However, I'm incredibly excited about this project. So much so that I can't stop thinking about it and I'm learning how to write a DEV.to article about it!
XOXO
Gossip Girl
Posted on May 18, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024