# @xmcl/modrinth

> An implementation of modrinth API (https://docs.modrinth.com/api-spec)

Latest version **2.5.3** (published 2026-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xmcl/modrinth
pnpm add @xmcl/modrinth
yarn add @xmcl/modrinth
bun add @xmcl/modrinth
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.5.3 |
| Published | 2026-08-24 |
| First published | 2022-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.4 |
| Dependencies | 1 |
| Unpacked size | 292.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1712 |
| Author | cijhn@hotmail.com |
| Maintainers | ci010 |
| Keywords | minecraft, typescript, minecraft-launcher, nodejs, electron, modrinth |

## Links

- npm: https://www.npmjs.com/package/@xmcl/modrinth
- Repository: https://github.com/Voxelum/x-minecraft-launcher
- Homepage: https://github.com/Voxelum/minecraft-launcher-core-node#readme
- Issues: https://github.com/Voxelum/minecraft-launcher-core-node/issues
- npm.io page: https://npm.io/package/@xmcl/modrinth

## Dependencies (1)

- [undici](https://npm.io/package/undici.md) ^7.24.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.5.3 (latest) — 2026-08-24
- 2.5.2 — 2026-08-10
- 2.5.1 — 2026-07-25
- 2.5.0 — 2025-08-01
- 2.4.0 — 2025-03-28
- 2.3.2 — 2025-01-10
- 2.3.1 — 2024-01-08
- 2.3.0 — 2023-11-12
- 2.2.0 — 2023-10-22
- 2.1.0 — 2023-06-11
- 2.0.2 — 2023-04-24
- 2.0.1 — 2023-04-24
- 2.0.0 — 2023-04-13
- 1.1.0 — 2022-07-06
- 1.0.0 — 2022-04-05

## README

# Modrinth API

[![npm version](https://img.shields.io/npm/v/@xmcl/modrinth.svg)](https://www.npmjs.com/package/@xmcl/modrinth)
[![Downloads](https://img.shields.io/npm/dm/@xmcl/modrinth.svg)](https://npmjs.com/@xmcl/modrinth)
[![Install size](https://packagephobia.now.sh/badge?p=@xmcl/modrinth)](https://packagephobia.now.sh/result?p=@xmcl/modrinth)
[![npm](https://img.shields.io/npm/l/@xmcl/minecraft-launcher-core.svg)](https://github.com/voxelum/minecraft-launcher-core-node/blob/master/LICENSE)
[![Build Status](https://github.com/voxelum/minecraft-launcher-core-node/workflows/Build/badge.svg)](https://github.com/Voxelum/minecraft-launcher-core-node/actions?query=workflow%3ABuild)

Provide the modrinth described in https://docs.modrinth.com/api-spec

## Usage

This package is depending on undici for HTTP in nodejs, and the browser version will use browser `fetch` instead of undici.

### Search Project in Modrinth

You can use keyword to search

```ts
import { ModrinthV2Client, SearchResult } from '@xmcl/modrinth'
const client = new ModrinthV2Client()
const searchOptions: SearchOptions = {
    query: "shader", // searching shader
};
const result: SearchResult = await client.searchProjects(settingString);
const totalProjectCounts = result.total_hits;
for (const project of result.hits) {
    console.log(`${project.project_id} ${project.title} ${project.description}`); // print project info
}
```

### Get Project in Modrinth

You can get project detail info via project id, including the download url

```ts
import { ModrinthV2Client, ProjectVersionFile, ProjectVersion } from '@xmcl/modrinth'

const client = new ModrinthV2Client()
const projectId: string; // you can get this id from searchProjects
const project: project = await client.getProject(projectId) // project details
const versions: string[] = project.versions;
const oneVersion: string = versions[0];

const modVersion: ModVersion = await getProjectVersion(oneVersion);

const files: ProjectVersionFile[] = modVersion.files;

const { url, name, hashes } = files[0]; // now you can get file name, file hashes and download url of the file
```

---
_Source: https://npm.io/package/@xmcl/modrinth · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
