thunderstore-engine
A game-agnostic Rust engine for building Thunderstore
mod managers. Extracted from
valheim-mod-manager so it can
be shared across projects.
What it provides
client: async Thunderstore API client with azstd+bincodepackage-index cache (per community), keyed by aLast-Modifiedfreshness check. UI-agnostic progress via theprogresstraits.models: the package/version data model (struct-of-arrays +lassostring interning) and the on-disk cache wire format.resolve: dependency-graph resolution over the package index.manifest: parsing of a package'smanifest.json.extract: CRC-verified, traversal-safe zip extraction primitives.ecosystem: Thunderstore's upstream ecosystem schema (games, mod loaders, install rules, and the mod-loader package registry), consumed directly so routing works for every Thunderstore game with no per-game maintenance. Ships a compressedzstdsnapshot as an offline fallback and refreshes over the network.install: schema-driven, root-relative mod install routing over the ecosystem's install rules (route-leaf matching, longest-extension precedence, recursive subroutes, all tracking methods,<Owner-Name>namespacing, and registry-based loader-pack handling) plus a recorded file manifest for exact uninstall.profile: r2modman-compatible profiles, covering directory layout, themods.ymlmodel, a per-game package cache,.r2zexport/import, and computing aLaunchPlanthat the caller spawns.steam: asks a running Steam client whether it can resolve a path, so a sandboxed Steam's silent launch failure surfaces before a launch instead of only in Steam's own console log.
The engine never resolves the absolute game directory, performs platform discovery, or launches games. Those are game-specific concerns left to the caller.
Installation
As a dependency of a Rust project:
Quick start
use ThunderstoreClient;
async
Cargo features
The HTTP/TLS backend is selectable so downstream builds can avoid a backend's build dependency. Pick exactly one:
-
rustls-tls(default): rustls with theaws-lc-rsprovider (needs a C toolchain to build). -
native-tls: links the platform's TLS stack instead:= { = "0.1", = false, = ["native-tls"] }
Refreshing the bundled ecosystem snapshot
The crate embeds a compressed snapshot of Thunderstore's ecosystem schema as an
offline fallback (assets/ecosystem-schema.json.zst); Ecosystem::fetch_latest
pulls a fresh copy at runtime. Regenerate the embedded fallback with:
|
Credits / references
- Thunderstore API: https://thunderstore.io/api/docs/
- Ecosystem schema: https://github.com/thunderstore-io/ecosystem-schema
- Install routing follows the model proven in r2modman (https://github.com/ebkr/r2modmanPlus) and Gale (https://github.com/Kesomannen/gale).
License
MIT