# modrinth/code architecture

> Architecture diagram of the GitHub repository modrinth/code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/modrinth/code
- Repository: https://github.com/modrinth/code

## Overview

The Modrinth monorepo contains the website, desktop app, API, and shared libraries. For the desktop app, users manage Minecraft instances, install content, and access instance features; the frontend and native Rust layer divide that experience. The API exposes platform services, while the website is a separate product. README evidence establishes these products but not their runtime connections. The sampled API route shows OAuth-client operations using persistence and authentication; other unsampled capabilities are represented by their source directories without inferred call flows.

Main entry points: [`apps/labrinth/src/routes/v3/oauth_clients.rs`](https://github.com/modrinth/code/blob/main/apps/labrinth/src/routes/v3/oauth_clients.rs) (OAuth client routes), [`apps/app/src/main.rs`](https://github.com/modrinth/code/blob/main/apps/app/src/main.rs) (Desktop runtime), [`apps/frontend/src`](https://github.com/modrinth/code/tree/main/apps/frontend/src) (Modrinth website), [`apps/app-frontend/src`](https://github.com/modrinth/code/tree/main/apps/app-frontend/src) (App interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_website["Website"]
  node_web["Modrinth website"]
end

subgraph group_desktop["Desktop app"]
  node_app_ui["App interface"]
  node_library["Instance library"]
  node_install["Content installation"]
  node_instance["Instance features"]
  node_download["Download management"]
  node_sharing["Instance sharing"]
  node_native["Desktop runtime<br/>[main.rs]"]
  node_commands["Native commands"]
end

subgraph group_api["Platform API"]
  node_api_routes["API routes"]
  node_oauth["OAuth client routes<br/>[oauth_clients.rs]"]
  node_api_models["API models"]
  node_db[("API database")]
  node_file_host["File hosting"]
end

subgraph group_shared["Shared libraries"]
  node_app_state[("App state and services")]
  node_query_engine["Query engine<br/>[engine.rs]"]
  node_api_client["API client library<br/>[abstract-client.ts]"]
end

node_user(("Modrinth user"))

node_user -->|"uses"| node_web
node_user -->|"uses"| node_app_ui
node_user -.->|"requests services"| node_api_routes
node_native -->|"registers"| node_commands
node_oauth -->|"queries"| node_db
node_oauth -->|"uses for icons"| node_file_host
node_oauth -->|"uses models"| node_api_models

click node_web "https://github.com/modrinth/code/tree/main/apps/frontend/src"
click node_app_ui "https://github.com/modrinth/code/tree/main/apps/app-frontend/src"
click node_library "https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/library"
click node_install "https://github.com/modrinth/code/tree/main/apps/app-frontend/src/providers"
click node_instance "https://github.com/modrinth/code/tree/main/apps/app-frontend/src/pages/instance"
click node_download "https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/download-manager"
click node_sharing "https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/shared-instances"
click node_native "https://github.com/modrinth/code/blob/main/apps/app/src/main.rs"
click node_commands "https://github.com/modrinth/code/tree/main/apps/app/src/api"
click node_app_state "https://github.com/modrinth/code/tree/main/packages/app-lib/src"
click node_api_routes "https://github.com/modrinth/code/tree/main/apps/labrinth/src/routes"
click node_oauth "https://github.com/modrinth/code/blob/main/apps/labrinth/src/routes/v3/oauth_clients.rs"
click node_api_models "https://github.com/modrinth/code/tree/main/apps/labrinth/src/models"
click node_db "https://github.com/modrinth/code/tree/main/apps/labrinth/src/database"
click node_file_host "https://github.com/modrinth/code/tree/main/apps/labrinth/src/file_hosting"
click node_query_engine "https://github.com/modrinth/code/blob/main/packages/toasty/src/engine.rs"
click node_api_client "https://github.com/modrinth/code/blob/main/packages/api-client/src/core/abstract-client.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_user toneBlue
class node_app_ui,node_library,node_install,node_instance,node_download,node_sharing,node_native,node_commands toneAmber
class node_api_routes,node_oauth,node_api_models,node_db,node_file_host toneMint
class node_app_state,node_query_engine,node_api_client toneRose
```

## Components

### Website

- [Modrinth website](https://github.com/modrinth/code/tree/main/apps/frontend/src): `apps/frontend/src`

### Desktop app

- [App interface](https://github.com/modrinth/code/tree/main/apps/app-frontend/src): `apps/app-frontend/src`
- [Instance library](https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/library): `apps/app-frontend/src/components/ui/library`
- [Content installation](https://github.com/modrinth/code/tree/main/apps/app-frontend/src/providers): `apps/app-frontend/src/providers`
- [Instance features](https://github.com/modrinth/code/tree/main/apps/app-frontend/src/pages/instance): `apps/app-frontend/src/pages/instance`
- [Download management](https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/download-manager): `apps/app-frontend/src/components/ui/download-manager`
- [Instance sharing](https://github.com/modrinth/code/tree/main/apps/app-frontend/src/components/ui/shared-instances): `apps/app-frontend/src/components/ui/shared-instances`
- [Desktop runtime](https://github.com/modrinth/code/blob/main/apps/app/src/main.rs): `apps/app/src/main.rs`
- [Native commands](https://github.com/modrinth/code/tree/main/apps/app/src/api): `apps/app/src/api`

### Platform API

- [API routes](https://github.com/modrinth/code/tree/main/apps/labrinth/src/routes): `apps/labrinth/src/routes`
- [OAuth client routes](https://github.com/modrinth/code/blob/main/apps/labrinth/src/routes/v3/oauth_clients.rs): `apps/labrinth/src/routes/v3/oauth_clients.rs`
- [API models](https://github.com/modrinth/code/tree/main/apps/labrinth/src/models): `apps/labrinth/src/models`
- [API database](https://github.com/modrinth/code/tree/main/apps/labrinth/src/database): `apps/labrinth/src/database`
- [File hosting](https://github.com/modrinth/code/tree/main/apps/labrinth/src/file_hosting): `apps/labrinth/src/file_hosting`

### Shared libraries

- [App state and services](https://github.com/modrinth/code/tree/main/packages/app-lib/src): `packages/app-lib/src`
- [Query engine](https://github.com/modrinth/code/blob/main/packages/toasty/src/engine.rs): `packages/toasty/src/engine.rs`
- [API client library](https://github.com/modrinth/code/blob/main/packages/api-client/src/core/abstract-client.ts): `packages/api-client/src/core/abstract-client.ts`

### Other components

- **Modrinth user**

## Connections

- Modrinth user → Modrinth website: uses (evidence: `README.md`)
- Modrinth user → App interface: uses (evidence: `README.md`)
- Modrinth user → API routes: requests services
- Desktop runtime → Native commands: registers (evidence: `apps/app/src/main.rs`)
- OAuth client routes → API database: queries (evidence: `apps/labrinth/src/routes/v3/oauth_clients.rs`)
- OAuth client routes → File hosting: uses for icons (evidence: `apps/labrinth/src/routes/v3/oauth_clients.rs`)
- OAuth client routes → API models: uses models (evidence: `apps/labrinth/src/routes/v3/oauth_clients.rs`)
