Most active commenters
  • levkk(10)
  • the__alchemist(5)
  • stackskipton(5)
  • ratedgene(3)
  • (3)
  • JodieBenitez(3)
  • alberth(3)
  • throwaway313373(3)
  • sodapopcan(3)
  • culi(3)

291 points levkk | 112 comments | | HN request time: 1.636s | source | bottom

Hi everyone,

I've been "funemployed" for a few months and with all that free time and idle hands I wrote a full web framework (think Rails, not Flask) for Rust.

It's boring old MVC, has its own ORM, templates, background jobs, auth, websockets, migrations and more. If you're keen but don't feel like rewriting your app in a different language, Rwf has a WSGI server to run Django (or Flask) inside Rust [1], letting you migrate to Rust at your own pace without disrupting your website.

I think Rust makes a great prototyping and deploy straight to production language. Now it has yet another framework for y'all to play with.

Cheers!

[1] https://levkk.github.io/rwf/migrating-from-python/

1. nwnwhwje ◴[] No.41914675[source]
Well done! You could try to get mentioned on https://www.arewewebyet.org/
replies(1): >>41914721 #
2. levkk ◴[] No.41914712[source]
I'm old too, this is how I pretend to stay young.
replies(2): >>41914857 #>>41917942 #
3. giancarlostoro ◴[] No.41914719[source]
Very interesting. I might have to check this out after work!
4. trevor-e ◴[] No.41914721[source]
Very surprising this page doesn't mention loco.rs which seems like the most "Rails" Rust framework out there.
5. Klonoar ◴[] No.41914732[source]
These kinds of comments seem to be like a fire starter on this site, but I cannot for the life of me see how they fit in the site guidelines.

(At some point this place has to contend with the issue of “we started as people trying to build cool things and wound up with every thread being nonstop complaints or nitpicking”.)

replies(4): >>41914752 #>>41914764 #>>41914851 #>>41915088 #
6. notamy ◴[] No.41914746[source]
What an amazing name choice, certainly one way to end up at the top of search results :P

To be serious, good job!! Building a good framework is a shockingly large task, and it’s always nice to see people exploring the design space and trying for new ideas.

replies(1): >>41916387 #
7. TZubiri ◴[] No.41914752{3}[source]
chill brother, let an old man yell at clouds
replies(1): >>41914769 #
8. Havoc ◴[] No.41914761[source]
Hopefully it takes off.
9. sureglymop ◴[] No.41914763[source]
Looks great, very interesting! How is the state of to documentation?
10. ratedgene ◴[] No.41914764{3}[source]
haha yeah it was a bit tongue in cheek as I'm learning another framework right now. If we can't have a little levity I'll just delete my comment if it upsets you. :)
11. ratedgene ◴[] No.41914769{4}[source]
hahah thanks :)
12. pvg ◴[] No.41914851{3}[source]
They don't, just flag them rather than reply them. It's the only way to be sure.
13. mmontagna9 ◴[] No.41914857{3}[source]
The youngest old man I know at any rate
14. ◴[] No.41914858[source]
15. kvirani ◴[] No.41914951[source]
Nice, congratulations. It must feel so surreal launching this!

One of my biggest learnings from doing a bunch of web MVC through Rails over the years is that the framework should heavily discourage business logic in the model layer.

Some suggestions:

- Don't allow "callbacks" (what AR calls them) ie hooks like afterCreate in the data model. I know you don't have these yet in your ORM, but in case those are on the roadmap, my opinion is that they should not be.

- That only really works though if you not strongly encourage a service aka business logic layer. Most of my Rails app tend to have all of these as command aka service objects using a gem (library/package) like Interactor.*

* It's my view that MVC (and therefore Rails otb) is not ideal by itself to write a production-ready app, because of the missing service layer.

Also, curious why existing ORMs or query builders from the community weren't leveraged?

Disclaimer: I haven't written a line of Rust yet (more curious as the days go by). I'm more curious than ever now, thanks to you!

replies(4): >>41915143 #>>41915698 #>>41917900 #>>41917911 #
16. JodieBenitez ◴[] No.41914959[source]
> (think Rails, not Flask)

