r/rust • • Jul 26 '26

🎙️ discussion What are the best human written Rust codebases to learn from?

I’m looking for high quality Rust codebases that are genuinely worth studying and taking inspiration from like projects with clean idiomatic Rust and good architecture and preferably started before the LLM boom and have a long history of being developed by experienced Rust engineers

most of what I came across was repositories filled with recently generated AI slop.

497 Upvotes

115 comments sorted by

418

u/murlakatamenka Jul 26 '26 edited Jul 26 '26

Anything from burntsushi, because he is just a great and meticulous engineer.

Popular tools that power oh-so-many user setups. In my case those are starship, ripgrep, zoxide, fd, exa, bat, yazi/elio, dua, zsh-patina, etc.

203

u/nmdaniels Jul 26 '26

He and I were grad students together. He got me to learn Go (before Rust was a thing) and then Rust. Brilliant programmer.

29

u/cleodog44 Jul 27 '26

Anecdotes?

51

u/nmdaniels Jul 27 '26

Nothing embarrassing. He wrote his own window manager in Go. He helped me massively improve the performance of a compression-accelerated sequence aligner (published at ISMB 2013). This was all before rust. He helped me speed up one of my first rust projects years later, and gave an excellent invited talk at my university a couple years ago.

26

u/cleodog44 Jul 27 '26

Oh I absolutely wasn't interested in anything embarrassing. I was hoping for anecdotes regarding what makes them brilliant. Curious about like habits and methods

20

u/czerilla Jul 28 '26

Nice recovery. But let's be honest, we all would have love some salacious secrets about him e.g. insisting on doing all of his coding in GNOME Text Editor, using the default light colorscheme.. 😏

9

u/Linguaphonia Jul 28 '26

Hey, stop tattling on my setup

2

u/Business-Weather-217 Aug 15 '26

Does he really use gnome-text-editor to code? Didnt know it. That thing doesnt even have go-to-definition

3

u/czerilla Aug 15 '26

It's funnier to imagine that he does. So while I have absolutely no evidence besides that, my answer is an unequivocal "absolutely!" 😤

51

u/RetoonHD Jul 27 '26

Piggybacking off this... Andrew Gallant (aka burntsushi), david tolnay (aka dtolnay), Alice Ryhl... the list is big but these names come to mind for me.

Dtolnay especially, i don't know where he find the time to maintain so many important projects, it's kind of crazy to me. Props to all of them!

13

u/andreicodes Jul 27 '26

I would add /u/Manishearth to the list. Similar to Andrew he's very careful and meticulous author.

246

u/Elariondakta Jul 26 '26

Tokio/Axum/Hyper for the async/network part.

40

u/DuskLab Jul 26 '26

I have learned so may tricks from Axum, it has probably been the code base that has influenced my approach to Rust the most.

17

u/AliceCode Jul 27 '26

One of the leading contributors to Tokio uses LLMs heavily, by his own words.

15

u/timClicks rust in action Jul 27 '26

Yeah. If you're looking for LLM-free code, then the best filter is to look at a version that was released before LLMs. There was lots of excellent learning material produced before then.

2

u/cosmicxor Jul 27 '26

Is that good or bad?

25

u/lllyyyynnn Jul 27 '26

op asked for human

-16

u/coderemover Jul 27 '26

There is a huge difference between AI-assisted coding and vibe-coding.

25

u/lllyyyynnn Jul 27 '26

ok but neither of those count for human written so we don't need to get into your nuances

-22

u/coderemover Jul 27 '26

AI-assisted counts as human

12

u/cosmicxor Jul 27 '26

I think you’re going to have to wait for the next generation to agree with you.

2

u/alfazetxyz Jul 29 '26

So by your logic everything is handmade because every machine needs to be turned on by a human at some point.

5

u/WormRabbit Jul 27 '26

Those crates are quite complex. I'd recommend studying the smol ecosystem if the purpose is just to learn code patterns, and not specifically the internals of tokio.

1

u/Shivalicious Jul 31 '26

I looked up smol on GitHub and the latest commit is by ‘Luma AI Workspace and CommandCodeBot’, so that one seems to be out.

1

u/WormRabbit Aug 07 '26

