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:| Service | Purpose | Port |
|---|---|---|
| PostgreSQL | Primary database | 5432 |
| Redis | Cache and sessions | 6379 |
| ClickHouse | Analytics database | 8123 |
| Meilisearch | Search engine | 7700 |
| Mailpit | Email testing | 8025 (UI), 1025 (SMTP) |
| Gotenberg | PDF generation | 13000 |
| Labrinth | API server | 8000 |
docker-compose.yml at the root of the repository.
Quick Start
Service Details
PostgreSQL
Image:postgres:15-alpinePort: 5432
Database:
labrinthUser:
labrinthPassword:
labrinth
Accessing PostgreSQL
Database Structure
Labrinth uses SQLx migrations located inapps/labrinth/migrations/.
Redis
Image:redis:alpinePort: 6379
Accessing Redis
Usage in Labrinth
- Session storage
- Rate limiting counters
- Temporary caches
- Background job queues
ClickHouse
Image:clickhouse/clickhouse-serverPort: 8123 (HTTP)
Database:
staging_ariadneUser:
defaultPassword:
default
Accessing ClickHouse
Creating Tables
Meilisearch
Image:getmeili/meilisearch:v1.12.0Port: 7700
Master Key:
modrinth
Accessing Meilisearch
Web UI: http://localhost:7700API Key:
modrinth
Indexing Projects
Labrinth automatically indexes projects to Meilisearch on creation/update.Mailpit (Email Testing)
Image:axllent/mailpit:v1.27SMTP 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:8Port: 13000 Used for generating PDF reports and invoices.
Running Labrinth (Backend API)
Setup
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
Desktop App
Database Management
Resetting the Database
To start fresh:Seeding Test Data
Create test data for development:Backup and Restore
Backup:Optional Services
Delphi (Malware Scanner)
Delphi scans uploaded files for malware. It’s optional for local development.Sharded Meilisearch
For testing search with multiple Meilisearch instances:meilisearch0on 7700meilisearch1on 7701- Nginx load balancer on 7710
Running Labrinth in Docker
To run Labrinth itself in Docker:cargo run.
Troubleshooting
Services Won’t Start
Port Already in Use
If a port is already in use, editdocker-compose.yml to change the port mapping:
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
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
