Skip to main content

Overview

The packages/ directory contains shared libraries used across multiple applications. These packages are organized into TypeScript (frontend) and Rust (backend) libraries.

Frontend Packages (TypeScript/Vue)

@modrinth/ui

Path: packages/ui/
Description: Shared Vue component library for web and desktop app

Features

  • Vue 3 components (buttons, modals, cards, forms)
  • Cross-platform pages (used in both Nuxt and Tauri)
  • Composables and utilities
  • i18n translations (34 languages)
  • Dependency injection providers
  • Storybook component development

Structure

Usage

Color System

Use semantic color variables for theme support:
  • Surfaces: bg-surface-1 through bg-surface-5
  • Text: text-contrast, text-primary, text-secondary
  • Brand: bg-brand, text-brand
  • Semantic: bg-red, bg-green, bg-orange, bg-blue
See the Frontend Web guide for complete color usage.

Storybook

Develop components in isolation:
Access at http://localhost:6006

@modrinth/api-client

Path: packages/api-client/
Description: Platform-agnostic API client for Modrinth services

Features

  • Multi-API support (Labrinth, Archon, Kyros, ISO3166)
  • Platform variants:
    • GenericModrinthClient - Node/browser (uses ofetch)
    • NuxtModrinthClient - Nuxt SSR-aware (uses $fetch)
    • TauriModrinthClient - Tauri (uses @tauri-apps/plugin-http)
  • Feature system (auth, retry, circuit breaker)
  • XHR upload with progress tracking
  • WebSocket support for real-time events
  • Type-safe API methods

Architecture

Module Structure

Usage Example

Features (Middleware)

AuthFeature: Injects Bearer token
RetryFeature: Exponential backoff retry
CircuitBreakerFeature: Prevents cascade failures

File Uploads

@modrinth/assets

Path: packages/assets/
Description: Styling, design tokens, and auto-generated icons

Contents

  • Tailwind preset (tailwind-preset.ts)
  • CSS variables (styles/variables.scss) - theme tokens
  • SVG icons (auto-generated from icons/ directory)
  • Semantic color tokens

Adding Icons

@modrinth/utils

Path: packages/utils/
Description: Shared utility functions

@modrinth/blog

Path: packages/blog/
Description: Blog system and changelog data
  • Blog post rendering
  • Changelog parsing
  • Markdown processing

@modrinth/moderation

Path: packages/moderation/
Description: Moderation utilities and content filtering
  • Content censoring
  • Profanity detection
  • User report handling

@modrinth/tooling-config

Path: packages/tooling-config/
Description: Shared ESLint, Prettier, and TypeScript configurations
package.json

Rust Packages

theseus (app-lib)

Path: packages/app-lib/
Crate: theseus
Description: Desktop app backend library

Features

  • Profile management: Create and manage Minecraft instances
  • Mod installation: Install from Modrinth or local files
  • Game launching: Launch Minecraft with mods
  • Metadata: Minecraft, Forge, Fabric, Quilt version data
  • Java detection: Auto-detect and download Java runtimes
  • Database: SQLite for local state
  • Analytics: Track usage (opt-in)

Core APIs

See Desktop App for complete documentation.

daedalus

Path: packages/daedalus/
Description: Minecraft and mod loader metadata library

Features

  • Minecraft version manifests
  • Forge version data
  • Fabric loader and mappings
  • Quilt loader versions
  • Modpack format parsing (mrpack, CurseForge)

Usage

ariadne

Path: packages/ariadne/
Description: Analytics library for tracking usage and events

Features

  • Event tracking
  • ClickHouse integration
  • Privacy-preserving analytics
  • Opt-in/opt-out support

modrinth-log

Path: packages/modrinth-log/
Description: Logging utilities with tracing integration

modrinth-util

Path: packages/modrinth-util/
Description: General Rust utilities
  • String utilities
  • Error handling helpers
  • Type conversions

modrinth-maxmind

Path: packages/modrinth-maxmind/
Description: MaxMind GeoIP integration

muralpay

Path: packages/muralpay/
Description: Payment processing (Stripe integration)

path-util

Path: packages/path-util/
Description: Cross-platform path utilities

sqlx-tracing

Path: packages/sqlx-tracing/
Description: SQLx query tracing and logging

labrinth-derive

Path: packages/labrinth-derive/
Description: Derive macros for Labrinth models

Package Dependencies

Workspace Dependencies

Packages reference each other using workspace protocol: package.json:
Cargo.toml:

Dependency Graph

Creating a New Package

TypeScript Package

1

Create Directory

2

Initialize package.json

package.json
3

Create Source Files

src/index.ts
4

Add TypeScript Config

tsconfig.json
5

Update pnpm-workspace.yaml

Already includes packages/*, so no change needed.
6

Build and Test

Rust Package

1

Create Crate

2

Update Cargo.toml

packages/my-crate/Cargo.toml
3

Add to Workspace

Edit root Cargo.toml:
4

Implement Library

packages/my-crate/src/lib.rs
5

Use in Other Crates

Publishing

Internal Packages

Most packages are internal and not published to npm/crates.io. They’re only used within the monorepo.

Public Packages

Some packages may be published:
  • @modrinth/api-client - Public npm package
  • daedalus - May be published to crates.io
Publishing to npm:
Publishing to crates.io:

Best Practices

Package Design

  1. Single Responsibility: Each package should have a clear, focused purpose
  2. Minimal Dependencies: Avoid heavy dependencies in shared packages
  3. Platform Agnostic: Shared code should work across web and app (when possible)
  4. Type Safety: Export TypeScript types for all public APIs
  5. Documentation: Include README with usage examples

Versioning

Internal packages use workspace:* to always use the local version. Version numbers are primarily for tracking, not for dependency resolution.

Breaking Changes

When making breaking changes to a shared package:
  1. Update all consumers in the same PR
  2. Run full test suite: pnpm test
  3. Ensure all apps build: pnpm build

Testing

Test packages in isolation:

Next Steps

Frontend (Web)

See how packages are used in the web app

Desktop App

Learn about Theseus and app integration

Backend (Labrinth)

Explore Rust packages used in the backend

Code Style

Follow coding standards for packages