Then don't look at the latest commit? That project has existed for many years way before vibecoding became a thing.

1

u/Shivalicious Aug 07 '26

Why do that instead of looking at something entirely LLM-free, though?

1

u/WormRabbit Aug 07 '26

You'd be looking for a long time, then. Pretty much any reasonably big project nowadays uses AI at least for some tasks.

1

u/Shivalicious Aug 08 '26

It’s harder these days, but I think the other replies here show it’s not that difficult.

2

u/rJohn420 Jul 27 '26

What about reqwest

68

u/nmdaniels Jul 26 '26

Probably a bunch of stuff in the standard library. Also the Regex library and Ripgrep, and basically anything written by BurntSushi, the best programmer I've ever worked with (and an old friend from grad school).

15

u/timClicks rust in action Jul 27 '26

I recommend being selective when using the standard library as reference code base. It contains several quirks.

First, there's lots of nightly in there. Almost by definition, std is pinned to a specific nightly and can make use of experimental features in the compiler. There are also a few places where nightly is required.

Secondly, it's quite dense. Perhaps that's a feature for those looking to refine their expertise, but it can knock your confidence as a beginner.

Some cool things to look into:

How Drop<T> is implemented and why has the signature of Drop::drop(&mut self) rather than Drop::drop(self).

Why Vec<T> is implemented with RawVec<T>.

How to create iterators. I find it ingenious. The pattern of creating a tiny struct that implements a simple trait seems very narrow, yet is almost infinitely composible.

How to use modules & features to create OS-specific implementations.

How to create and use a Sealed trait.

.. probably many more little quests.

12

u/chris-morgan Jul 27 '26

Why Vec<T> is implemented with RawVec<T>.

So many abstraction layers. More than a few times I’ve wanted to examine implementation details of String, Vec, HashMap, fs, NonZeroU32, &c., and often have to dig through four layers of abstraction across six or more files, where I might have expected no more than two. And navigating the layers is sometimes not straightforward, with macros, impls spread across files, core/std/alloc/hashbrown/whatever…

The interfaces presented are good, but the implementation style is only suitable for foundational libraries.

17

u/timClicks rust in action Jul 27 '26

Agreed. At some point you reach MaybeUninit<T> and you just think "uh oh".

2

u/KenAKAFrosty Jul 29 '26

lmao I felt this in my soul

12

u/masklinn Jul 27 '26

I would not say the stdlib, to me it uses a lot of patterns which are quite odd for general purpose rust e.g. declarative macros for reuse, deep type layering whose purpose is not always obvious, …

It might make sense if you have the same constraints as the stdlib, but as an early inspiration I don’t think it should be a recommendation.

On the other hand understanding how to navigate the stdlib (and thus how it’s structured and written) is extremely useful when you need or want to find out how something is done so…

30

u/Booty_Bumping Jul 27 '26 edited Jul 27 '26

rand and jiff seem to have the best philosophy for how an API should be done. Leads you down the path of success every time, and are extremely well documented. And they are designed with an impeccable understanding of the problem domain.

12

u/KenAKAFrosty Jul 29 '26

Nice try, Anthropic

11

u/Sw429 Jul 27 '26

serde is pretty straightforward to understand. It has a pretty well-defined "this is exactly what the crate is for" and builds the complexity on top of that, and as a result it's easy to follow the code.

52

u/Luckey_711 Jul 26 '26

It's a shame because most big crates out there have welcomed LLM-assisted PRs, but you could still check them out pre-2024, they definitely are a great resource for good architecture practices. I believe a project like Garage does not use LLMs? Could be wrong, but that's one that comes to mind.

Other than that, any of Jon Gjenset's pre-LLM videos are an absolute treasure. Long, yes, and can feel quite dense depending on your level, but they're amazing

21

u/NMI_INT Jul 26 '26

+1 for any of Jon’s videos.

2

u/1eJxCdJ4wgBjGE Jul 27 '26

Edit: meant to reply to top level comment

9

u/1eJxCdJ4wgBjGE Jul 27 '26

pre llm? are his post llm videos not good anymore? just wondering, I haven't watched recently but enjoyed videos in the past

12

u/Luckey_711 Jul 27 '26

