Show HN: I wrote a new BitTorrent tracker in Elixir

by dahrkaelon 6/19/2025, 10:49 PMwith 71 comments

Hello everyone!

I'm currently in a journey to learn and improve my Elixir and Go skills (my daily job uses C++) and looking through my backlog for projects to take on I decided Elixir is the perfect language to write a highly-parallel BitTorrent tracker. So I have spent my free time these last 3 months writing one! Now I think it has enough features to present it to the world (and a docker image to give it a quick try).

I know some people see trackers as relics of the past now that DHT and PEX are common but I think they still serve a purpose in today's Internet (purely talking about public trackers). That said there is not a lot going on in terms of new developments since everyone just throws opentracker in a vps a calls it a day (honorable exceptions: aquatic and torrust).

I plan to continue development for the foreseeable future and add some (optional) esoteric features along the way so if anyone currently operates a tracker please give a try and enjoy the lack of crashes.

note: only swarm_printout.ex has been vibe coded, the rest has all been written by hand.

by nesarkvechnepon 6/20/2025, 9:33 AM

I really wished to see an OTP-first design. Unfortunately for me, the code is almost procedural as it's touching ETS or Application, which is built on ETS, in nearly every operation.

If the author wishes to learn how to design services in Elixir, or any BEAM language, with OTP, they can take a look at "Designing Elixir Systems with OTP" by by James Edward Gray and Bruce Tate, and "Functional Web Development with Elixir, OTP, and Phoenix" by Lance Halvorsen.

by b0a04glon 6/20/2025, 5:10 PM

learned elixir in a week for an interview. didn’t clear it, but that week changed how i write code. understood state isolation for the first time. no shared data. fail and restart clean. pattern matching everywhere. structs over classes. pipes for everything. after that, i started writing code topdown. move sideeffects out. keep logic close to the data. elixir kinda rewired that for me.

after seeing this i saw that same mindset. not flashing any big genservers. simplified with fast procs, raw ETS tables. simple flow, but still fault aware. still clean.

by voicedYodaon 6/20/2025, 2:57 AM

Well done. Couple quick notes, move to a logger instead of using IO.puts. Also consider adding OTel.

by s-monon 6/20/2025, 2:10 AM

Love Elixir so much, building a kick-ass notification engine with it now. Its so so good.

by abrookewoodon 6/20/2025, 1:26 AM

Hey congrats on the launch! Can you provide any details on how it runs compared to opentracker? I'm really interested in the performance etc.

by quechimbaon 6/20/2025, 3:03 AM

Nice! I'll check this out some point.

I wrote a basic tracker in Elixir a few years ago, here's the code: https://github.com/aalin/mr_torrent

by arch-chooton 6/20/2025, 7:27 AM

Interesting! I'd done something similar in Typescript to learn more about BT, and then redid it in rust to learn rust (https://github.com/ckcr4lyf/kiryuu).

However I decided to just use redis as the DB. It sounds like your entire DB is in memory? Any interesting design decisions you made and/or problems faced in doing so?

(My redis solution isn't great since it does not randomize peers in subsequent announces afaik)

by TheJoeManon 6/20/2025, 1:11 PM

Could you please clarify what DHT and PEX are? I'm having trouble searching "tracker PEX".

by vivzkestrelon 6/20/2025, 3:50 AM

- how did you start - did you refer to other projects - how long did it take - how much functionality do you think works compared to say qbittorrent?

by jhggon 6/20/2025, 1:35 AM

Really cool! You looking to write Elixir as your main job?

by KomoDon 6/20/2025, 4:44 AM

I tried it, couldn't get HTTPS to work.

Also my console gets spammed with:

04:43:20.160 [warning] invalid 'event' parameter: size: 6 value: "paused"

but it seems to work. I would've liked to see HTTP stats too but I guess UDP is fine (though I have it disabled)

by andyleclairon 6/21/2025, 3:03 AM

This is really good, my dude. I took a peruse through the code and I'm definitely impressed, this is like, code I would expect my senior engineers with elixir experience to turn in. Great job!

by IlikeKittieson 6/20/2025, 12:10 AM

Now that's neat. The Beam VM sounds like a natural fit for a torrent tracker

by bavellon 6/20/2025, 1:36 AM

Very cool! Is this suitable for using as a private tracker?

by toomuchtodoon 6/20/2025, 2:07 AM

Awesome work!

by mikehostetleron 6/20/2025, 2:28 AM

really cool project! well done

by desireco42on 6/20/2025, 12:49 AM

Now this is serious business, congrats on the project! I can see how this is perfect fit for elixir...

by guywithahaton 6/20/2025, 3:02 AM

There's something about C++ developers that makes them love Go and Elixir (and I include myself in this demographic). I think it's something about the people who are attracted to C++ for performance are attracted to Go/Elixir for its multithreaded performance. Really cool project

by eatbitseverydayon 6/20/2025, 1:08 PM

Trackers are not relics - they're used exclusively in private tracker websites. Public-access torrents would more commonly use DHT and PEX for discovery.

by arthurcolleon 6/20/2025, 3:15 AM

Check out https://github.com/sergiotapia/magnetissimo it was a popular one like 7 years ago

by nayukion 6/20/2025, 5:02 AM

Similar to: https://news.ycombinator.com/item?id=44265851 "Show HN: I wrote a BitTorrent Client from scratch" [2025-06-13], https://github.com/piyushgupta53/go-torrent-client