I like that... we need more (or better) opiniated frameworks a la rails/django in static languages.

17. alberth ◴[] No.41914974[source]
Does Rust have any DSL for web use (e.g. Rails in someways is a DSL to Ruby)?

I ask because I imagine a simplified (Rust) syntax would be more inviting to newcomers.

replies(1): >>41914994 #
18. tommaho ◴[] No.41914981[source]
Thanks for sharing!

As a heads-up, The Pages documentation page is blank.

https://levkk.github.io/rwf/controllers/pages/

19. levkk ◴[] No.41914994[source]
Yup, they are called "macros". Rwf uses a few of them, some of which you'll find familiar, e.g. `render!` which returns a rendered template with HTTP 200 [1].

[1] https://levkk.github.io/rwf/views/templates/templates-in-con...

replies(1): >>41915025 #
20. alberth ◴[] No.41915025{3}[source]
That's good to know.

From the ReadMe example, is there a way to use macros to simplify the following line of code:

  async fn handle(&self, request: &Request) -> Result<Response, Error> {
I ask because many web developers don't come from a C/C++/Rust background - so the line above will be jarring/off-putting to many.

(Awesome project btw)

replies(4): >>41915066 #>>41915092 #>>41915118 #>>41915139 #
21. throwaway313373 ◴[] No.41915030[source]
I would kinda expect REST framework to be able to generate Swagger (aka OpenAPI) definitions out of the box. That's one of the killer features of FastAPI in my opinion.

Also, I don't really understand what is the reason for creating your own ORM instead of integrating with, let's say diesel.rs [0] and what is the reason for inventing your own template language instead of just picking one of the most popular existing template engines [1].

Other than that this project looks really interesting and I will definitely keep an eye on it.

[0] https://diesel.rs/

[1] https://crates.io/categories/template-engine

replies(6): >>41915379 #>>41915941 #>>41916052 #>>41916364 #>>41916443 #>>41916690 #
22. taikahessu ◴[] No.41915033[source]
Impressive launch, good luck and happy coding!
23. the__alchemist ◴[] No.41915053[source]
Love it; this is a big gap in Rust's ecosystem IMO.
replies(1): >>41915226 #
24. levkk ◴[] No.41915066{4}[source]
Thanks!

Yes, I was thinking of adding a shorthand for that. Will add something soon!

25. AnimalMuppet ◴[] No.41915088{3}[source]
I think there is a valid claim to be made that web frameworks cost more to learn than they pay off in value in using them.

Mind you, I don't assert that claim. I don't know; I'm not in web development. But I could see how having to learn a new framework that wouldn't pay back the effort would give rise to some valid complaints.

26. fkyoureadthedoc ◴[] No.41915092{4}[source]
You might be surprised, with Typescript's ubiquity in the web space the type definitions probably won't be too scary. I've never used Rust but I assume `&` is some kind of Rusty pointer.
27. Scarblac ◴[] No.41915118{4}[source]
Coming from Typescript that doesn't look very ominous to me, though it would nice if the types could be inferred somehow.
28. hkc88hkc ◴[] No.41915126[source]
Well done!
29. jpopesculian ◴[] No.41915136[source]
Looks cool! How does it compare to loco.rs?
30. afavour ◴[] No.41915139{4}[source]
Rust can be an intimidating language but the example you’ve provided there really shouldn’t be intimidating to anyone that’s using TypeScript today. There’s a little learning to with &self and & but that’s really basic Rust stuff. I don’t think it’s wise for a framework to attempt to hide core components of the language.
31. sodapopcan ◴[] No.41915143[source]
> * It's my view that MVC (and therefore Rails otb) is not ideal by itself to write a production-ready app, because of the missing service layer.

This is quite the claim. I despise service objects, personally. They end up scattering things around and hurt discoverability. There are other ways to do modelling that scale very well. There are a few blog posts on it, here's one from someone at Basecamp: https://dev.37signals.com/vanilla-rails-is-plenty/

This is of course very OO which I'm not a huge fan of. Elixir's Phoenix framework, for example, uses "contexts" which is meant to group all related functionality. In short they could be considered a "facade."

In any event, if you like services you like services, they can work, but saying MVC isn't enough for production-grade is a bit misguided.

I do agree that model callbacks for doing heavy lifting business processes is not great, though for little things like massaging data into the correct shape is pretty nice.

replies(1): >>41915585 #
32. MASNeo ◴[] No.41915193[source]
I can already hear people asking "Did you aRWF already?" Seriously, the migration option is precisely how I think migration for years. Great job!
33. culi ◴[] No.41915226[source]
Is it? Asking as someone not very tuned into the ecosystem. Based on TechEmpower's Web Framework Benchmarks[0] and AreWeWebYet's resounding "yes!" for years now[1] I always got the impression that there were quite a few options available.

Rocket, Actix, Axum, Salvo, etc just to name a few. Each with different focuses (e.g. performance vs "batteries-included-ness")

[0] https://www.techempower.com/benchmarks/#hw=ph&test=composite...

[1] https://www.arewewebyet.org/

replies(3): >>41915283 #>>41915353 #>>41916184 #
34. the__alchemist ◴[] No.41915283{3}[source]
Great question!

The frameworks you listed are not a direct comparison to this lib, nor Rails, nor Django. They are Flask analogs. They are ideal for microservices, but are not a substitute for a batteries-included framework of the sort used in websites.

I love rust, but don't use it for web backends because there is nothing on Django's level.

replies(3): >>41915421 #>>41915535 #>>41915889 #
35. culi ◴[] No.41915315[source]
Or any of these XD https://www.arewewebyet.org/topics/frameworks/
36. apbytes ◴[] No.41915331[source]
Great work!! I was just talking about how this is a major gap in Rust and here you are the very next day! Looking forward to use and contribute!
replies(1): >>41916642 #
37. stackskipton ◴[] No.41915353{3}[source]
No, it's there but it's not popular and probably won't be for a while. Higher level languages like Java/JS/.Net/Go already do the job well enough for vast majority of use cases. Sure, there are cases like Discord where Go performance was impactful to their operations but those are pretty niche edge cases. Vast majority of people don't have those edge cases so any GC stutter is fine.
38. levkk ◴[] No.41915379[source]
I tried Diesel years ago, it was too "Rusty" for me. It made you define your schema twice, and couldn't use the same structs for inserts and selects (so 3 times, really). Overall, great first attempt at matching database types to Rust types, but the ORM needs to be more flexible and ergonomic - it's supposed to make writing queries easier, not harder :)