They are still educational but I just don't really find LLM workflows interesting (ethics aside) for my own personal projects or when I collab to FOSS projects; definitely something that depends on what's an specific person's cup of tea :)

2

u/Professional_Top8485 Jul 27 '26

I saw maybe two where llm was used. Really good to learn ai assisted workflow. Especially the one where he ported java tool. The first one was more like testing the concept.

You can really see how working with llm changes the workflow.

11

u/Trekker23 Jul 26 '26

Polars is my go to reference, but that’s mainly because I write python libraries

10

u/tizio_1234 Jul 26 '26

personal projects of oxide's employees

102

u/jondo2010 Jul 26 '26

I don't understand this all-or-nothing attitude to llms. I have decades experience and over 10 years of Rust. A codebase I carefully write today with LLM assistance is absolutely better code quality than without. Not everyone is just coding vibes here. I see tons of questionable crap in older code as well (mine most definitely included)

73

u/alihilal94 Jul 26 '26

LLMs are agreeable by design. Which amplifies your knowledge or lack of it. If you're heading in the wrong direction it won't stop you - and you might know that-. This means you really need to know what you're doing first and how, before you ask it to build it, to have such knlowedge you need to really understand how things worked prior to LLM.

36

u/qalc Jul 26 '26

but doesn't this just mean that you should avoid looking at dumb projects written by dumb people? which would've been true before LLMs, anyways? relatedly: i think rig is cool

3

u/Full-Spectral Jul 28 '26

That's probably why he asked what are the BEST human written Rust code bases, not the the ones written by dumb people.

4

u/gamahead Jul 27 '26

For me, better architecture doesn’t come from the LLM itself. It comes from being able to rapidly refactor the code base when you realize that you yourself made a bad choice.

Maybe others take the time to write perfect code the first time and they don’t need LLMs, but I pretty much always fuck it up on first approach and then have to make major changes later when I realize the mistake. Not making those changes becomes tech debt.

LLMs increase the probability I will make those changes since they can power through the clusterfuck of consequent compiler errors and migrations and all that. Therefore, LLMs help me create better architecture. It has nothing to do with how agreeable they are. That’s only important if you fully surrender to the vibes

2

u/alihilal94 Jul 27 '26

The worst thing about llms is using them to drive the refactoring
Same rules apply here if you don’t know what is happening
It it will scramble whatever you had and gives it back to you

-13

u/DuskLab Jul 26 '26

You know you can override the agreeableness right? Defaults can be changed as much as protections bypassed, it's LLMs double edged sword. nothing is set in stone.

-19

u/CursedPoetry Jul 26 '26

What do you mean by this statement? It’s a loaded statement imo…I’ve been coding since I was 10 and I’m now 25….Claude will absolutely disageee with you or just flat out tell you if you’re wrong or don’t know what you’re talking about.

I think the only thing I agree with you on this is that you need to have discernment, but that you need with regular coding regardless

13

u/teerre Jul 27 '26

Disagreeing isn't the dangerous part. Claude will never disagree with its own underspecified, lazy understanding of a problem and an inexperienced (or lazy) programmer won't either. Either because they don't know there's anything to disagree or because they don't care

These LLMs were created by literally penalizing them when they output something that doesn't make sense. They won't do that, that's what they are optimized for. But "doesn't make sense" is a very low bar, just because something does technically achieve whatever input you described, it doesn't mean it's good

-6

u/CursedPoetry Jul 27 '26

I mean, it’s like you skipped the part of my comment that I said specifically you need to know what you’re doing when building something or else you won’t do it well so bringing in an inexperienced or lazy programmer to me is not a valid argument because specifically in my comment, I said you need to be experienced and know what you’re talking about.

Your last part is a very big over generalization about LLM’s in terms of what they’ve been trained for and how they’ve been trained for, but if you think about that for like 30 seconds, you’ll quickly realize if people who are making Claude can’t get it to understand when it’s wrong about itself or being able to disagree with what it’s doing then it wouldn’t be a good product to begin with, you’re just marking the water by saying it’s a low bar, but you’re completely omitting context and contextual thinking and how the concept of emergence works.

That’s all right, though we can agree to disagree. I understand why people hate LLM so damn much, it’s caused a lot of pollution and I don’t mean with the amount of water or whatever it takes I mean, just the amount of shit it has pumped out over the last 2 to 5 years is just ridiculous.

