TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Rust Web Framework

488 点作者 levkk7 个月前
Hi everyone,<p>I&#x27;ve been &quot;funemployed&quot; 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.<p>It&#x27;s boring old MVC, has its own ORM, templates, background jobs, auth, websockets, migrations and more. If you&#x27;re keen but don&#x27;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.<p>I think Rust makes a great prototyping and deploy straight to production language. Now it has yet another framework for y&#x27;all to play with.<p>Cheers!<p>[1] <a href="https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;migrating-from-python&#x2F;" rel="nofollow">https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;migrating-from-python&#x2F;</a>

41 条评论

kvirani7 个月前
Nice, congratulations. It must feel so surreal launching this!<p>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.<p>Some suggestions:<p>- Don&#x27;t allow &quot;callbacks&quot; (what AR calls them) ie hooks like afterCreate in the data model. I know you don&#x27;t have these yet in your ORM, but in case those are on the roadmap, my opinion is that they should not be.<p>- 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&#x2F;package) like Interactor.*<p>* It&#x27;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.<p>Also, curious why existing ORMs or query builders from the community weren&#x27;t leveraged?<p>Disclaimer: I haven&#x27;t written a line of Rust yet (more curious as the days go by). I&#x27;m more curious than ever now, thanks to you!
评论 #41915698 未加载
评论 #41917911 未加载
评论 #41923445 未加载
评论 #41915143 未加载
评论 #41917900 未加载
评论 #41926524 未加载
评论 #41923545 未加载
throwaway3133737 个月前
I would kinda expect REST framework to be able to generate Swagger (aka OpenAPI) definitions out of the box. That&#x27;s one of the killer features of FastAPI in my opinion.<p>Also, I don&#x27;t really understand what is the reason for creating your own ORM instead of integrating with, let&#x27;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].<p>Other than that this project looks really interesting and I will definitely keep an eye on it.<p>[0] <a href="https:&#x2F;&#x2F;diesel.rs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;diesel.rs&#x2F;</a><p>[1] <a href="https:&#x2F;&#x2F;crates.io&#x2F;categories&#x2F;template-engine" rel="nofollow">https:&#x2F;&#x2F;crates.io&#x2F;categories&#x2F;template-engine</a>
评论 #41915379 未加载
评论 #41916364 未加载
评论 #41915941 未加载
评论 #41916443 未加载
评论 #41923604 未加载
评论 #41916052 未加载
评论 #41916690 未加载
stackskipton7 个月前
As SRE, I got interested in <a href="https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;migrating-from-python&#x2F;" rel="nofollow">https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;migrating-from-python&#x2F;</a>. On one hand, this is crazy neat you were able to pull it off. On the stability SRE hand, I&#x27;m internally screaming. At scale, this should be handled by Reverse Proxy (Caddy, Nginx, Traefik, whatever)
评论 #41915492 未加载
评论 #41915488 未加载
评论 #41923503 未加载
notamy7 个月前
What an amazing name choice, certainly one way to end up at the top of search results :P<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.
评论 #41919276 未加载
评论 #41916387 未加载
JodieBenitez7 个月前
&gt; (think Rails, not Flask)<p>I like that... we need more (or better) opiniated frameworks a la rails&#x2F;django in static languages.
nwnwhwje7 个月前
Well done! You could try to get mentioned on <a href="https:&#x2F;&#x2F;www.arewewebyet.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.arewewebyet.org&#x2F;</a>
评论 #41914721 未加载
unjkyivbnp7 个月前
Based! Django&#x2F;Rails in a god tier language!<p>my suggestions:<p>- async-trait should be stabilized now, so you shouldn&#x27;t need the macro anymore<p>- Add opentelemetry integration so we get metrics and tracing out of the box<p>- use jemalloc for linux targets<p>Good work! Keep it up!
评论 #41915800 未加载
评论 #41917284 未加载
DeathArrow7 个月前
I&#x27;ve tried to learn Rust but gave up early. Coming from C#, C&#x2F;C++, Java, Python, Rust seems weird to me.<p>And it&#x27;s not the weirdness that discouraged me, is the slowness of accomplishing one task comparing with languages like C#, Java or Python.<p>And since I mostly do web development these days, ease of use and productivity is paramount for me. True, with Rust there might be a bit more throughput and speed, but judging from latest web frameworks benchmarks both C# and Java tend to do very well in this regard.<p>Please, don&#x27;t read this as a critique of Rust, or me trying to take away such a great accomplishment such as writing a MVC framework from scratch, but more of a &quot;proper tool for the proper job&quot; type of post.
评论 #41925179 未加载
fHr7 个月前
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.
评论 #41916907 未加载
jamiedumont7 个月前
I&#x27;ve been evaluating and building out small prototypes with all the usual suspects for backend Rust work. So far I&#x27;ve reluctantly agreed with the hive mind that Axum on balance is the best choice, despite being lower-level than I&#x27;d like.<p>Other contenders were Loco (but was TOO much like Rails) and Rocket (whose macros only started to bother me after writing more Rust).<p>Your framework seems to perfectly match my criteria of &quot;batteries-included, but not too prescriptive&quot;. Great addition to the ecosystem!
评论 #41918332 未加载
stuaxo7 个月前
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.
chubs7 个月前
Congrats! I have a question: I used to have a job as a Rails developer, and one thing i struggled with was knowing which options&#x2F;hash keys were possible to pass into various functions, due to the lack of typing. Would it be the case that your framework, based in a type-safe language, would give precise autocompletion of all such options? Or does advanced usage of Rust macros remove some of this ability? Thanks!
评论 #41924955 未加载
apbytes7 个月前
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!
评论 #41916642 未加载
miffy9007 个月前
Honestly, including an ORM as a built-in &#x27;feature&#x27; of a web framework seems like a quaintly reasonable idea at first, but I&#x27;m 90% certain that eventually it&#x27;s going to become either (or both):<p>* it&#x27;s own project because maintaining it will take up so much of your time.<p>* be decoupled from the web framework because users will want to use another because your own doesn&#x27;t have abc feature.<p>From observing the ecosystems in .NET, Java and PHP, lots of people have lots of opinions on how ORMs should work.
jpopesculian7 个月前
Looks cool! How does it compare to loco.rs?
throwaway3133737 个月前
I just noticed that REST framework returns 501 - Not Implemented [0] if the method is not implemented, which I think is really weird. I think that most frameworks return 405 Method Not Allowed in such cases.<p>Also, it is typically assumed that 5xx return codes are retryable while 4xx are not. So, I don&#x27;t think that not implemented method should return 5xx, because it is pointless to retry it.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;levkk&#x2F;rwf&#x2F;tree&#x2F;main&#x2F;examples&#x2F;rest#restcontroller">https:&#x2F;&#x2F;github.com&#x2F;levkk&#x2F;rwf&#x2F;tree&#x2F;main&#x2F;examples&#x2F;rest#restcon...</a>
评论 #41927138 未加载
评论 #41925027 未加载
metadat7 个月前
Another related submission from today:<p><i>Ryde: A Rust Web Framework</i> - <a href="https:&#x2F;&#x2F;github.com&#x2F;swlkr&#x2F;ryde">https:&#x2F;&#x2F;github.com&#x2F;swlkr&#x2F;ryde</a> (October 2024, 5 comments)
Guthur7 个月前
```I think Rust makes a great prototyping and deploy straight to production language.```<p>How?
timkofu7 个月前
Thanks for this. I&#x27;ve been looking for a Django-esque web-framework for Rust for a while now, and it would seem I&#x27;m not the only one[1].<p>Also, if you&#x27;re open to suggestions, use SemVar, and have releases on GH so we get email notifications.<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41760421">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41760421</a>
评论 #41922046 未加载
robert_foss7 个月前
@levkk How do you thing it compares to loco.rs, I&#x27;d like to understand the differences.
jcmontx7 个月前
Do you plan on adding CRUD generators? That was the killer feature of MVC frameworks
评论 #41917595 未加载
tommaho7 个月前
Thanks for sharing!<p>As a heads-up, The Pages documentation page is blank.<p><a href="https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;controllers&#x2F;pages&#x2F;" rel="nofollow">https:&#x2F;&#x2F;levkk.github.io&#x2F;rwf&#x2F;controllers&#x2F;pages&#x2F;</a>
wormlord7 个月前
Cool! Since I learned Rust I&#x27;ve wanted a Django replacement that has the functionality of a batteries included Web Framework + the speed&#x2F;footprint of Rust. I&#x27;ll check it out!
PaulDavisThe1st7 个月前
&gt; boring old MVC<p>&gt; Written using the classic MVC pattern (model-view-controller)<p>well, the &quot;classic web&quot; version I assume. I&#x27;ve never seen a web context in which the original MVC model was used.
sureglymop7 个月前
Looks great, very interesting! How is the state of to documentation?
评论 #41919136 未加载
dethos7 个月前
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.
MASNeo7 个月前
I can already hear people asking &quot;Did you aRWF already?&quot; Seriously, the migration option is precisely how I think migration for years. Great job!
alberth7 个月前
Does Rust have any DSL for web use (e.g. Rails in someways is a DSL to Ruby)?<p>I ask because I imagine a simplified (Rust) syntax would be more inviting to newcomers.
评论 #41914994 未加载
donq1xote17 个月前
I love rust!! This is so cool and I&#x27;m a beginner and I&#x27;m not sure if I can utilize this framework or not.
评论 #41915837 未加载
Arch-TK7 个月前
Surely it has a WSGI client not a server.
giancarlostoro7 个月前
Very interesting. I might have to check this out after work!
the__alchemist7 个月前
Love it; this is a big gap in Rust&#x27;s ecosystem IMO.
评论 #41915226 未加载
taikahessu7 个月前
Impressive launch, good luck and happy coding!
lopatin7 个月前
&gt; I think Rust makes a great prototyping and deploy straight to production language<p>Sorry what? Isn&#x27;t Rusts whole thing is that it prevents you from prototyping wild ideas, in the name of memory safety?
评论 #41924873 未加载
benpacker7 个月前
What happened with PostgresML?
lord-squirrel7 个月前
This looks very cool!
Havoc7 个月前
Hopefully it takes off.
hkc88hkc7 个月前
Well done!
imiric7 个月前
After years of working with web frameworks in Python and Java, and then picking up Go along the way, I&#x27;ve come to appreciate Go&#x27;s approach much more. That is, with a rich and capable standard library, you really don&#x27;t need traditional frameworks. Need an HTTP server, router, etc.? Use stdlib. Need templates? Use stdlib. Need an ORM? You don&#x27;t, but you may want to consider a small 3rd party query builder library of your choice. And so on.<p>This avoids depending on a complex framework that may or may not exist in a few years, improves security by minimizing the amount of 3rd party dependencies, keeps the learning curve low for any new developers joining the project, and is more flexible and easier to maintain. I don&#x27;t have experience with Rust, and judging by the comments here, web frameworks might still be useful for it. Which is a shame, since the batteries included stdlib approach is far superior IME.<p>Anyway, I don&#x27;t want to shoot down your efforts. Congrats on the launch and good luck!
评论 #41919738 未加载
评论 #41920442 未加载
评论 #41919823 未加载
评论 #41923056 未加载
评论 #41918959 未加载
评论 #41919110 未加载
评论 #41924982 未加载
评论 #41921397 未加载
评论 #41924884 未加载
评论 #41919336 未加载
评论 #41920300 未加载
评论 #41923336 未加载
评论 #41922584 未加载
jakswa7 个月前
Lately I&#x27;ve been following <a href="https:&#x2F;&#x2F;loco.rs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;loco.rs&#x2F;</a> as it aims for a rails-like experience, complete with generators for workers, controllers, etc. I&#x27;ve only had time to experiment but it&#x27;s the closest I&#x27;ve gotten to feeling rails-y in rust.
评论 #41916693 未加载
ratedgene7 个月前
[flagged]
评论 #41914732 未加载
评论 #41914712 未加载
评论 #41914858 未加载