The beginning
When we first started building Avo (March 2020), we used the tools we had at hand. Rails and VueJS. We kinda knew deep down that going the VueJS road might bite us later, but we said we gotta start somewhere.
Since DHH launched Hotwire back in December, we knew Avo should use it. We could see all the advantages of going full Hotwire & Rails. We set ourselves the goal of two months to do the refactor. We went a little over by finishing it in 2.5 months, but we're glad we took this road.
The rewrite
The hotwire rewrite PR has more than 30K updated lines, 180+ commits, and touched 850+ files π
Hotwire
We had to rethink how we display the data and re-use the code to our advantage. Hotwire helps out a lot. We have Turbo enabled and use a lot of frames throughout the app.
We love using frames when rendering associations. has_many
uses the same views we use on the index page, and has_one
association uses the views from the show page.
Speaking of views, we took them a step forward. During the refactoring process, we ended up with a lot of views. As you might know, Rails tends to slow down a bit when dealing with a lot of nested views. That's why we implemented the fantastic view_component gem to take advantage of the performance boost.
Resources API
We rewrote the public API too. We weren't thrilled with the original one. After a lot of experimentation, feedback, and outside help (Thank you Thomas), we made some changes.
You no longer open up the Avo
namespace to create resources but add simple classes that inherit from Avo::BaseResource
.
We removed the initialize
method in favor of class_attributes.
The fields declaration needed a bit of work too. It posed some issues because it used dynamically named class methods.
There's no more fields do
block, but you can declare the fields in a more expressive way using the field
class method.
You can read more about the changes on our upgrade page.
The final product
After all of that, we ended up with a fantastic product to start our journey.
- 22 fields out of the box β‘οΈ
- Excellent Active Storage integration π
- A lot of field options πͺ
- A familiar DSL to declare your resources π€
- Grid view π
- Rails associations π€
- Filters and Actions π
- Advanced authorization π
- Localization πͺπΈ
- Tons of customizations β¨
All of that π wrapped into a beautiful package powered by Ruby on Rails and Hotwire β€οΈ
What's next
We can't spill the beans on all of our plans, but we can give you a sneak peek at what we plan to ship in the future:
- Custom tools & pages
- Custom fields
- Dashboards
- Themes
- Powerful search
Where can you get it
Head over to the getting started page to try it out in your app today.
Thank you
Thank you for using Avo and sending us your feedback π