As for templates, writing your own language is almost a right of passage into 30s+ nerd club. I never read the dragon book, but I always wanted to take that class in school. There will always be different implementations of the same thing, and writing this one that mimics very closely what ERB (Rails) does felt right.

replies(3): >>41915438 #>>41916559 #>>41917043 #
39. stackskipton ◴[] No.41915387[source]
As SRE, I got interested in https://levkk.github.io/rwf/migrating-from-python/. On one hand, this is crazy neat you were able to pull it off. On the stability SRE hand, I'm internally screaming. At scale, this should be handled by Reverse Proxy (Caddy, Nginx, Traefik, whatever)
replies(2): >>41915488 #>>41915492 #
40. stackskipton ◴[] No.41915421{4}[source]
How many people are greenfield new Django style projects? I know Static Server-Side Rendering is becoming new hotness but I still thought pure Server-Side Rendering is frowned upon.

Most of SSR I see is still SPA + Rest API/GraphQL backend with some scraper generating all the HTML.

replies(1): >>41915464 #
41. the__alchemist ◴[] No.41915438{3}[source]
Same: I was put off by keeping track of models in triplicate, and the lack of automatic migrations. These are considered features, vice bugs; it's not for me.
replies(1): >>41916550 #
42. the__alchemist ◴[] No.41915464{5}[source]
This is orthogonal; You don't use auth, email, automatic admin, migrations etc from a SPA; those are backend jobs.
43. fHr ◴[] No.41915481[source]
Nice got rustpilled myself recently through ditching webpack js loaders and using rust ones which are 50x faster, rust is so preformance enhancing, c++ and rust are my favourite languages atm.
replies(1): >>41916907 #
44. biorach ◴[] No.41915488[source]
I imagine the author assumed a technical audience wouldn't need to be told of the necessity of a reverse proxy in front of the wsgi server
replies(2): >>41915559 #>>41915828 #
45. levkk ◴[] No.41915492[source]
I thought the same thing, but this allows you to test your changes locally as an application engineer, without the back and forth. This goes back to the good old monolith vs. microservices debate.

