Skip to main content

Overview

This guide covers setting up the complete Modrinth development environment, including the backend API (Labrinth) and all required services.

Prerequisites

Before you begin, ensure you have:

Services Overview

Modrinth uses several backend services: All services are defined in docker-compose.yml at the root of the repository.

Quick Start

1

Clone Repository

2

Install Dependencies

3

Start Services

This starts PostgreSQL, Redis, ClickHouse, Meilisearch, Mailpit, and Gotenberg.
4

Verify Services

Check that all services are healthy:
All services should show status “healthy”.

Service Details

PostgreSQL

Image: postgres:15-alpine
Port: 5432
Database: labrinth
User: labrinth
Password: labrinth

Accessing PostgreSQL

Database Structure

Labrinth uses SQLx migrations located in apps/labrinth/migrations/.

Redis

Image: redis:alpine
Port: 6379

Accessing Redis

Usage in Labrinth

  • Session storage
  • Rate limiting counters
  • Temporary caches
  • Background job queues

ClickHouse

Image: clickhouse/clickhouse-server
Port: 8123 (HTTP)
Database: staging_ariadne
User: default
Password: default

Accessing ClickHouse

Creating Tables

Meilisearch

Image: getmeili/meilisearch:v1.12.0
Port: 7700
Master Key: modrinth

Accessing Meilisearch

Web UI: http://localhost:7700
API Key: modrinth

Indexing Projects

Labrinth automatically indexes projects to Meilisearch on creation/update.

Mailpit (Email Testing)

Image: axllent/mailpit:v1.27
SMTP Port: 1025
Web UI Port: 8025

Viewing Emails

Open http://localhost:8025 to view all emails sent by Labrinth during development. Use cases:
  • Email verification
  • Password reset emails
  • Notification emails

Gotenberg (PDF Generation)

Image: gotenberg/gotenberg:8
Port: 13000
Used for generating PDF reports and invoices.

Running Labrinth (Backend API)

Setup

1

Navigate to Labrinth

2

Copy Environment File

This file contains pre-configured settings for local development.
3

Run Migrations

This creates all necessary database tables.
4

Start Labrinth

Or for faster compilation (debug mode):
Labrinth will be available at http://localhost:8000

Verify API is Running

Environment Variables

Key variables in .env.docker-compose:

Running Frontend Applications

Web Interface

Access at http://localhost:3000

Desktop App

The Tauri app window will open automatically.

Database Management

Resetting the Database

To start fresh:

Seeding Test Data

Create test data for development:
Or use the Labrinth API to create projects:

Backup and Restore

Backup:
Restore:

Optional Services

Delphi (Malware Scanner)

Delphi scans uploaded files for malware. It’s optional for local development.
Port: 59999

Sharded Meilisearch

For testing search with multiple Meilisearch instances:
This starts:
  • meilisearch0 on 7700
  • meilisearch1 on 7701
  • Nginx load balancer on 7710

Running Labrinth in Docker

To run Labrinth itself in Docker:
This builds and runs Labrinth in a container instead of running it locally with cargo run.

Troubleshooting

Services Won’t Start

Port Already in Use

If a port is already in use, edit docker-compose.yml to change the port mapping:
Then update DATABASE_URL in .env:

Database Connection Errors

Meilisearch Index Issues

If search isn’t working:

Slow Compilation (Rust)

Speed up Rust compilation:

Out of Disk Space

Docker can consume a lot of disk space:

Development Workflow

Typical Development Session

Hot Reloading

  • Frontend: Vite provides instant HMR
  • Backend: Rust requires manual restart after code changes
Tip: Use cargo-watch for auto-restart:

Viewing Logs

Performance Tips

PostgreSQL Tuning

For local development, you can increase performance by adjusting PostgreSQL settings:

Redis Memory Limit

ClickHouse Memory

Next Steps

Backend (Labrinth)

Learn about the Rust backend architecture

Frontend (Web)

Develop the Nuxt 3 web interface

Testing

Run tests and ensure quality

Deployment

Learn about the production deployment