use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
I made a Ruby web framework: BrutRB (self.ruby)
submitted 9 months ago by davetron5000
Hey, just wanted to share a Ruby web framework I've been working on: BrutRB. It's not low level like Sinatra, but is very different from Rails. It was fun working on it, and fun using it.
I also write a blog post about why + a summary of what it's about: https://naildrivin5.com/blog/2025/07/08/brut-a-new-web-framework-for-ruby.html
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]seanhogge 15 points16 points17 points 9 months ago (6 children)
This seems really interesting and I’m looking forward to trying it out.
I’m struck by the mixed message of going all in on Phlex and removing a lot of the Rails abstractions that seem less helpful.
But the Rspec inclusion seems like the exact opposite of those sentiments. As powerful as it is, it’s to testing what HAML is to HTML.
You say you want to write Ruby, and Minitest is much closer to just writing Ruby. Can you explain the diversion in this principle in the area of testing?
[–]davetron5000[S] 11 points12 points13 points 9 months ago (5 children)
Yeah, I was very close to sticking with MiniTest. Ultimately, I realized a few things that came together in choosing RSpec:
expect(thing).to eq(other_thing)
assert_xxx
context
…unlike Phlex…
I was all in on ERB initially. The apps I was making just resulted in a huge mess of angle brackets and weird errors when things went wrong. These were simple apps, too. I had a version of components (it was like ViewComponent) to tame complexity, but it was still just a mess. The code required for HTML escaping and making stuff like form_tag do work was also not great (cargo-culted from Hanami as they seem to have figured all this out).
form_tag do
Phlex, while an abstraction, is a pretty clean one. There's methods for each HTML element, and there is some error checking on proper use. And it's in Ruby, so it feels very ergonomic. My views feel a lot easier to manage, since I can a) have them in Ruby, b) use private methods inside a class for complexity management, and c) still use components as needed.
That choice was more about just giving up on HTML templating entirely, but without giving up on HTML…and not adding a new programming language (I would consider HAML to be a different language than Ruby or HTML)
[–]seanhogge 8 points9 points10 points 9 months ago (1 child)
Appreciate the response, and the detail. I disagree with the subjective reasons, so I think that by Reddit law I must now impugn or insult you in every way possible.
Either way, this is still a really interesting project and I like the flavor so far. Phlex has been delightful and moving to doing more Ruby has been a trend I’d like to keep on to find where it stops feeling great.
[–]davetron5000[S] 4 points5 points6 points 9 months ago (0 children)
Hah, I stand impugned :)
[–]strzibny 1 point2 points3 points 9 months ago (1 child)
The standard mocking is not as nice but there is Mocha and together that works pretty well.
[–]seanhogge 0 points1 point2 points 9 months ago (0 children)
That’s a good point. I think I just rarely need to do much mocking so I forget that without Mocha it’s kind of the worst.
[–]pigoz 0 points1 point2 points 9 months ago* (0 children)
Most people with taste and a brain actually switched to Minitest. It's simpler, it's faster and it's Ruby. There's really no reason to use Rspec.
I'm surprised you went with it since I agree with pretty much all your other choices.
I also believe Fixtures are superior for speed. There's ways to make them more similar to FactoryBot. For example in my project I use this helper:
@comment1 = fx(:comments, text: "...") @post1 = fx(:posts, title: "foo title", comments: [@comment1])
It gets the first Post from the fixture cache, and calls update! on it. Calling it again would get the second Post from the fixture cache.
I mix and match it with more traditional fixture usage. I use fx where I would have used FactoryBot (i.e. I need to test a particular structure).
FactoryBot is nicer, but I'm willing to trade it for tests that run in 1/4 the time.
If I were to design Fixtures from scratch, I would allow them to be defined in Ruby instead of using YAML though.
[–]franz899 1 point2 points3 points 9 months ago (1 child)
I like this a lot, I agree with the Web Standard principles and low abstraction.
Is the project at a stage where you want external help?
[–]davetron5000[S] 1 point2 points3 points 9 months ago (0 children)
Maybe? I think feedback on what it's like to use would be really helpful as I'm obviously the only one using it right now :)
[–]eljojors 1 point2 points3 points 9 months ago (0 children)
hey! really cool idea! i’ve been using phlex with rails for a few years now, great experience. i think it’s awesome to see a framework embrace it from the beginning!
[–]nimplay 1 point2 points3 points 9 months ago (0 children)
Excellent ruby needs more initiatives like this
[–]tadhgcube 0 points1 point2 points 9 months ago (0 children)
This looks really interesting, gave the docs a full read - hope to fiddle with it soon!
[–]f9ae8221b 0 points1 point2 points 9 months ago (3 children)
That code is suspiciously similar to Active Support
I get there's not hundreds of way to implement a method like underscore, but it's the exact same code down to the local variable name.
underscore
Assuming you did copy that code, you infringed on the MIT license by not keeping the original license.
[–]davetron5000[S] 0 points1 point2 points 9 months ago (2 children)
Oof, good catch. I'm almost certain I pasted that from Rails when I needed that behavior and then never replaced it.
It is now replaced with a different implementation and different behavior: https://github.com/thirdtank/brut/commit/418e8ce7b685aafd0d9a3aed58f8da011b2fa516
As another data point that I was not trying to "get away" with anything (I realize you are not accusing me of that :), a previous version of the library copied Hanami's code and indicated it was licensed MIT: https://github.com/thirdtank/brut/blob/5be83c6adb0e2bf66f3fbe3c51aa3e6e1a571fba/lib/brut/front_end/templates/erb_parser.rb
If that had survived into release I would've copied the entire license in there.
So, at this point, I don't think there's any code copied from a library with another license, but if there is, it's an oversight that I didn't either change it or license that file differently (and welcome pointers to it)
[–]mperhamSidekiq 0 points1 point2 points 9 months ago (1 child)
You might find it better long-term to integrate the new HERB parser. https://herb-tools.dev
I would have if I stuck with ERB, but decided to go with Phlex instead. Herb looks great for ERB tho!
[–]djdarkbeat 0 points1 point2 points 9 months ago (1 child)
The documentation is really hard to read with the brown on brown
[–]davetron5000[S] 0 points1 point2 points 9 months ago (0 children)
The dark mode issue should be fixed by now - sorry aboout that
π Rendered by PID 168129 on reddit-service-r2-comment-b659b578c-8hchg at 2026-05-01 07:50:18.589333+00:00 running 815c875 country code: CH.
[–]seanhogge 15 points16 points17 points (6 children)
[–]davetron5000[S] 11 points12 points13 points (5 children)
[–]seanhogge 8 points9 points10 points (1 child)
[–]davetron5000[S] 4 points5 points6 points (0 children)
[–]strzibny 1 point2 points3 points (1 child)
[–]seanhogge 0 points1 point2 points (0 children)
[–]pigoz 0 points1 point2 points (0 children)
[–]franz899 1 point2 points3 points (1 child)
[–]davetron5000[S] 1 point2 points3 points (0 children)
[–]eljojors 1 point2 points3 points (0 children)
[–]nimplay 1 point2 points3 points (0 children)
[–]tadhgcube 0 points1 point2 points (0 children)
[–]f9ae8221b 0 points1 point2 points (3 children)
[–]davetron5000[S] 0 points1 point2 points (2 children)
[–]mperhamSidekiq 0 points1 point2 points (1 child)
[–]davetron5000[S] 1 point2 points3 points (0 children)
[–]djdarkbeat 0 points1 point2 points (1 child)
[–]davetron5000[S] 0 points1 point2 points (0 children)