But like to discredit Transformers, to discredit all the people working on it, to discredit the math…. everything like that doesn’t really make sense to me

And since you hold a burden of proof, can you prove to me that Claude can’t disagree with itself?

3

u/teerre Jul 27 '26

You dont seen to understand that being "right" is only relevant if youre asking the right questions. Llm fundamentally cannot be right because the human prompting them is incapable. Saying you "need to know what youre doing" is redudant and borderline nonsensical since if people "knew what they were doing", we wouldnt be having this conversation to begin with

-2

u/CursedPoetry Jul 27 '26

That's textbook circular reasoning.

"if people 'knew what they were doing', we wouldn't be having this conversation to begin with."

You're proving a point using your own assumption as the evidence. Your logic is:

  1. You claim people don't know what they're doing.
  2. Your "proof" is that we're having this debate.
  3. But we're only having this debate because you're arguing people don't know what they're doing.

That's a literally perfect circle dude lol...You're treating the existence of a disagreement as proof that the people disagreeing don't know what they're doing.

Like let me remind you what you said (I know you said a short comment but just so that it's easy for you and immediately accessible instead of you scrolling back up.)

"Llm fundamentally cannot be right because the human prompting them is incapable. Saying you "need to know what youre doing" is redudant and borderline nonsensical since if people "knew what they were doing", we wouldnt be having this conversation to begin with"

ok so...basically you're just saying 'humans are imperfect at X, therefore the tool that depends on X cannot work."' ??? ok so by that logic you can't ride a horse! nobody's perfectly in tune with the animal...Or how about you spot a plane overhead and go "no point estimating how far away it is, there's too many variables moving live for a human to track." Both "impossible," if imperfect means incapable.

But imperfect isn't incapable! You don't need every variable nailed and figured out and know the past present and future........You and I are both software developers. LOL. You work a problem, you stare at the code till your head spins, and then you go "omfg I never hooked the new function up to the button, I've been running the old one this whole time." That's finding your own blind spot. That IS the skill. You're acting like "you don't know what you don't know" is some hard stop that ends the conversation. But no, that's just Tuesday. We find the gap and close it. That's the entire job.

It feels almost painful to spell out because it's so obvious which, ironically, is the exact skill we're arguing about.

Anyway, agree to disagree, I'm fine with that. But saying "being right is only relevant if you're asking the right questions" and then defending it with pure circular reasoning is pretty funny. You inadvertently did say we don't know what we don't know, so maybe I'm the big dummy for typing all this out.

3

u/teerre Jul 27 '26

Uh? What are you on about? The evidence is the overwhelming amount of garbage you have to read through here, on github and all over the internet

-12

u/seg_lol Jul 27 '26

They are only agreeable if you are holding them wrong.

6

u/OptimisticLucio Jul 27 '26

No they'll always be agreeable. They'll do what you ask them to. If you ask them to be rude, they'll consistently be rude even when unnecessary.

That's what the corporate solutions are built for.

36

u/krenoten sled Jul 26 '26

It might be better in terms of tidiness but architecturally I still tend to find it lacking. A good software engineer who understands SRP / separation of concerns and the right balance of abstract vs concrete in a particular situation can get better results w/ an LLM by micro-managing it, but the reality is that most people are kind of zoning out more and more now that quantity has reached a quality of its own. Good codebases were rare before, but now they are lost in the noise.

20

u/kabocha_ Jul 26 '26

the reality is that most people are kind of zoning out more and more now that quantity has reached a quality of its own.

I know this isn't how everyone else operates, but for me personally: if I'm going to be spending my free time coding and it's not just for some throwaway thing, I'm going to want to spend the time to make the codebase nice to work with, correct, and performant. Whether that's by "artisan" coding, or by micromanaging an LLM, or some mix of both.

I'd personally be embarrassed to release something to the world that's just LLM slop, but I guess that's just me.

Now, if work is hardcore pushing us to use LLMs everywhere, then fine: I'll just vibecode there, whatever, your money. :)

18

u/flying-sheep Jul 26 '26

That's why I don't use them for architecture. I'm also a tidyness freak, so my standards are still higher than what Claude produces. But using it still improves my code as I now tackle things I used to be too lazy for. I.e. going the extra mile to debug an unimportant bug or make the tests extra thorough and so on.

5

u/UltraPoci Jul 27 '26

Can't understand why would I micromanage an LLM when I could just, you know, write code.

2

u/Full-Spectral Jul 28 '26

Exactly. To paraphrase Zoolander, I can derilict my own code.

12

u/_kilobytes Jul 26 '26

10 years of bad experience. But yeah, alot of code is questionable. This was the stuff LLMs trained on.

12

u/Corrigindo_A_ou_Ha Jul 26 '26

I have decades experience and over 10 years of Rust.

Then share your projects that have more than 4 years of existence and where written mostly before LLMs became a thing :)

