My starting point was searching for tutorials and asking ChatGPT to implement a torrent parser :) There are great blog posts [0] for building a BitTorrent client. Along the way, I referenced open-source implementations and the BitTorrent Protocol Specification as well [1].
[0] https://blog.jse.li/posts/torrent/
[1] https://www.bittorrent.org/beps/bep_0003.html