# Why hasn't Discourse been rewritten in Rust?

**URL:** https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333
**Category:** Development
**Created:** [July 15, 2024, 2:21pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333 "2024-07-15T14:21:14Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tsk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tsk/32/101313_2.png) [@tsk](https://meta.discourse.org/u/tsk)
#### Post date: [July 15, 2024, 2:21pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/1 "2024-07-15T14:21:14Z")

</div>

Would memory safety greatly benefit the platform?  
Performance could also see an improvement.

I also think the never ending discourse bugs could be reduced with Rust.

Will discourse as a modern platform survive without being rewritten in Rust?

With the ease and efficiency of Rust development labour shouldn’t be an issue.

Thoughts?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 15, 2024, 2:22pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/2 "2024-07-15T14:22:33Z")

</div>

Are you volunteering to port it? 😅

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 15, 2024, 2:26pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/3 "2024-07-15T14:26:33Z")

</div>

Jeff wrote a blog article about why Ruby:

> **[Why Ruby?](https://blog.codinghorror.com/why-ruby/)**
>
> I’ve been a Microsoft developer for decades now. I weaned myself on various flavors of home computer Microsoft Basic, and I got my first paid programming gigs in Microsoft FoxPro, Microsoft Access, and Microsoft Visual Basic. I have seen the future...

Probably written prior to Rust ([yes](https://en.wikipedia.org/wiki/Rust_(programming_language))), but will surely provide some justification.

---

<div class="post-metadata">

### Author: ![tsk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tsk/32/101313_2.png) [@tsk](https://meta.discourse.org/u/tsk)
#### Post date: [July 15, 2024, 2:28pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/4 "2024-07-15T14:28:15Z")

</div>

Sure but Microsoft is also going the way of rust.

Jeff surely knows by now Rust is superior.  
It could be done in 12-16 days with some blood sweat and tears. He’s a bit young to retire yet.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 15, 2024, 3:04pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/5 "2024-07-15T15:04:53Z")

</div>

I’m pretty sure that it takes at least 12-16 days to upgrade to a new version of Ruby or postgres. There are about 60K lines of Ruby.

What would replace Rails?

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [July 15, 2024, 3:06pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/6 "2024-07-15T15:06:14Z")

</div>

Microsoft has very deep pockets and resources.

One you would need to rewrite core and also all plugins.

This would also mean the road map would need to be put on hold.

Could it be done sure. But you also need to test and debug.

Current customers of discourse would likely have their sites break.

Imho if the team were to work on this. It would need to be worked on as a fork with beta testers over a long period of time. Forking plugins for say Discourse2 Meta.

So not likely reasonable at this time to divide resources to maintain current ruby & porting.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 15, 2024, 3:15pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/7 "2024-07-15T15:15:51Z")

</div>

> [@tsk](#):
>
> It could be done in 12-16 days

Sorry is that a typo, did you mean months?

Can you point to a single project of similar size and scope to Discourse where such a port has been achieved in such a short timeframe?

---

<div class="post-metadata">

### Author: ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)
#### Post date: [July 16, 2024, 2:44am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/8 "2024-07-16T02:44:57Z")

</div>

> **[The Magpie Developer](https://blog.codinghorror.com/the-magpie-developer/)**
>
> I’ve often thought that software developers were akin to Magpies, birds notorious for stealing shiny items to decorate their complex nests. Like Magpies, software developers are unusually smart and curious creatures, almost by definition. But we are...

> I bet [the process David Megginson outlines](http://www.megginson.com/blogs/quoderat/2006/03/06/programming-languages-of-distinction/?ref=blog.codinghorror.com) sounds awfully familiar:
> 
> > 1. Elite (guru) developers notice too many riff-raff using their current programming language, and start looking for something that will distinguish them better from their mediocre colleagues.
> > 
> > 2. Elite developers take their shopping list of current annoyances and look for a new, little-known language that apparently has fewer of them.
> > 
> > 3. Elite developers start to drive the development of the new language, contributing code, writing libraries, etc., then evangelize the new language. Sub-elite (senior) developers follow the elite developers to the new language, creating a market for books, training, etc., and also accelerating the development and testing of the language.
> > 
> > 4. Sub-elite developers, who have huge influence (elite developers tend to work in isolation on research projects rather than on production development teams), begin pushing for the new language in the workplace.
> > 
> > 5. The huge mass of regular developers realize that they have to start buying books and taking courses to learn a new language.
> > 
> > 6. Elite developers notice too many riff-raff using their current programming language, and start looking for something that will distinguish them better from their mediocre colleagues.

> **Who cares what technology you use** , as long as it _works_, and both you and your users are happy with it?
> 
> That’s the beauty of new things: there’s always a new one coming along. Don’t let the pursuit of new, shiny things accidentally become your goal. Avoid becoming a magpie developer. Be selective in your pursuit of the shiny and new, and you may find yourself a better developer for it.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [July 16, 2024, 2:52am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/9 "2024-07-16T02:52:22Z")

</div>

Wow. Hope you were just being humorous.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [July 16, 2024, 3:05am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/10 "2024-07-16T03:05:13Z")

</div>

Could always ask here, they might know 😁

> **[The Rust Programming Language Forum](https://users.rust-lang.org/)**
>
> General discussion of The Rust Programming Language

---

<div class="post-metadata">

### Author: ![tsk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tsk/32/101313_2.png) [@tsk](https://meta.discourse.org/u/tsk)
#### Post date: [July 17, 2024, 4:30am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/11 "2024-07-17T04:30:04Z")

</div>

No, why do you say that?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [July 17, 2024, 7:52am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/12 "2024-07-17T07:52:01Z")

</div>

Perhaps because Rust enthusiasts are using Discourse? Or maybe if porting would take only two workingdays they would already done it, just for sport and fun?

---

<div class="post-metadata">

### Author: ![Crius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crius/32/317214_2.png) [@Crius](https://meta.discourse.org/u/Crius)
#### Post date: [July 17, 2024, 8:06am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/13 "2024-07-17T08:06:53Z")

</div>

I am so stunned by this thread that I won’t need my daily medication today ❤

---

<div class="post-metadata">

### Author: ![LWinterberg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lwinterberg/32/361644_2.png) [@LWinterberg](https://meta.discourse.org/u/LWinterberg)
#### Post date: [July 17, 2024, 9:54am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/14 "2024-07-17T09:54:47Z")

</div>

> [@tsk](#):
>
> Would memory safety greatly benefit the platform?

Discourse _is_ memory-safe. Ruby is a memory safe language; all garbage collected languages are. The main difference to Rust in this regard is when the safety checks are performed; Rust does them at compile time, Ruby does them at runtime.

> [@tsk](#):
>
> I also think the never ending discourse bugs could be reduced with Rust.

Rust tackles only a few classes of errors, mainly those caused by C++'s lack of garbage collection. It certainly is _cool_ that they found a way to do that while maintaining the performance benefits _theoretically_ possible with pointers, but it by no means prevents the sort of bugs you’d see as a user. For example, if I use `<` when I meant `<=`, and get an off-by-one error as a result, Rust won’t save me. If I forget to spawn a success message after an action is complete, Rust won’t save me.

What actually does prevent bugs is the sort of test-driven development Discourse _already_ deploys. There are very few projects which you can just deploy straight from master and expect them to be stable, but Discourse is one of them.

> [@tsk](#):
>
> Will discourse as a modern platform survive without being rewritten in Rust?

“modern platforms” are popping up left, right and center using JavaScript for backend and frontend. Ruby is 2 places behind Rust in popularity (Kotlin is between the two), so it’s hardly a rare language at the moment. Sure, in another 10 years things may look differently, but even a rewrite to Rust would be tech debt in 10 years.

> [@tsk](#):
>
> It could be done in 12-16 days with some blood sweat and tears

It’s hard to convey just how naive that statement is, which is why everyone is laughing at the idea. I’ve seen my devs refactor code for 3 years now, and they’re only just ready to start porting from wxWidgets/ShuttleGUI to Qt/QML - which, for context, is a migration from C++ to C++, just a different UI toolkit. It’s just _hard_ to transform code while also ensuring that the behavior stays identical. 12-16 days is the time you’d need just for planning before anyone gets started probably.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 17, 2024, 11:32am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/15 "2024-07-17T11:32:03Z")

</div>

I may not be the most productive developer but it took me 3 weeks just to migrate the Poll plugin to Glimmer Components 😅 (which isn’t even a language change!)

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [July 17, 2024, 1:46pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/16 "2024-07-17T13:46:44Z")

</div>

> [@tsk](#):
>
> Will discourse as a modern platform survive without being rewritten in Rust?

I don’t know about Rust or Ruby but I feel that over the last year the team at CDCK did an amazing job with the frontend rewrite to Ember 5 and Glimmer components. It actually went together with a re-build of the frontend with standardized components and styles. I’m impressed about the coordinated effort and purpose that was put behind this 💪

So to me they made a great decision about what to modernize because it made a huge difference in keeping Discourse modern and a joy to use!

---

<div class="post-metadata">

### Author: ![mk0r](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mk0r](https://meta.discourse.org/u/mk0r)
#### Post date: [July 21, 2024, 6:18am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/17 "2024-07-21T06:18:06Z")

</div>

> [@manuel](#):
>
> It actually went together with a re-build of the frontend with standardized components and styles.

Manuel, with respect to styles (CSS), is this documented anywhere? What do you consider as the main changes? Do you feel the structure of discourse CSS code is less easier to work with now ?

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [July 21, 2024, 8:31am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/18 "2024-07-21T08:31:27Z")

</div>

With respect to styles the main changes I see are that

- a consistent naming convention is applied using [BEM](https://getbem.com/)
- there’s ever more [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) that are applied consistently

To me this makes customizing Discourse so much easier and accurate. But I guess it depends on your working knowledge. I could imagine there’s a steeper learning curve now for folks that just want to make some adjustments and are not that familiar with CSS.

About documentation, you can check out the [Styleguide](https://meta.discourse.org/styleguide) and I guess the easiest way to scan which custom properties are available is using the dev tools of your browser. #Documentation is also being re-worked. Right now there’s two sections in #Documentation > Developer Guides, _Themes & Components_ and _Interface_. But there’s a huge range between just wanting to declare some custom styles and authoring a component. Some of this is probably buried too deep between developer topics? 🤖

---

<div class="post-metadata">

### Author: ![wal](https://avatars.discourse-cdn.com/v4/letter/w/d6d6ee/32.png) [@wal](https://meta.discourse.org/u/wal)
#### Post date: [July 23, 2024, 3:49am UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/19 "2024-07-23T03:49:24Z")

</div>

if you are going to port it to another language, I expect Go might be a better option. One of the advantages that I expect web admins might appreciate is the lack of rebuilds, since it ships static binaries. That also makes containers mostly unnecessary as well. In fact one feature that appears to be sorely needed with Discourse, is the ability to `build` the app on a machine different from your web server. Right now with the minimal, cheapest VPS, it takes nearly 10 minutes to build. This would likely be a fraction of the time if I was able to build locally on my workstation then ship the final binaries over to the web server to run. Keep in mind that languages such as Go allow you to trivially cross-compile, so you could build on your M1 Mac and then deploy on an x86 web server (or even just build, ship, and deploy ARM)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 23, 2024, 1:01pm UTC](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333/20 "2024-07-23T13:01:33Z")

</div>

I suspect currently the greatest time taken during build is the front end compilation, so “Go or no” is moot wrt build time.

Neither Rust nor Go would be replacing the front end …

(PS I love Go too … )

[Next page](https://meta.discourse.org/t/why-hasnt-discourse-been-rewritten-in-rust/316333.md?page=2)