Writing a stable WSGI server is possible, and not very hard with a bit of attention to detail, e.g. thread counts, vacuum (just like good old php-fpm, restart every n requests...), etc. Basically if you implement most options uwsgi has, you're on the right path. It's on the roadmap to make Rwf comparable to running Gunicorn.

replies(1): >>41916251 #
46. cchance ◴[] No.41915535{4}[source]
So... rust "on rails" is basically ... https://github.com/loco-rs/loco

less rails is... leptos, and a few others

47. drcongo ◴[] No.41915559{3}[source]
As a Python dev, I imagined the same.
48. jt2190 ◴[] No.41915585{3}[source]
It would help a lot if you would clarify what you mean by “service object”. In my experience a single method on a service object would define a transaction. Is that what you mean by “service object”?
replies(1): >>41915940 #
49. ecshafer ◴[] No.41915698[source]
> One of my biggest learnings from doing a bunch of web MVC through Rails over the years is that the framework should heavily discourage business logic in the model layer.

I am curious where this comes from, because my thinking is the absolutely opposite. As much business logic as possible should belong in the model. Services should almost all be specific more complex pieces of code that are triggered from the model. Skinny controller, Fat Model, is the logic of code organization that I find makes code the easiest to debug, organize, and discover. Heavy service use end up with a lot of spaghetti code in my experience.

The other part is that from a pure OOP pov, the model is the base object of what defines the entity. Your "User" should know everything about itself, and should communicate with other entities via messages.

> Don't allow "callbacks" (what AR calls them) ie hooks like afterCreate in the data model. I know you don't have these yet in your ORM, but in case those are on the roadmap, my opinion is that they should not be.

This I agree with. Callbacks cause a lot of weird side effects that makes code really hard to debug.

replies(6): >>41916047 #>>41916627 #>>41916992 #>>41917222 #>>41917360 #>>41918421 #
50. unjkyivbnp ◴[] No.41915736[source]
Based! Django/Rails in a god tier language!

my suggestions:

- async-trait should be stabilized now, so you shouldn't need the macro anymore

- Add opentelemetry integration so we get metrics and tracing out of the box

- use jemalloc for linux targets

Good work! Keep it up!

replies(2): >>41915800 #>>41917284 #
51. donq1xote1 ◴[] No.41915779[source]
I love rust!! This is so cool and I'm a beginner and I'm not sure if I can utilize this framework or not.
replies(1): >>41915837 #
52. wormlord ◴[] No.41915784[source]
Cool! Since I learned Rust I've wanted a Django replacement that has the functionality of a batteries included Web Framework + the speed/footprint of Rust. I'll check it out!
53. levkk ◴[] No.41915800[source]
Thank you!

I tried to use standard async traits, but they don't support dynamic dispatch [1] which Rwf uses extensively.

I'll be adding opentelemetry tags to functions (from the `tracing` crate). jemalloc can be added to the binary apps that use Rwf, we don't need to add it as a dep to the lib.

Cheers!

[1] https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-trait...

54. stackskipton ◴[] No.41915828{3}[source]
As SRE, you assume 100% wrong. Devs totally need to be told "Please don't do this in production." They will ignore you but hey, you might reach a few.
55. levkk ◴[] No.41915837[source]
You definitely can. I remember learning Django and Rails as a beginner, it wasn't straight forward. New things are hard until they are not new. Good luck!
56. culi ◴[] No.41915889{4}[source]
Rocket comes with support for templating, cookies, websockets, middleware, an orm, testing, etc. I'm not familiar with Python web development (or why anyone would reach for Python for a webapp in 2024 :P), but it seems pretty analogous to Rails

