Overview
Thepackages/ 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-1throughbg-surface-5 - Text:
text-contrast,text-primary,text-secondary - Brand:
bg-brand,text-brand - Semantic:
bg-red,bg-green,bg-orange,bg-blue
Storybook
Develop components in isolation: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 tokenFile 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:
theseusDescription: 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
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:Dependency Graph
Creating a New Package
TypeScript Package
Rust Package
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 packagedaedalus- May be published to crates.io
Best Practices
Package Design
- Single Responsibility: Each package should have a clear, focused purpose
- Minimal Dependencies: Avoid heavy dependencies in shared packages
- Platform Agnostic: Shared code should work across web and app (when possible)
- Type Safety: Export TypeScript types for all public APIs
- Documentation: Include README with usage examples
Versioning
Internal packages useworkspace:* 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:- Update all consumers in the same PR
- Run full test suite:
pnpm test - 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
