A node.js library to install and launch minecraft with or without modloaders.
Find a file
2026-05-23 11:04:07 +02:00
src fiix: typo 2026-05-23 11:04:07 +02:00
tests fix: modrinth tests not finding nlk 2026-04-23 18:21:30 +02:00
.editorconfig chore: init 2025-09-28 13:12:46 +02:00
.gitignore fix: fix tests being not runnable 2026-04-23 18:13:19 +02:00
eslint.config.js fix: fix eslint not actually working and fixed every ts/eslint warnings 2026-03-06 14:54:23 +01:00
LICENCE chore: init 2025-09-28 13:12:46 +02:00
package.json build: update every dependencies 2026-03-17 21:52:17 +01:00
pnpm-lock.yaml build: update every dependencies 2026-03-17 21:52:17 +01:00
pnpm-workspace.yaml chore: init 2025-09-28 13:12:46 +02:00
README.md feat: add an example in readme 2026-05-23 10:38:12 +02:00
shell.nix build: make use of only one nix shell with both java 8 and 21 in env 2026-03-26 19:22:58 +01:00
tsconfig.json fix: fix eslint not actually working and fixed every ts/eslint warnings 2026-03-06 14:54:23 +01:00
tsup.config.js fix: fix dynamic require of fs is not supported with adm-zip 2025-11-19 11:54:06 +01:00
vitest.config.ts fix: fix tests being not runnable 2026-04-23 18:13:19 +02:00

node-launcher-kit

A node.js library to install and launch minecraft with or without modloaders.

Example

You can use this code to install and launch minecraft 1.21.11 with offline auth. This will also automatically download fitting java binaries.

const gameRoot = path.join(import.meta.dirname, "mc");

// install the correct java version for 1.21.11
const javaManager = new RuntimeManager(path.join(gameRoot, "java"));
javaManager.on("progress", console.log) // show progress in logs
const java = await javaManager.use(await getJavaComponent("1.21.11"))

// instance's config
const instance = new Instance({
  version: "1.21.11",
  auth: offlineAuth("player"),
  paths: {
    // root is a shared folder by all instances for common game files. reusing the same root makes install faster.
    root: gameRoot,
    // instance is where saves, mods and configs are stored, it is per instance.
    instance: path.join(gameRoot, "instances", "1.21.11")
  },
  javaExecutable: java
});

// show progress and debug info
instance.on("progress", console.log);
instance.on("log", (step, msg) => {
  console.log(`[${step}] ${msg}`)
})

// install the game
await instance.install();

// launch the game, if instance.install already runned once before, you can run instance.launch with the same instance's config without rerunning install.
const p = await instance.launch();

// show minecraft's logs
p.stdout.on("data", (d: Buffer) => {
  console.log(d.toString());
});
p.stderr.on("data", (d: Buffer) => {
  console.log(d.toString());
});

You can look in the tests folder to see more examples showing how to use nlk with fabric, forge, neoforge, and modrinth's modpacks.