loading...

Why I'm Excited About Rails Bytes

jasoncharnes profile image Jason Charnes ・3 min read

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 by:

jasoncharnes profile

Jason Charnes

@jasoncharnes

I write a lot of Ruby, podcast on Remote Ruby, and organize Southeast Ruby.

Discussion

pic
Editor guide
 

Most of the time these Rails app templates are thought of purely for brand new Rails apps. You add your features, and then do the rest manually.

What Andrew and I noticed while we were building RailsBytes was just how valuable and effective these can be for existing apps too. I think that's what we're most excited about. You could build a template to add authentication from scratch, or notifications, or really anything. It's so exciting.

 

What Andrew and I noticed while we were building RailsBytes was just how valuable and effective these can be for existing apps too. I think that's what we're most excited about.

BINGO. I've only thought of templates (like Jumpstart) as "run all these things at rails new and then YOLO" but having the ability to update existing applications is a game-changer.

 

This definitely has a lot of implications for Rails future. The ability to hotswap as needed is truly a game changer.

 

I think you and I should do the next weekend project. Railsbeards.com

 

🤣🤣🤣 You might be disappointed to learn I have a much smaller “quarantine beard” but I’m ready to pair on it nonetheless.

 

Surprised mine isn’t longer with how hard my 7 month old pulls on it.

 

Really like the idea, it will reduce some repetitive task while not force you to add everything from start using a full-blown template

 

This is really interesting!

 

haha one of the greatest opinion pieces on Rails! Awesome article Jason 😁

 

I think you can combine Rails and dbdesigner.id as your database designer. This can make your project readable and clear documentation.