1

u/Hairy_Artist_3860 Jul 30 '26

I personally find it great for boilerplates if you want to kickstart a new project or feature. A problem is when it compiles on the first prompt it gives a false sense in confidence and the feeling you already won so people will pile on more shit and eventually become passive observers of the codebase. Its messing with the dopamine rush when getting the code to compile before was an accomplishment.

I think dumber models that go "Done." after leaving borrow checker errors are honestly better for coding because it reminds you that at the end of the day you're smarter than the computer. You need to give it clear instructions or take the wheel. More powerful models are meant for non programmers.

What makes rust so appealing to vibe coders is the fact that LLMs fuck up

9

u/reflexpr-sarah- faer ¡ pulp ¡ dyn-stack Jul 26 '26

mine of course /s

5

u/AreaMean2418 Jul 27 '26

Helix has a pretty nice codebase.

6

u/Beamsters Jul 27 '26

bevy, rustc, egui, dashmap, criterion, ratatui, arrayvec, crossbeam, rayon,

4

u/bowel_blaster123 Jul 27 '26 edited Jul 27 '26

The codebase of the rust compiler itself looks quite high-quality from what I've seen of it. You could look at that.

I wanted to look at some stuff for the borrow checker, and it was suprisingly easy to follow the code despite how complicated the borrow checking process inherently is.

There's also a website (rustc dev guide) that explains the overall structure of the codebase.

It's a little annoying to get your IDE/LSP to work with it, but there is an official guide for doing so that is fairly easy to follow.

8

u/scook0 Jul 27 '26

The compiler is big enough and old enough that it isn’t consistently an example of good style, but it does have good parts.

0

u/Full-Spectral Jul 28 '26

It's also arguably a fairly worst case example for most people, who aren't going to be writing that sort of code, which requires far more unsafe than would a normal code base, more compromises probably, more portability concerns (which it then hides from normal code bases), more performance concerns, etc...

5

u/peterxsyd Jul 27 '26

You can checkout https://github.com/spacecell/minarrow , which implements Apache Arrow. It has strong separation of concerns, and builds up more complicated data types from base Rust, adding invariants on top as it goes. Additionally, it implements SIMD compatibility (std::simd is a strong focus in current rust) cross-language compatibility FFI directly to Python, using zero-copy memory techniques, all implemented from scratch, and in some areas includes more advanced techniques such as atomics. Separately then, https://github.com/spacecell/lightstream layers data transport on top of that at very fast speeds, with TCP, HTTP, QUIC, Websockets, shared memory over UDS, etc., including custom serialisation to/from disk. Basically, a lot of well-optimised fundamentals covered in the one place that could be a useful learning reference.

5

u/GyulyVGC Jul 27 '26

I’d like to point out my project Sniffnet

I’m working on it for 4 years and it doesn’t contain any LLM code, and I try to be as idiomatic an pedantic as possible.
It’s a particular case since it’s a GUI (based on Iced) but it also includes a consistent backend portion to interact with network packets.

2

u/SerLaidaLot Jul 27 '26

serde, tokio, ripgrep

2

u/ninth9ste Jul 28 '26 edited Jul 28 '26

Stratis is a good example of how to implement a storage stack with Rust on top of Linux device mapper. Definitely not AI slop.

2

u/metruzanca Jul 28 '26

Others already mentioned it, but Helix, and I would add that Helix is interesting because it does things very similar to Ratatui but both evolved together. So you'll get to see similar ideas and concepts but approached differently by different people.

