Modernizing MagnetBank: From legacy bloat to a lean, Neon-Powered Monorepo

Hey everyone,

If you've been following my work for a really, really long time, you might remember MagnetBank. It was my attempt at a decentralized, non-custodial torrent metadata indexer powered by the Hive blockchain. But to be honest, it hadn't received much love in about five years.

It was scattered across three different GitLab repositories, running on an aging MongoDB instance, and the UI was... well, let's just say "standard Bootstrap" doesn't age like fine wine.

I decided it was time for a complete overhaul. Not just a fresh coat of paint, but a ground-up modernization of the entire stack.

The Consolidation: Moving to a Monorepo

The first order of business was getting organized. I merged the three separate repos—frontend, node, and tools—into a single GitHub monorepo. I used a surgical git merge --allow-unrelated-histories approach to make sure I didn't lose a single commit from the last half-decade.

Everything is now managed under a unified uv workspace. If you haven't tried uv yet for Python project management, you're missing out. It handles the venv, dependencies, and locking in a way that is blazingly fast compared to standard pip.

The Great Database Migration: Ditching MongoDB for SQLite

After five years of operation, the database was only about 20MB. Running a full MongoDB instance for that is the definition of "overkill."

I refactored the entire data layer to use SQLite with SQLAlchemy.

  • The Result: The infra is simplified, the "write-lock" overhead is gone, and the whole thing can be backed up with a single file.
  • The Breakthrough: I wrote a custom importer to move 30,751 torrents and all system settings from the legacy JSON dumps into a clean relational schema in seconds.

Speeding up the Sync: Batch Processing

The node worker needed to be "up to snuff." I rebuilt it as a robust Python class using the hive-nectar library.

The real performance win here was moving to Batch Processing. Instead of hitting the API for every single block and committing to the DB one record at a time, the node now:

  1. Requests blocks in chunks of 100 via the Hive API.
  2. Processes the operations in memory.
  3. Performs an atomic commit to SQLite at the end of the batch.

It caught up on 24 hours of missed blockchain data almost instantly.

The UI: Gussying it up in Neon

image.png

The frontend received the most visual love. I ditched the generic light mode for a Retro-Modern Neon aesthetic.

  • Dark Mode by Default: Deep charcoal backgrounds with high-contrast neon green (#39ff14) accents.
  • Glassmorphism: Blurred overlays and glowing borders to give it that "active terminal" feel.
  • Responsive Card Grid: The torrent list is now a grid of "scan cards" that are easy to browse on mobile or desktop.

I even fixed a lingering Quirks Mode issue by standardizing the HTML5 structure, ensuring the site renders correctly in modern browsers.

Better Magnet Links: The xs= Parameter

A technical detail I'm particularly happy with is the integration of is the exact_source field. This was requested by @kencode years ago😅️. If a torrent has a direct .torrent file source recorded on the blockchain, the app now dynamically appends the xs= parameter to the magnet link. This helps torrent clients verify metadata much faster.

Live in Production

The whole ecosystem: the Node worker, the Flask frontend (powered by Gunicorn), and a Caddy reverse proxy, is now live and synced at:

magnets.ecoinstats.net

GitHub Repo Here

The code is clean, the UI is sharp, and the backend is efficient.

It feels good to have this project back in top-tier shape and moving again after half a decade on the shelf.

As always,
Michael Garcia a.k.a. TheCrazyGM

0.06413880 BEE
3 comments
(edited)

Read more about the mission here.

image.png

Thanks to @thecrazygm for all his support.

0.00439842 BEE

A sleeping protocol that lives within the hive blocks that most people don't know about? It "just worked" for several years and nobody noticed? The implications are.... exciting!

!PIMP
!PIZZA
!PAKX

0.00000000 BEE

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)



Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

0.00000000 BEE

PIZZA!

$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm

Send $PIZZA tips in Discord via tip.cc!

0.00000000 BEE