7 ms·
Rage: Fast web framework compatible with Rails
- crystaln 3y ago> the only technology we should be using to create web UI is JavaScript I would argue the same is true for the server.
- Fire-Dragon-DoL 3y agoI was thinking the other day, what exactly is the purpose of this. It seems to simulate controllers, but activerecord is a big part of rails. I still love the idea, but I don't foresee a migration path since activerecord is still necessary for a migration path
- asok86 3y agoIt seems that you can use whatever ORM you'd like. ActiveRecord included.
- benbonnet 3y ago[dead]
- pantulis 3y agoI am also a little bit confused, if you are touting Rails compatibility, how can you be that much faster? Something has to be left. But it's sooo interesting! I would love to see it merged with Rails core like Merb on its day, one can dream!
- todd3834 3y agoI wonder if the name comes from how funny “RageController” is to read in the code
- Keverw 3y agoRockstar Advanced Game Engine
- westoque 3y agoMost of the speed I believe is from using the server iodine https://github.com/boazsegev/iodine https://github.com/boazsegev/iodine which is a wrapper around facil.io https://facil.io https://facil.io that is built using C. Great project either way!
- tomku 3y agoIs facil.io maintained? Last commit was 2 years ago, which is a bit concerning for something written in C that handles a bunch of security-sensitive things including a from-scratch JSON parser.
- krmbzds 3y ago> API-only - the only technology we should be using to create web UI is JavaScript. Using native technologies is always the most flexible, scalable, and simple solution in the long run. Check out Vite if you don't know where to start. Thanks. I'll pass on that one. Nevertheless, both rage and iodine seem like pretty cool projects FWIW.
- KronisLV 3y ago>> API-only - the only technology we should be using to create web UI is JavaScript. > Thanks. I'll pass on that one. I don't know, there's definitely some merit in separating your front end from your back end - at least that's the impression I got after struggling on JSF/PrimeFaces Java projects for a few years, because at least with a well defined API and no magic behind the scenes everything becomes more observable and easier to reason about, with fewer bugs. Some might prefer TypeScript or something else to JavaScript, but I think the point still stands. In addition, this lets migrate or change everything piece by piece, as long as the interface isn't broken: - different frameworks (let's say from Spring to Spring Boot, or from the old ASP.NET to the new variety that runs on Linux, or Rails to Rage or vice versa) - different languages (if someone decided to take their PHP Laravel solution and migrate to Ruby with Ruby on Rails, or Python, or anything else) - deprecated technologies can also be handled gradually (e.g. supporting an EOL AngularJS solution while developing a new front end in Vue/React/Angular/whatever) As for the reason for those migrations, sometimes code just rots due to neglect, other times you need features that aren't available in your solution of choice (for example, pre-made UI components, like PrimeVue, PrimeReact and PrimeNG have; or maybe needing to have responsive maps in the app). In addition, you can also deploy your front end and back end separately, have different rules for the reverse proxy in front of them, suddenly have a very clear view of where your static assets are, might have all of the benefits of a SPA and PWA (if needed), anyone can integrate with your API if needed/allowed because you've hopefully built it to actually be usable and so on. Plus, your front end can talk to multiple different APIs, so if you have multiple teams working on those, suddenly that is a solved issue for you as well. That said, it's also a lot of work because SPA and adjacent approaches bring a lot of complexity into the mix and something like Vue/React/Angular and its ecosystem will bring its own pain points and things you have to learn. If all you need is a bunch of forms, then pretty much anything will do fine and SSR is a good choice. If you need an "app" on the web, then HTML/JS/CSS isn't a very good choice to begin with (historically not built for that; though I don't think there are actually good choices, same as with desktop software), but those SPA solutions will see you pretty far.
- felixding 3y ago> the only technology we should be using to create web UI is JavaScript No.
- stefcoetzee 3y agoWhat do you prefer? (I quite like ClojureScript.)
- pocketsand 3y agoHTML, the language on the server
- Alifatisk 3y agoFlutter
- treyd 3y agoWe've been using the Dioxus library for Rust at my company and it's worked well. There's other Rust WASM web UI frameworks as well.
- namtab00 3y agoBlazor yes, I am THAT guy...
- egeozcan 3y agoI'd always prefer React for when you have dedicated Front-end developers but for small go projects, gomponents with its htmx add-on does wonders.
- multiplegeorges 3y agoUhhhh, HTML?
- Scarbutt 3y agoThat's worse than using plain JS.
- 3y ago
- jack_riminton 3y agoInteresting. I'd like to see a full app's code to find where the skeletons are hidden. I don't mind the opinionated take on JS, each to their own
- DeathArrow 3y agoIs Ruby still a thing in web development? It seems to me most backend use Java, C#, Node with a bit of PHP here and there.
- pech0rin 3y agoyes of course it is. Shopify is Rails, as are countless other companies.
- pampa 3y agoThere is some life in Rails, but new greenfield rails projects are rare. It is mostly legacy stuff now. The ecosystem is slowly fading away. Big industrial libs are still good, but a lot of smaller projects are abandonware, last updated in 18-19. The cool kids moved on to Go, Rust, TS, Elixir etc.
- mirekrusin 3y agoIt always puzzled me why Crystal didn't catch up? It seems like they just had to publish couple of benchmarks and articles here and there and that could have been it. As it has good C interop story it could have a good chance riding on AI hype wave few years later in this alternative history.
- unrealhoang 3y agoBecause there's not enough differences/advantages compared to Go.
- mirekrusin 3y agoMetaprogramming, null safety, syntax familiarity (with Ruby), algebraic types - there are quite a lot of advantages/differences, no?
- bwilliams 3y ago
- padjo 3y agoSeems like a cool project. I really like rails and for projects where you only want to use it as an API this seems great. Feels like DHH has been so obsessed with killing JavaScript recently that rails has lost its way a bit.
- Alifatisk 3y agoI think DHH want to keep it as a full-stack framework and not only backend-framework. I appreciate DHHs and his teams attempt at providing an true alternative to front-end frameworks.
- padjo 3y agoI mean that’s fair enough, it’s his framework he can do what he wants. But the last two places I’ve used rails it was being used as backend only. I suspect that’s a very standard way to use rails these days and no amount of DHH telling me it’s wrong is going to change that.
- jon-wood 3y agoThat's fine, if you don't want all the frontend bits you can run in API mode, which will skip loading them: https://guides.rubyonrails.org/api_app.html https://guides.rubyonrails.org/api_app.html
- Alifatisk 3y agoI find Rails API-mode hard to work with, integrating the frontend towards Rails crud-like api is cumbersome because of all the endpoints you have to manully work with. While using Rails own templating engine creates all the links and urls for you!
- Lio 3y agoI'm not sure it's fair to say DHH wants to kill JavaScript, only that he wants to use JavaScript only where he thinks there's no better alternative. i.e. progressive enhancement. There's still nothing stopping you from jettisoning view support and just using Rails as an API if you want to.
- merelysounds 3y agoReminds me of Merb[1] - which also targeted performance and eventually got merged into Rails as part of Rails 3. [1]: https://en.wikipedia.org/wiki/Merb https://en.wikipedia.org/wiki/Merb
- byroot 3y agoLies, damn lies and benchmarks. The first benchmark is pretty much an empty request, so it measure each framework "overhead". That shows Rails+Puma at `0.25ms` overhead per request, and rage+iodine at `0.013ms`. That is significantly less yes, but it the overwhelming majority of case it absolutely don't matter, and this difference mostly come from Rails providing extra features. As for the second one, it's entirely irrelevant. It's benchmarking a purely IO workload with Puma caped at 5 threads vs Iodine without a concurrency cap. You can increase "Rails" throughput about as much as you want in that benchmark by raising the number of Puma threads or switching to Falcon. But also, not capping concurrency like this is risky. The second some CPU heavy work is mixed with this pure IO work, latency will suffer terribly. It's fine for a micro-service where you know it's really all IO though. Disclaimer: I'm a member of Rails, but I welcome alternative frameworks, I'm just very annoyed at how terrible most benchmarks are.
- alberth 3y agoSlightly off topic: what is the preferred way to deploy Rails these days? Is it to use Puma? Unicorn, etc?
- PikachuEXE 3y agoPuma works fine most of the time (config it accordingly of course No idea what other options are out there though
- gvurrdon 3y agoI've been using Nginx/Passenger: https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/ https://www.phusionpassenger.com/library/deploy/nginx/deploy...
- PikachuEXE 3y agoI actually switch from Passenger (to puma But then I got reverse proxy (caddy) in front
- 3y ago
- pampa 3y agoAren't you a little short for a stormtrooper? I mean 180+ commits, 3 month old, bold claims and already 8 releases on rubygems? There ought to be a vetting/voting process for packages, before they are accepted into a public repo and pollute the global namespace. Like in arch repo/AUR.
- Alifatisk 3y agoThis was unexpected but welcome, finally something new and fresh to compete with what we currently have. Since it's Rails-compitable? Does that mean I can connect Avo, Bullettrain, Rack-attack aswell? Can't wait for this to popup on techempower benchmarks! But I would've hoped that there was some proper benchmarks done instead of these unrealistic ones.
- Alifatisk 3y agoHow come Ruby frameworks don't utilize HTTP/2, Falcon seems like the only alternative but I don't know how mature it is?
- Lio 3y agoI think it's in the works for Puma. Tenderlove posted this gist a while ago as proof of concept: https://gist.github.com/tenderlove/d68d9a3c4f7941192c9b https://gist.github.com/tenderlove/d68d9a3c4f7941192c9b
- byroot 3y agoBecause unless you want to expose your Ruby server directly to the internet without a load balancer, there isn't much to gain in having HTTP/2 between the LB and the app server. I'm curious though, what's your use case to and HTTP2 up to the app server?
- Alifatisk 3y agoTo be honest, I have no use case. I asked out of curiosity.
- quechimba 3y agoMayu uses HTTP/2. It's still experimental though. https://github.com/mayu-live/framework https://github.com/mayu-live/framework
- thiago_fm 3y agoGreat idea, wish it would be merged with Rails itself, but without the opinionated lines, like "the only technology we should be using to create web UI is JavaScript" It's a really stupid line and whoever wrote it is embarrassing themselves. Also, a more real/demanding benchmark would be great. Keep it up!
- Spivak 3y agoThey're right and they should say it. You would think I was insane if I made a CLI tool worked by fetching and running dynamically generated pre-compiled binaries from a server for each subcommand command and yet that's what we do with erb template style apps. The API + static versioned self-contained html/css/js asset bundle is the way for anything you would reach for erb for.
- sebastianconcpt 3y ago> the only technology we should be using to create web UI is JavaScript Just the tone of that statement is coming from the wrong angle.
- lcnPylGDnU4H9OF 3y agoI wonder how they get the browser to download the script file?
- sebastianconcpt 3y agoI don't know but just the tone they used encourages me to try to use WebAssembly
- brunojppb 3y ago> the only technology we should be using to create web UI is JavaScript Quite an interesting idea, but stating that JS is the true way of creating Web UIs misses the mark by miles. You would be surprised by how far you can get with HTML and CSS alone. You will ofc need JS for more dynamic interactions, but ditching the server entirely and delegating everything to JS will just take us to the SPA mess that most of have been burned with.
- kshahkshah 3y agoI think it's assuming a static site
- ecshafer 3y agoEspecially now that rails is shipping with turbo, hotwire and stimulus. Using no (additional) javascript you can make awesome performant reactive webpages.
- efields 3y agoI want to believe. Really I do. Most recent app I worked on used Mantine for a base component library. Having such a large collection of drop-in components made the app come together very quickly. Performance matters but a well built react front-end for a solid MVP is performant enough. I haven’t seen a vision like this for the stimulus/htmx world. How do you import components?
- ecshafer 3y agoMy team is usually view components in our application. Basicslly ruby erb renders the view component in a turbo frame. Turbo allows async updates without redrawing. Then we use stimulus to call small js component that are put into the view components.
- MattyMc 3y ago“… the only technology we should be using to create web UI is JavaScript.” Well, the Rage team certainly is opinionated!
- tebbers 3y agoDHH++
- 999900000999 3y agoGood to see Ruby isn't dead yet. Still looks like a niche language.
- xutopia 3y agoThis might be useful but the moment someone asks you to build an admin UI for your API only service you end up wondering why you didn't go with Rails in the first place. And the idea that frontends should be JS only is preposterous.
- chitinbottler0a 3y agoHey folks, the author of the gem is here. Thank you for all your feedback. I value it a lot! First off, I have changed the API-only bullet point. I wanted it to be short and clear. I didn't mean to sound arrogant. Sorry for that. Second, I'm working on a guide explaining how to use the framework alongside an existing Rails project. So stay tuned!
- lemper 3y ago> the only technology we should be using to create web UI is JavaScript. aight bud. do it without html and css. go on.
- rajaravivarma_r 3y agoThis is great. I had been long looking for something like this in Ruby eco-system. I worked on a Rails app which interacted with a bunch of micro-services and I missed the async-await so much. The problem was, when the app was waiting on API requests, the throughput suffered a lot. We couldn't increase the number of threads a lot, since it increased the memory usage a lot which eventually led to OOMs. I tried to put something together using async-http [0], but it was not very stable. One question would be, how does scheduling work with existing psql and myself db gems. Should the calling code wrap the database calls with `Fiber.await { Fiber.schedule { ... } }`? A framework like this would be very useful when the tech-world is moving towards micro-services, for the good or bad. [0](https://github.com/socketry/async-http https://github.com/socketry/async-http)
- chitinbottler0a 3y ago> Should the calling code wrap the database calls with `Fiber.await { Fiber.schedule { ... } }`? Nope. Scheduling works seamlessly, thanks to Ruby core.
- didip 3y agoIf you want a super fast Rest API server… why are you using Ruby? There are at least 4 languages where it’s more appropriate if you desire a lot of speed.
- dajonker 3y agoThese kinds of projects are good for the ecosystem. Sometimes the underlying technology (such as using fibers here) could end up being used or merged into Rails itself, after successfully demonstrating the benefits.