It's also the oldest/most mature tool out there

replies(1): >>41917627 #
57. sodapopcan ◴[] No.41915940{4}[source]
Along the lines of what OP is talking about, part of the problem is that Rails has no service objects, so I have seen a handful of different ideas of what they mean (probably no more than 10).

The one I've seen he most is stuff like `UserRegistrationService` or the like. These things can end up getting scattered and in general, I would rather just talk to the business object, ie, `User.register` which can delegate to a more complex private object handling it. It's basically "inverting" things. The win here is that things are more discoverable (You can look at the user object and see a list of everything it does) and more importantly draws better boundaries. This way the web layer only has to know about `User` instead of `RegisterUserService` and `DeleteUserService` etc.

Again, services can work and aren't inherently bad, but plain MVC can certainly also work.

replies(1): >>41916900 #
58. fmbb ◴[] No.41915941[source]
Know of any similar frameworks that work the other way around? Where you can Keep an openapi definition as the source of truth and validate that your server follows it, I mean.
replies(5): >>41916004 #>>41916011 #>>41916288 #>>41916614 #>>41917044 #
59. jjnoakes ◴[] No.41916004{3}[source]
You could generate a spec for the service and then diff to the expected perhaps.
60. internetter ◴[] No.41916011{3}[source]
You can simply diff it. Define the OpenAPI spec, have the framework generate a spec, compare.
61. idle_zealot ◴[] No.41916047{3}[source]
This sounds to me like the standard OOP versus Data Oriented programming divide. You want to think of code as a bunch of bundles of data and associated functionality, GP wants to think of code as data models and services or functions that act on them.
62. outside1234 ◴[] No.41916052[source]
Just FYI - since this is an asynchronous framework you probably would want something like sqlx versus Diesel (which is sync if I recall correctly)
63. dehrmann ◴[] No.41916184{3}[source]
I would have argued Rust isn't the right choice for a web framework unless the team is rust-first because the memory guarantees aren't really needed, and you're better off with occasional GC pauses and faster development velocity.
replies(2): >>41917908 #>>41918014 #
64. stackskipton ◴[] No.41916251{3}[source]
Sure, but Gunicorn doesn't try and run Node. I totally get benefit for development; I was just worried about someone YOLOing this into production.
65. giancarlostoro ◴[] No.41916288{3}[source]
As others suggested, I would diff against a generated one, then potentially treat the generated one as source of truth in the future... Then diff accordingly as it changes.
66. bryanlarsen ◴[] No.41916364[source]
https://github.com/poem-web/poem is one Rust framework with swagger definitions out of the box.
67. alberth ◴[] No.41916387[source]
> What an amazing name choice

"Row" would be another good name choice, that would also be easier to say than 'rwf'.

RustOnWeb.com is even able to buy for $10 :)

Just say'n

68. steveklabnik ◴[] No.41916443[source]
100% agree that generating OpenAI from your server is a killer feature, it works well for us with Dropshot.
69. phibz ◴[] No.41916550{4}[source]
I tried diesel about 5 years ago. I needed to do relationships where the foreign key lived on the other side of the relationship from what diesel wanted. IIRC diesel only supported the key on a specific side, I think it was a M:1 relationship. Diesel docs said this was unsupported. I was still learning traits at the time but navigating how to implement this in diesel was beyond me. I used sqlx and moved on.
70. xyst ◴[] No.41916559{3}[source]
Never been a fan of ORMs in general. Working with the extra abstraction layer on top of SQL can be painful.
71. florianmartens ◴[] No.41916614{3}[source]
I agree. API-first is the way! Change your schema, auto-generate types into your code and use them for your server definition. It's just faster and more secure this way. Use api-fiddle.com or spotlight.io to work with the schemas (branching, sync with Github).

In a fully typesafe world, it should be pretty hard to derive from the shema this way.

