Repository navigation
Architecture
TwilightMC is a thirteen-crate Rust workspace. Each crate owns one problem and is tested on its own; the CLI and the Tauri GUI are thin front ends over the same library code.
twilight launch 1.21.4
│
▼
┌────────────────────┐ failover ┌──────────────────────────┐
│ Mojang piston-meta │ ───────────▶ │ Prism → Freesm mirrors │
└─────────┬──────────┘ └──────────────────────────┘
▼
version JSON ──▶ libraries + client jar + asset index
│ (parallel, SHA-1 verified)
▼
loader overlay (Fabric / Quilt / Forge / NeoForge / …)
▼
JVM discovery → argument assembly → natives extraction
▼
process spawn → stdout/stderr streamed to the console
--dry-run stops after argument assembly and prints the exact command.
| Crate | Responsibility |
|---|---|
twilight-manifest |
Version list / version file parsing, metadata failover mirrors, per-version Java compatibility and asset-index exposure. |
twilight-downloader |
Parallel artifact downloads with SHA-1 verification and staging summaries. |
twilight-cas |
uv-style global content-addressable store with a hardlink → NTFS junction → symlink → copy cascade. Apache-2.0, self-contained, crates.io-ready (v0.1.0). |
twilight-horizon |
Clean-room native Horizon integration: release install, prepared-resource schema 7, on-demand Mojang asset store, read-once session hand-over and horizon-client launch assembly. |
twilight-runtime |
System JVM discovery (PATH + OS roots + JAVA_HOME/Windows registry), best-JVM selection, and multi-vendor Java JDK/JRE download/install (Adoptium, Mojang, Azul, Liberica, Corretto, Microsoft, GraalVM, OpenLogic) with mandatory checksum verification and zip-slip-safe extraction. |
twilight-launch |
Classpath/argument assembly, natives extraction (7-Zip CLI), asynchronous process spawner, Cleanroom BareBones gate and opt-in JDWP/Mixin debug flags. |
twilight-auth |
Offline v3 UUID profiles, Microsoft OAuth2 device flow (Xbox → XSTS → Minecraft), MSA refresh and sha256-verified authlib-injector. |
twilight-modloader |
Fabric, Quilt, Forge, NeoForge, Legacy Fabric, CleanroomMC, OrnitheMC and LiteLoader profile resolution into composite launch data. |
twilight-modrinth |
.mrpack engine: strict index parsing, env filtering, pure-Rust ZIP/DEFLATE reader (CRC-32 verified), zip-slip-safe overrides extraction, installer. |
twilight-pack |
.twpack instance format: 7z CLI-first with a pure-Rust encoder fallback and zip-slip-guarded extraction. |
twilight-server |
Server engine: nine supported softwares, artifact resolution, EULA/server.properties management, Minekube Connect/AuthMe assets and async process control. |
twilight-cli |
clap 4 command surface, isolated ArtifactStaging under <temp>/twilightmc_staging, and the end-to-end launch / modpack install pipelines. |
twilight-ui |
Tauri v2 desktop launcher and server manager (Svelte 5 + Tailwind v4) bridging the backend crates over IPC. |
The twilight-cas store is the reason instances can share a library tree
without copying it. A blob is ingested once into a global SHA-1 store, then
linked into each instance using the first mechanism the filesystem supports:
hardlink → NTFS junction → symlink → copy
That order matters on Windows: hardlinks work on the same volume without admin
rights, junctions cover directory-shaped artifacts, and the copy fallback keeps
network shares and unusual filesystems working. libraries/, assets/ and
mods are all linked through the same store.
cargo test --workspaceThe suite is hermetic by construction:
- version JSON fixtures are inline strings;
- DEFLATE fixtures are committed hex blobs;
- every network path runs against a one-request-per-connection loopback HTTP server;
- platform-specific tests are
#[cfg]-gated (the Windowsreg queryparser only runs on Windows, the POSIXbin/javascan only off it).
CI builds the union across the matrix, so a Linux-only test still runs on the Linux runners and a Windows-only parser still runs on Windows.
upstream/ vendors Prism, Freesm, Modrinth code and Horizon as reference
material only. Nothing in it is compiled, linked or copied into TwilightMC.
The Rust code is an independent implementation shaped by studying how those
launchers solve the same problems. Only twilight-horizon reads the upstream
Horizon tree, and only as a read-only integration reference.
No Mojang assets (textures, audio, language files, client.jar) are committed
or bundled. Assets are downloaded from Mojang's CDN at launch time and stored
locally.
The workspace uses one shared release pipeline
(.github/workflows/_build.yml)
called by four thin channel workflows. See Release channels for
the tag rules and Building from source for the local commands.
TwilightMC is free software under AGPL-3.0-or-later · Report a bug · Releases · Discord
Start here
Using it
Under the hood
Project