12 ms·
Brut: A New Web Framework for Ruby
- freedomben 1y agoNeat, 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 1y agoAnother option is https://roda.jeremyevans.net/ 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 1y agoRoda 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!
- entropie 1y agoFor me the middleground is hanami but ill watch bruts developement closely.
- sarchertech 1y ago>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.
- 90s_dev 1y ago[flagged]
- wkirby 1y agoI'm not trying to start a fight, but fwiw I adore both typescript and rails.
- deleted 1y ago[deleted]
- heeton 1y agoTried to login to the example site, unfortunately hit an error immediately after auth'ing with github.
- davetron5000 1y agoAuthor 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 https://brutrb.com/adrs.html and clicking those links.
- caseyohara 1y ago> 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.
- deleted 1y ago[deleted]
- davetron5000 1y agoAuthor 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 1y agoTo 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.
- cosmojg 1y agoOh 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-xuar.txt https://firstdonoharm.dev/version/3/0/cl-eco-media-my-tal-xu...
- wavemode 1y agoAll 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.
- reactordev 1y ago[flagged]
- nine_k 1y agoAll 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 1y agoOne 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 1y agoYou should give some humility lessons...
- reactordev 1y agoHere’s one. “I wrote a web framework that bundles all my favorite tools and dependencies, maybe you’ll also like it” would be a great start.
- simultsop 1y agoIn 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 1y agoAI is coming for us all, I’m not attacking, I’m simply stating the hubris in the statements pulled directly from their website.
- desireco42 1y ago[flagged]
- deleted 1y ago[deleted]
- andrewstuart 1y ago[flagged]
- davetron5000 1y agoI like Ruby! Ruby has types. They just aren't enforced by a compiler.
- gavmor 1y agoWell, yeah, then what's the point?
- davetron5000 1y agoI'm OK not using a compiler. Used one for years and am good on that for now. I like writing Ruby.
- Lio 1y agoYou can use a static analysis tool to check Ruby types ahead of time (still not a compiler) or provide information for tooling. Alternatively you use them at runtime to check the correctness of data, which I don't think you can usually do with say Typescript where the typing information is for the most part compiled away[1]. 1. I may be out of date on this but when I last looked at runtimes that could take Typescript directly they just threw the typing away. You just didn't need to use the tsc compiler first.
- gavmor 1y ago> use a static analysis tool to check Ruby types ahead of time (still not a compiler) I'll have to check out typeprof and sorbet.
- brightball 1y agoComfort, speed, preference, flexibility, lack of benefit on web projects where all data is by default a string, your ORM has already mapped the types directly in the database and will transform everything automatically without repeat definition, you're dealing with a lot of JSON API calls that may change where you don't _need_ all of the data so being forced into a situation of strictly typing 3rd party nested substructures can created a lot of wasted time... Just off the top of my head. To each their own.
- rorylaitila 1y agoI 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.
- MortyWaves 1y agoIs there a reason you literally simulate a click event on the form instead of calling submit() on it?
- Mystery-Machine 1y ago`requestSubmit()`* https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormEle...
- rorylaitila 1y agoYeah, 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 1y agoAre you perhaps using the button name/value for something? Havent tested but i suspect that submit() does not pass that right?
- rorylaitila 1y agoYep that's one reason. I make heavy use of that.
- gavmor 1y ago> 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.
- hamzakc 1y agoI see it is currently based on Sinatra. Just wondering if you have considered looking into Roda?
- davetron5000 1y ago(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.
- deleted 1y ago[deleted]
- hamzakc 1y agoThanks for the reply. Interesting that you mention that it should just use Rack. It reminds me of a time a number of years ago where I was on a mission to use a framework which did not have a million and one dependencies, but just Rack. Not sure you have come across https://github.com/Ramaze/innate https://github.com/Ramaze/innate (I am showing my age now :) . It is the core of the Ramaze framework. I really liked the philosophy of that project. Its a shame it never caught on though.
- ethan_smith 1y agoRoda would be worth considering for its routing tree architecture which can be more performant and maintainable than Sinatra's linear routing approach, especially as the application grows.
- raggi 1y agoThis reminds me of Camping without the dynamic parent class constructor.
- wrs 1y agoWow, that's quite a license. [0][1] Before and after adopting, be sure to check on the pay practices for the janitorial workers of the companies who mined the raw materials for the machinery that made the components in your laptop… [0] https://brutrb.com/overview.html#brut-is-hippocratic-licensed https://brutrb.com/overview.html#brut-is-hippocratic-license... [1] https://firstdonoharm.dev/version/3/0/cl-eco-media-my-tal-xuar.txt https://firstdonoharm.dev/version/3/0/cl-eco-media-my-tal-xu...
- deleted 1y ago[deleted]
- DoctorOW 1y agoI would love to live in a world where this license was possible for the average person to comply with, but I'm not even sure an above average person could.
- deleted 1y ago[deleted]
- joewhale 1y agonice work!
- naveed125 1y agoStarred it and don't even use Ruby (yet) This may force my hand to try it.
- Alifatisk 1y agoBruts own website was also interesting https://brutrb.com/overview.html https://brutrb.com/overview.html
- ilvez 1y agoI understand they have this peculiar license, but does that means that we can't see the source code?
- regularfry 1y agohttps://github.com/thirdtank/brut https://github.com/thirdtank/brut ?
- ilvez 1y agoThanks. Probably was blind, but wasn't too obvious either.
- jacob_a_dev 1y agoagree a bit strange
- plastic-enjoyer 1y agoAnother day, another web framework
- Lio 1y agoI loved David's book Sustainable Rails[1], it's one of the books on Rails I always recommend. This is a really interesting take. I'd love see one of these small alternative frameworks full embrace Sorbet and use it for things like form validation. I guess that might defeat the gradual typing approach but it would definitely be interesting. 1. https://sustainable-rails.com/ https://sustainable-rails.com/
- krowek 1y agoVery talented person, and good speaker as well. I recommend some of his talks as well, perhaps this one closer to the content of the book https://www.youtube.com/watch?v=CRboMkFdZfg https://www.youtube.com/watch?v=CRboMkFdZfg.
- davetron5000 1y agoThanks for the kind words!
- FrancoisBosun 1y agoSorbet is nice, but for data structure enforcement and data validation, I much prefer the dry-rb ecosystem.
- Lio 1y agoI've used dry-rb a bit but had problems with breaking changes that put me off. I love some of the ideas but they seem a bit too heavy for my taste. e.g. I think (project) standardised results are a fantastic idea but I don't need the weight of Dry::Monad for that. I think I can get enough benefit from built in features like .then and throw..catch with tags for signaling without an extra dependency and the risk of the API breaking on upgrade.
- mega-tux 1y agoI like it, specially the Phlex choice. I'd like to know if this framework would work nicely with Datastar js library and its extensive SSE usage. Thanks
- mtkocak 1y agoYet another developer invented PHP in another language