72. yoyonamite ◴[] No.41916627{3}[source]
It's because people ended up with models that were thousands of lines and difficult to reason about. Out of curiosity, did you end up running into this issue and how did you deal with it?
replies(2): >>41917125 #>>41917580 #
73. xyst ◴[] No.41916642[source]
What are these projects missing that you feel there’s a “major gap” in the web framework space?

rocket.rs, actix, axum, warp, gotham, ruille

74. jakswa ◴[] No.41916652[source]
Lately I've been following https://loco.rs/ as it aims for a rails-like experience, complete with generators for workers, controllers, etc. I've only had time to experiment but it's the closest I've gotten to feeling rails-y in rust.
replies(1): >>41916693 #
75. ◴[] No.41916690[source]
76. ◴[] No.41916693[source]
77. CSSer ◴[] No.41916900{5}[source]
I feel like the same people that like UserRegistrationService will argue that database table names should be plural because it reads better, which is wrong for similar reasons.
replies(1): >>41917068 #
78. drcongo ◴[] No.41916907[source]
Oooh, mind sharing what you ditched web pack in favour of?
79. JamesSwift ◴[] No.41916992{3}[source]
In general, I think 'unit test' level business logic should be in the model (think configuration for data-driven workflows, normalization logic, etc) but 'integration test' business logic should be in a service (callback logic, triggering emails, reaching across object boundaries, etc).

I think most people agree about skinny controllers but I've definitely seen disagreement on if that gets moved to fat models or service objects.

80. throwaway313373 ◴[] No.41917043{3}[source]
Re ORM: fair enough, I don't have any experience with Diesel, just wanted to know if you have an actual reason or if it's just a case of NIH [0] syndrome :)

Re templates: I understand that writing a new template engine can be a very fun task (it is both hard enough not to be boring and easy enough not to feel daunting). I also thought many times of creating my own template engine to fix things that I don't like in the language that I am currently using (mostly jinja2).

But if you intend this project to become an actual production ready solution, I see a lot of good reasons not to reinvent template language:

1. Forcing users to learn yet another template language is an additional entrance barrier

2. Tooling support. Existing languages might already have a good tooling support (coming from Python world: PyCharm supports both Django templates and jinja2 very well) including syntax highlighting, auto-complete, auto-formatting, linting etc. Are you going to create all of it yourself?

3. You mentioned planned migration from Python. How exactly I am supposed to manage templates during the transition period? Do I have to have two copies of each template: one in legacy language and one in your new language? If you had a template language compatible with Django/jinja2 [1] this problem would not arise.

4. Whether we like it or not more and more people are using LLMs for coding. This potentially could solve the issue of migrating templates. I expect LLMs to perform really well on the task of "translating" a template from a <popular template language A> to a <popular template language B>. The problem is that if your template language is brand new, LLMs probably didn't have enough examples in their training sets to "learn" its syntax. So, basically, you are setting up your users for a boring, tedious and error prone task of rewriting each template manually without a proper support from their IDE/editor. Meh.

BTW, Django makes it very easy to bring your own template engine [2].

[0] https://en.wikipedia.org/wiki/Not_invented_here

[1] https://github.com/mitsuhiko/minijinja

[2] https://docs.djangoproject.com/en/5.1/howto/custom-template-...

replies(1): >>41917836 #
81. JamesSwift ◴[] No.41917044{3}[source]
Rswag is still my favorite openapi-related project. You write integration tests against the server and get an openapi spec as output. But thats for rails.
82. sodapopcan ◴[] No.41917068{6}[source]
I don’t really follow. My focus wasn’t on the naming but the location of responsibilities.
83. throwaway313373 ◴[] No.41917125{4}[source]
If I had to choose between thousands lines in models and thousands lines in controllers I'd definitely take "fat" models over "fat" controllers.
84. CharlieDigital ◴[] No.41917222{3}[source]

    > I am curious where this comes from, because my thinking is the absolutely opposite. As much business logic as possible should belong in the model.
