It's been a minute since my last blog update. I've been heads-down coding for a bit. Back to the updates!
Hello Rust
My atproto coding over the past year has been mostly in C#. First I wrote some client tools, and next I shifted focus to building an entire PDS. I've been running the C# PDS (dnproto) for a few months now.
A few weeks back I wondered "Could I possibly port the C# PDS to Rust, easily and quickly, using GitHub Copilot?"
I started by defining a set of 12-15 scenarios that the existing C# project supports. I ordered the scenarios by ease of implementation, and also dependencies (later scenarios might rely on earlier scenarios).
Then I tackled each scenario, one-by-one, in order. I used GitHub Copilot within VS Code, with Claude Opus 4.5 as the model.
It turned out better than I expected. I ported 24,000 lines of atproto code from C# to Rust in 3 days. All tests are passing, and the Rust code uses half the physical resident memory. The Rust codebase is now my primary codebase, and the Rust PDS is where my account is hosted.
Along the way I learned a few things about porting code using LLMs:
Choose small, focused scenarios. Define sizable "chunks" to port. If a scenario is too large, the model might struggle with it.
Review everything. Keep an eye out for things like "TODO: implement later" or code duplication. Make sure to guide the porting process during every step of the way.
Logging is essential. One way to compare feature parity is to compare the logs from both systems. The better the logs, the better chance of catching porting errors.
Keep existing code structure. Copilot seems to perform well when you say "keep the existing structure and port 1:1."
You can find the Rust PDS here -> rustproto.
Ten Steps to a PDS
While going through the Rust port, I jotted down a set of notes about how to implement a PDS from scratch. You can find those notes here:
These steps are approximately the path I took while building a PDS over the past year in C#.
New Blog Name
Since I'm trying out different programming languages, the name "dnproto" (dotnet proto) feels out-of-date. From now on I'll use a more general publication on Leaflet.
Have a great week!