Shareable Rails app templates

There's been some discussion lately about Rails app templates and how they could be a lot more useful. After having spent a ton of time building Rails app templates for GoRails and Jumpstart, I can definitely feel the pain point. Nate Berkopec [tweeted](https://twitter.com/nateberkopec/status/1259634098353537024) about templates as well recently.

One of the things that is definitely frustrating is installing something like Bootstrap. You've got a bunch of different files to configure and it's easy to miss a step. We've packaged all that into a [Rails app template](https://railsbytes.com/public/templates/x9Qsqx) so all you have to do is run a single command to install it.

These app templates are definitely trickier to build because they'll need to verify Rails version and other dependencies (like is webpacker installed, etc), but I think if done well they can save Rails devs a ton of time. Plus, app templates can be run against existing Rails apps, not just brand new ones.

So here you have it: [railsbytes.com](https://railsbytes.com)

It took u/king601 and I about 8 hours to build this first version so we know there's a lot to improve, but we hope it can serve as a foundation to help make adding common gems, features, and other things in Rails much easier.

Some interesting examples:

Installing Devise is interactive. It can ask you what model you want and what extra fields so you don't have to remember any of the commands: [https://railsbytes.com/public/templates/X8Bsjx](https://railsbytes.com/public/templates/X8Bsjx)

Same thing applies to gems like HoneyBadger that need to ask for an API key: [https://railsbytes.com/public/templates/zNPsmV](https://railsbytes.com/public/templates/zNPsmV)

You can have a Rails app template trigger chain other Rails app templates together like this one that installs Rspec, Factorybot, and Standardrb: [https://railsbytes.com/public/templates/V4YsyX](https://railsbytes.com/public/templates/V4YsyX)

Wanted to share this with you guys and we're curious to hear what you guys think. It seems like it's got a ton of potential to do all sorts of interesting things.

11 thoughts on “Shareable Rails app templates”

  1. I’ve always had a similar thought with boilerplate, so definitely going to give it a try (hopefully tomorrow if time permits). Good work as usual, though, GoRails is great (I haven’t needed Jumpstart, but can see the need for it and use something similar for my own Rails projects).

    Just as a side-note: The site could do with some mobile optimisations as the home page example templates sections and the “copy to” command content is overflowing.

    Reply
  2. This is a great idea to spread the word about Rails templates.

    I’ve told about them to a bunch of people over the years that have a project with the base stuff they use and just clone and rename everything for every new project.

    Reply
  3. That’s awesome. I’ve been playing around with generators as a way to get back into rails, I might be able to provide one or two.

    Reply
  4. Looks like currently most of the templates are just for individual gems/libraries, would you recommend creating a template where you chain a bunch of them as you did in your [example](https://railsbytes.com/public/templates/V4YsyX) or putting a list of them in a script or something?

    To me the value of something likes this comes from setting up lots of boilerplate stuff easily. I always want devise, rspec, administrate etc. What would you recommend? Awesome tool, will definitely be trying it out!

    Reply
  5. Nothing to say but a HUGE thanks for the TailwindCSS templating. Will you guys be adding the basic notification/button JS features? Or is it just the static HTML/CSS stuff that will be included in this? (Hope I don’t sound too lazy XD)

    Reply

Leave a Comment