Overview
The Modrinth web interface is built with Nuxt 3, providing a server-side rendered (SSR) web application for browsing and managing Minecraft mods and modpacks. Location:apps/frontend/Framework: Nuxt 3
UI Library: Vue 3 + Tailwind CSS v3
Deployment: Cloudflare Pages
Architecture
Nuxt 3 with SSR
The frontend uses Nuxt 3’s hybrid rendering:- Server-Side Rendering (SSR): Pages are rendered on the server for SEO and initial load performance
- Client-Side Hydration: Vue takes over for interactivity after initial render
- SPA Navigation: Subsequent navigation is client-side for speed
Data Fetching Flow
Directory Structure
File-Based Routing
Nuxt uses thepages/ directory for automatic routing:
Dynamic Routes
pages/[type]/[id].vue
Components
Website-Specific vs Shared
Website-specific components (src/components/):
- Admin panels
- Moderation tools
- Dashboard widgets
- Brand-specific components
- Anything that depends on Nuxt APIs
packages/ui/src/components/):
- Buttons, inputs, modals
- Project cards
- Version lists
- Anything reusable across web and app
Rule of thumb: If it doesn’t depend on Nuxt-specific APIs or website-only features, it belongs in
packages/ui.Component Example
src/components/project/ProjectGallery.vue
Data Fetching
API Client
Use@modrinth/api-client via injectModrinthClient() for all API calls:
src/app.vue:
src/app.vue
TanStack Query
Use TanStack Query (@tanstack/vue-query) for server state management:
tanstack-query skill (.claude/skills/tanstack-query/SKILL.md) for patterns and conventions.
Deprecated Composables
State Management
Pinia Stores
Client-side state is managed with Pinia:store/auth.ts
Server State (TanStack Query)
For data from the API, always use TanStack Query instead of Pinia.Styling
Tailwind CSS
All styling uses Tailwind CSS with semantic color variables.Surface Colors (Backgrounds)
Usesurface-* variables for backgrounds:
Text Colors
Brand Colors
Example
Scoped Styles
Use scoped styles for component-specific CSS:Layouts
Layouts wrap pages with common UI elements:layouts/default.vue
pages/index.vue
Middleware
Route guards run before navigation:middleware/auth.ts
pages/dashboard/index.vue
i18n (Internationalization)
The frontend supports 34 languages using FormatJS. Translations:packages/ui/src/locales/
Dependency Injection
Services are provided via Vue’s provide/inject using thecreateContext pattern:
dependency-injection skill (.claude/skills/dependency-injection/SKILL.md) for details.
Development
Running Locally
http://localhost:3000
Hot Module Replacement
Vite provides instant HMR for:- Vue components
- CSS/Tailwind
- TypeScript/JavaScript
Environment Variables
.env.local
Building
Development Build
Production Build (Cloudflare Pages)
Pre-PR Checks
Before opening a PR:Common Patterns
Loading States
Error Handling
Infinite Scrolling
Testing
Component Testing
Tests are located alongside components:src/components/ProjectCard.test.ts
Run Tests
Next Steps
Desktop App
Learn about the Tauri desktop application
Packages
Explore shared packages and libraries
Local Setup
Set up the complete development environment
Testing
Testing strategies and best practices
