Brut: A New Web Framework for Ruby
51 comments
·July 8, 2025rorylaitila
MortyWaves
Is there a reason you literally simulate a click event on the form instead of calling submit() on it?
rorylaitila
Yeah, it's escaping me at the moment all of the reasons, but calling .submit() on a form element doesn't exactly have all of the behaviors as calling .click() on a button element in a form, particularly multiple buttons in a form.
hapidjus
Are you perhaps using the button name/value for something? Havent tested but i suspect that submit() does not pass that right?
raggi
This reminds me of Camping without the dynamic parent class constructor.
sarchertech
>What about monads or algebraic data types or currying or maybe having everything be a Proc because call?! You don’t have to understand any part of that question. But if you want your business logic to use functors, go for it. We won’t stop you.
I love this! It sounds exactly what I’d want to use for a side project or a project with a limited number of reasonable, senior coworkers.
freedomben
Neat, this looks like it might be a good middle ground between Sinatra (which I adore) on the barebones/low-level end and Rails (which I also adore for apps that need it, but simple apps really don't).
Looking forward to trying it out!
duck
Another option is https://roda.jeremyevans.net/, which I've found is the sweet spot in smaller projects, but can still scale up. The plugin system works really well to extend and the routing tree is really easy to work with.
djfobbz
Roda is hands-down my favorite framework and my go-to no matter the size of the app. It's super lightweight, crazy fast, and a great alternative to Rails, without all the extra bloat. You still get everything you need to build solid apps, just in a much leaner package.
We recently moved a legacy Rails 2.3 app over to the latest Roda, and paired it with Vite, Stimulus, and Tailwind on the frontend...and honestly, we couldn't be happier with how it turned out!
hamzakc
I see it is currently based on Sinatra. Just wondering if you have considered looking into Roda?
davetron5000
(author here) It only uses Sinatra because I happened to know it and needed to bootstrap the low-level stuff. I don't know if it needs to be based on Sinatra in the long term - it should probably just use Rack.
heeton
Tried to login to the example site, unfortunately hit an error immediately after auth'ing with github.
davetron5000
Author here - the example doesn't allow logins now to avoid abuse. I wasn't 100% sure I'd make it public and just decided today to do it, so it's not yet ready for just anyone to login.
You can run the site locally, or view pages on the site by going to https://brutrb.com/adrs.html and clicking those links.
gavmor
> Is this the index action of the widgets resource or the show action of the widget-list resource? is a question you will never have to ask yourself or your team. The widgets page is called WidgetsPage and available at /widgets.
Hm, uh, seems like now we will be forever asking ourselves this question about /widgets.
That being said, it looks good! Might get me back into ruby if I can come up with a project for it.
cosmojg
Oh man, Brut's HIPPOCRATIC LICENSE[1] is interesting! Just excerpting bits of Section 3.1 and Section 3.2 for example:
* 3.1. The Licensee SHALL NOT, whether directly or indirectly, through agents
or assigns:
[...] * 3.1.12. Taliban: Be an individual or entity that:
* 3.1.12.1. engages in any commercial transactions with the Taliban; or
* 3.1.12.2. is a representative, agent, affiliate, successor, attorney, or
assign of the Taliban;
* 3.1.13. Myanmar: Be an individual or entity that:
* 3.1.13.1. engages in any commercial transactions with the
Myanmar/Burmese military junta; or
* 3.1.13.2. is a representative, agent, affiliate, successor, attorney, or
assign of the Myanmar/Burmese government;
* 3.1.14. Xinjiang Uygur Autonomous Region: Be an individual or entity, or a
representative, agent, affiliate, successor, attorney, or assign of any
individual or entity, that does business in, purchases goods from, or
otherwise benefits from goods produced in the Xinjiang Uygur Autonomous
Region of China;
[...] * 3.2. The Licensee SHALL:
* 3.2.1. Provide equal pay for equal work where the performance of such work
requires equal skill, effort, and responsibility, and which are performed
under similar working conditions, except where such payment is made
pursuant to:
* 3.2.1.1. A seniority system;
* 3.2.1.2. A merit system;
* 3.2.1.3. A system which measures earnings by quantity or quality of
production; or
* 3.2.1.4. A differential based on any other factor other than sex, gender,
sexual orientation, race, ethnicity, nationality, religion, caste, age,
medical disability or impairment, and/or any other like circumstances
(See 29 U.S.C.A. § 206(d)(1); Article 23, United Nations Universal
Declaration of Human Rights; Article 7, International Covenant on
Economic, Social and Cultural Rights; Article 26, International Covenant
on Civil and Political Rights); and
* 3.2.2. Allow for reasonable limitation of working hours and periodic
holidays with pay (See Article 24, United Nations Universal Declaration of
Human Rights; Article 7, International Covenant on Economic, Social and
Cultural Rights).
[1] https://firstdonoharm.dev/version/3/0/cl-eco-media-my-tal-xu...mrsilencedogood
People who try to enforce this stuff via license fundamentally misunderstand the nature of copyright law.
Do you plan to sue people to enforce your license? Do you think people who are committing war crimes / crimes against humanity are going to not violate your license alongside all their other crimes?
The only thing this license accomplishes is ensuring no even semi-serious business will touch this with a 10' pole because it's a completely bespoke license with no prior understanding by their legal counsel. But you can already basically do that via the AGPL, except that some companies who are well-meaning may actually still use it.
davetron5000
I didn't come up with the license. You can read about it here: https://firstdonoharm.dev/
I didn't want the code to be All Rights Reserved, so I chose the best license I could find that communicates my desires - I assume that's what most people do when choosing a license?
I'm OK if a "semi serious business" don't want to use my software.
wavemode
All lovely ideals, but sadly means the project is not actually open source (by the official definition). And not compatible with the GPL and similar copyleft.
dmix
Usually a signal of a personal/hobby project not to be taken seriously.
null
caseyohara
> I know, we can vibe away all the boilerplate required for Rails apps. But how much fun is that? How much do you enjoy setting up RSpec, again, in your new Rails app? How tired are you of changing the “front end solution” every few years? And aren’t you just tired of debating where your business logic goes or if it’s OK to use HTTP DELETE (tunneled over a _method param in a POST) to archive a widget?
For your personal hobby project, go nuts. Break all the rules and cowboy all your own conventions.
But for business applications, the conventions Rails enforces at least make codebases somewhat familiar if you've seen a Rails codebase before.
At a certain codebase size, boilerplate is almost unavoidable. Unpleasant, but necessary. Personally, I'd rather have some conventions, rules, and guardrails for where the boilerplate lives rather than trying to navigate your homegrown pile of code. Good luck maintaining that spaghetti when you've got multiple developers.
It's not clear how this new web framework avoids boilerplate anyway, so I don't see how this is an improvement over Rails. Presumably you'll still need to set up lots of stuff yourself, like RSpec. If the framework sets all of that stuff up for you in a conventional way, then you're just back to square one as soon as you need to fight against the framework's conventions.
davetron5000
Author here. The framework does require setting stuff up. RSpec is not one of those things. It's the testing library you will use if you use this framework. I didn't create a lot of flexibility in the framework. For example, if you don't like RSpec, you will not like this framework :)
You may want to examine the docs more closely. There are plenty of conventions and very few that can be circumvented.
But day one of a new framework is not going to compete with Rails. Sorry!
stouset
To be honest, I love this framework (so far from what I've seen) but I do hate the choice of RSpec. I say this as someone who used RSpec for like a decade after it was first released. I "get" it. I have contributed code to it.
Minitest (which is bundled with Ruby these days) is Good Enough™. It doesn't require you to learn a new DSL. Everything is just Plain Old Ruby. The use of RSpec these days—IMO—is just cargo-culting forward what was the right decision from 10+ years ago. Having an pseudo-English style interface for testing isn't worth having the additional dependencies nor the mental overhead of needing to know how the RSpec syntax is actually mapped into Ruby concepts.
I'm not asking you to change it, you're welcome to have a different opinion than mine. But I am curious if you have strong reasons for requiring it. Particularly because MiniTest seems to be well-aligned with the rest of your design philosophies, unlike RSpec.
davetron5000
I thought hard about this decision. Every time I use MiniTest, I end up wanting a bit more that RSpec has and then switching to it. I also have been surprised over the years that the `expect(x).to eq(y)` seems to be relatively intuitive to people, despite the fact that it doesn't seem like it ought to be.
null
90s_dev
[flagged]
wkirby
I'm not trying to start a fight, but fwiw I adore both typescript and rails.
null
reactordev
[flagged]
simultsop
In an era of constant professional extinction threat, author took risk and motivation to build an entire framework for free. And there is you attacking their ego.
reactordev
AI is coming for us all, I’m not attacking, I’m simply stating the hubris in the statements pulled directly from their website.
nine_k
All frameworks are like that. They make it simple to solve a particular class of problems, by making choices for you, and providing code that supports these choices. If your problems fit the framework's shape, it can be immensely helpful. If not, go look for another. There's nothing wrong about building a framework that matches your particular needs and tastes.
If you need a universal toolbox, no framework will do, you need composable libraries. Most large projects end up facing this, but most projects are not large.
reactordev
One can learn a lot from the Adapter pattern. Don’t force me into your box, provide a framework for me to solve my problems.
simultsop
You should give some humility lessons...
I like the emphasis on forms and pages. That's the approach I take in my apps. Forms and Links drive all interaction. Any JavaScript enhancements merely click an existing form (even if it's hidden). You can always inspect the HTML and know exactly the route that will handle the interaction. I think controllers are overused. It's really forms, models (backend) and views (Pages). A lot of the validation and ceremony of controllers can be handled more elegantly by the framework.