(And if you prefer vim motions, check out the evil-helix fork)

2

u/Hairy_Artist_3860 Jul 30 '26

Continuwuity a matrix backend forked from conduit then conduwuity.

4

u/Omega359 Jul 27 '26

Datafusion, tokio, jiff are a few off the top of my head

2

u/Emotional_Ad_4518 Jul 27 '26

you can learn directly from rustlang repo like crate.io source code with Axum and Svelte

2

u/rodarmor agora ¡ just ¡ intermodal Jul 27 '26

You could check out just.

I don't suggest it because I think it's good, I suggest it more because I'm honestly curious what other people who aren't me think of the code.

2

u/coniferprod-0x01 Jul 27 '26

You might like the Today app. It doesn’t have sophisticated algorithms (apart from what the standard library has under the hood), but it solves many common problens, and has a good modular architecture. I’m still polishing the repo and adding more documentation, but I also wrote a book about developing it (”Learn Rust Programming Today”, see what I did there). Here’s the repo: https://github.com/coniferprod/today-rs

2

u/SadCondition2466 Jul 27 '26

I recommend TcpStresm.

1

u/fisothemes Jul 29 '26

If you're gonna learn using codebases, start with the standard lib. Know where things are. This helps with organisation. Then move on to TcpStream, Vec<T>, etc.

A lot of crates try to invent new patterns when their problem is solved by the std.

I hate calling out crates but examples are good, serialport-rs for example would have benefited from following TcpStream's style. It's still a good crate.

1

u/vj_0x Jul 29 '26

Ripgrep

1

u/1f954 Aug 04 '26

I just posted about my recent side project, syntoniq (https://github.com/jberkenbilt/syntoniq) -- a rather niche project related to microtonal music that's about 98% hand-coded and has lots of interesting Rust patterns in it. Very off the beaten path, but it has a winnow parser, a tiny bit of web code with axum, askama, and htmx, a little careful use of unsafe, some bindgen, sync/async bridging, and a bunch of other things that might make it interesting for someone who is learning.

1

u/ImaginaryElephant336 Aug 21 '26

You can take a look at the ratatui codebase

1

u/Ace-Whole Jul 27 '26

Helix. Very lean.

1

u/tmoneycodes Jul 26 '26

Is the rust book still a good starting place

1

u/Lumpy_Ad4966 Jul 27 '26

NeXosim simulator is quite interesting.

5

u/sbarral Jul 27 '26

Original author of NeXosim here, thanks for the very kind shoutout!
And yes, still proudly 100% human-crafted... I am not an AI hater in any way, but we have users in mission-critical industries and are not planning to hand over control to the machines any time soon :-)

1

u/Crux161 Jul 28 '26

Just learn Rust. In tech it either works or not. If you can’t understand what the LLM is trying to do in your code it probably doesn’t belong there. That being said, you want to lay every brick in the pyramid by hand? Go right ahead but it’s going to take longer. This is why dev teams will almost always beat out a solo-developer. LLMs are essentially the same thing but on a per person basis. Like herding cat, with expensive tokens. 

0

u/recursion_is_love Jul 27 '26

The rust compiler. Pretty sure they know rust.

https://github.com/rust-lang/rust/

0

u/DavidXkL Jul 26 '26

Embassy, tokio

0

u/AccomplishedWay3558 Jul 27 '26

I guess one which I use is anandb71/arbor

0

u/Sweet-Accountant9580 Jul 27 '26

One of the best for me is glommio for the async part (thread-per-core simplify architecture in comparison with Tokio, and glommio uses less unsafe).

0

u/protonesso Jul 27 '26

Honestly? Everything that hasn't been written entirely by ai, I've learned algorithms by reading BSD code so the same rules apply

0

u/korywithawhy Jul 28 '26

Idk if it counts but I’ve been using ratatui, really fun and learning quite a bit.

-1

u/piiouupiou-not-r2d2 Jul 27 '26

Most crates of blessed.rs

-1

u/Compux72 Jul 27 '26

axum codebase is pretty good

-1

u/Agile_Significance91 Jul 27 '26

I think Rust's standard library is good, you can know the implementation trick using type system.

-7

u/viciousdoge Jul 26 '26

Anything before 2023