The opposite of this is what Fowler has called an "Anemic Domain Model"[0] which is ostensibly an anti-pattern. What I've learned from my own experience is that with an anemic domain model, the biggest challenge is that the logic for mutating that object is all over the codebase. So instead of `thing.DoDiscreteThang()`, there could be one or more `service1.DoDiscreteThang(thing)` and `serviceN.DoDiscreteThang(thing)` because the author of `service1` didn't know that `service2` also did the mutation.

Domain models are hard to do well and I think the SOA era brought a lot of confusion between data transfer objects, serialized objects, anemic domain models, and domain models.

[0] https://martinfowler.com/bliki/AnemicDomainModel.html

85. sedatk ◴[] No.41917284[source]
> use jemalloc for linux targets

Why is that? Or, why isn't it required for other targets?

86. Guthur ◴[] No.41917290[source]
```I think Rust makes a great prototyping and deploy straight to production language.```

How?

87. jamiedumont ◴[] No.41917323[source]
I've been evaluating and building out small prototypes with all the usual suspects for backend Rust work. So far I've reluctantly agreed with the hive mind that Axum on balance is the best choice, despite being lower-level than I'd like.

Other contenders were Loco (but was TOO much like Rails) and Rocket (whose macros only started to bother me after writing more Rust).

Your framework seems to perfectly match my criteria of "batteries-included, but not too prescriptive". Great addition to the ecosystem!

replies(1): >>41918332 #
88. JodieBenitez ◴[] No.41917360{3}[source]
> This I agree with. Callbacks cause a lot of weird side effects that makes code really hard to debug.

Also Django signals, Symfony events... makes things extensible but also hard to debug indeed.

replies(1): >>41917582 #
89. jcmontx ◴[] No.41917536[source]
Do you plan on adding CRUD generators? That was the killer feature of MVC frameworks
replies(1): >>41917595 #
90. robert_foss ◴[] No.41917561[source]
@levkk How do you thing it compares to loco.rs, I'd like to understand the differences.
91. ecshafer ◴[] No.41917580{4}[source]
I work on a few projects that do have a model that is over a thousand lines long. A lot of times as the model gets more complex, you start moving associated model logic into their own models, which helps reduce the problem space. I think its fine because the logic ends up being cohesive and explicit. Whereas services end up with logic being hard to track down when they get very large and usually scattered.
92. fragmede ◴[] No.41917582{4}[source]
attach a debugger to the running process
93. levkk ◴[] No.41917595[source]
It's there but the docs aren't written yet. See the REST example in the repo. I'll have some docs for that soon.
94. JodieBenitez ◴[] No.41917627{5}[source]
"The goal is for functionality like templating, sessions, ORMs, and so on to be implemented entirely outside of Rocket"

So definitely a Flask, not a Django. And I want no Flask.

> why anyone would reach for Python for a webapp in 2024

Because it works damn fine, is complete and stable, has a gigantic ecosystem covering virtually every needs in the field and also we know the ins and outs of it.

Of course, less resource consumption is always good, particularly RAM, hence why we're interested in initiatives like RWF or why I keep an eye on the Go ecosystem.

95. stuaxo ◴[] No.41917679[source]
Sounds nice, years of Django dev (with some other dev sprinkled in) has really taught me the value of boring old MVC and the rest of the ingredients, will def be having a look.
96. dethos ◴[] No.41917725[source]
Awesome, looking forward to testing it out. I really like that idea of being able to gradually migrate WSGI (Django) apps, or even support running both at the same time.
97. levkk ◴[] No.41917836{4}[source]
In random order:

1 & 2. It's not really a new language. It's very similar to ERB, so existing tooling, including syntax highlighting, etc., shouldn't be an issue.

4. LLMs are actually pretty good at "understanding" programming language syntax and replicating it to generate code, so even a new language would work. Besides, there is really nothing new under the sun, so similarities with existing languages would help here.

3. I migrated once from Jinja to Sailfish [1], it wasn't so bad. All template languages are roughly the same: start code tag, some simple code, end code tag, maybe a loop or an if statement, but the vast majority of it is print a variable. It would be nice to bring your templates over during a migration, but they are typically a small portion of your code compared to business logic, so I don't think it'll be a roadblock, if someone wanted to attempt this at all.

