Buffalo: All-in-one Web Site Building
Nov 11, 2021 | Last edit: Jan 6, 2022
“The right tool for the job” is a saying that works well in woodworking as it does in software. The idea is that any task can be done easily, safely, and efficiently when using implements that are designed for that task. It doesn't mean our toolbox should be infinite, or that one should collect every tool or technique available. But when we encounter tasks we've done before, it's great to know the best path through them.
Take the simple job of creating a web site. The potential list of tools seems limitless and somehow expanding each day. It can feel impossible to settle on one programming language or stack or library of tools. At some point you must choose a path, go forth and do the best work possible with the choices you've made.
Enter Buffalo.
This is one in a long line of tools meant to package up most of the core tools needed to build a web site. Think of it more as a multi-tool, similar to things like Rails, Wordpress or Drupal, and Jekyll.
Do these handle everything needed for any type of site? No, but they are extensible.
Do they have their own technical quirks and learning curves? Yes, like all tools.
Do they simplify many choices and speed up the time to delivery? Yes indeed!
Using a stack like Buffalo allows us to focus on building the project and not assembling or managing the tools.
In software that can seem too simple or limiting or, heavens, not a challenge. But so many of the steps to build a web site should be considered "solved." Let's take that victory and move on.
Buffalo is written in Go, so for me it provided a good opportunity to continue learning Go while also exploring the tool. At times, it's a struggle to differentiate between the new patterns in Go and the quirks that are unique to Buffalo. But it's solvable.
And to that end, I felt one contribution I could make to this open-source project is to create my own set of how-tos. These are driven by my own set of expectations and habits that came from years of working in Drupal and Angular. I identify things that are the same; things that are different and how to bridge that gap. At the end of the day, the biggest help is making something new to look familiar, to translate into a vocabulary we have already learned.
Buffalo is inspired by Rails and offers an amazing bundle of features. Database modeling, migrations and environment control. Session cookies. Dev environment tools, production bundling. Plugins. Form handling.
Could you build all of this yourself? Sure. Do you have time for that? Well …
Many of the pieces underpinning Buffalo are popular Go projects you may be familiar with already: gorilla sessions, form binding. Could you build your own stack from these projects? Again: do you have the time or desire for that?
Buffalo is amazing because it's ready to build and deploy a project instantly. It's really hard to overstate the power of projects like Buffalo to put the right tools in a person's hands and let the project start.
The lessons I'm creating are posted on YouTube, as it seems there is still a lot of discovery happening there. I choose video because it allows me to walk through the choices I make, or explain the patterns and provide ways to understand them. I feel most of the code is simple really; getting comfortable with the concepts is key. But the code is also available as a Github repo.
Currently the lessons are underway with about half completed. I may add some more topics if I see the opportunity. The current schedule is this:
Sections Completed:
- Part 1: new project, static page, and route parameters
- Part 2: create a user model, add fields and methods, and test it
- Part 3: models and associations, one-to-one, one-to-many, many-to-many
- Part 4: using controllers with our models
- Part 5: HTML templates, partials and helpers
- Part 6: Forms, form_for() helper, form() helper, manually parse and grab form values from the request
- Part 7: Middleware and user authentication with Buffalo Plugins
- Part 8: Third-party Integrations and Events
Sections Planned:
- Part 9: CLI operations to build a production build, and other tasks