[1] https://github.com/rust-sailfish/sailfish

98. LeftHandPath ◴[] No.41917900[source]
Interesting. I’ve rolled my own PHP ORM at work (forbidden from using FOSS libraries like Laravel) and found hooks to be extremely useful. Notably, my programming experience started with PHP for Wordpress which used hooks extensively, so maybe I’m biased.

Mine has a table spec that can translate into a SQL definition or spit out a nicely formatted HTML form. There’s a separate controller that handles all DB connections / CRUD operations, with before- and after-hooks that can easily cross reference with other tables and constraints if needed.

It all works pretty nicely, although I would still switch to Laravel in an instant if I could.

replies(1): >>41918071 #
99. ku1ik ◴[] No.41917908{4}[source]
That’s my take as well. To each their own, but for me there are other, GC-ed, languages that are performant enough and way more productive (and I love Rust!)
100. globular-toast ◴[] No.41917911[source]
What even is a "model" if it doesn't have business logic? It sounds like you just want your model to be built from structs (that you call models) and procedures (that you call services). You can do that, but it can be quite hard to reason about what ways an entity can be updated, because any number of procedures could do it and all have their own ideas about what the business rules are. At this point your procedures might as well write back to the db themselves and just get rid of the "models".
replies(1): >>41918206 #
101. ratedgene ◴[] No.41917942{3}[source]
Understandable. I wasn't criticizing your product -- best of luck and congrats on shipping :)
102. the__alchemist ◴[] No.41918014{4}[source]
This is perhaps a bit off topic, but I don't think rust is a one-trick-pony IRT memory safety. I hear this a lot, mainly from Rust programmers. [surprisingly]
103. freedomben ◴[] No.41918071{3}[source]
Please don't feel obligated to answer if you can't, but why can't you use FOSS libraries like Laravel? Are you not even allowed to use MIT licensed stuff? What industry do you work in?
replies(1): >>41918135 #
104. LeftHandPath ◴[] No.41918135{4}[source]
Small aerospace company. We had a really old school CEO at the time the project was started - didn’t even want us using GitHub since it was on the cloud. Everything runs on an on-premise IBM i Series (AS400 / IBM Mainframe).

I pushed hard and was able to get us to the point where stuff runs in PASE with modern languages (like PHP).

It’s not any specific licensing issue, just organizational distrust of anything that isn’t paid for.

replies(3): >>41918199 #>>41918443 #>>41918474 #
105. freedomben ◴[] No.41918199{5}[source]
Thanks, that is quite fascinating! I recently spoke with a very old school IT guy who was setting up his brother's IT stuff for a new business, and he is militant about on-prem and other stuff too. It's a very interesting mentality, though so foreign to me as I strongly gravitate toward FOSS instead of away from it.
106. pdhborges ◴[] No.41918206{3}[source]
Some people use the ORM models as pure persistence models. They just define how data is persisted. Business models are defined elsewhere.

I think makes sense when you application grows larger. Domains become more complex and eventually how data is persisted can become quite different from how it is represented in the business domain.

107. factormeta ◴[] No.41918332[source]
What about Actix? There were some discussion on HN a while back related to Actix vs Axum if I recall that.
108. appguy ◴[] No.41918421{3}[source]
Business logic should sit in the domain model, but not the orm model. The domain model should be an object that is not coupled with the web framework. In the Clean Architecture approach this is called an Entity.
109. snowAbstraction ◴[] No.41918443{5}[source]
Thanks for sharing that. AS400 always catches my eye after doing in internship at IBM, working with AS400 back in 2000.
110. lopatin ◴[] No.41918459[source]
> I think Rust makes a great prototyping and deploy straight to production language

Sorry what? Isn't Rusts whole thing is that it prevents you from prototyping wild ideas, in the name of memory safety?

111. ensignavenger ◴[] No.41918474{5}[source]
Are there not any Laravel shops that would take your money so you can "pay" for it?