# jmberesford/retrom architecture

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

- Interactive diagram: https://gitdiagram.com/jmberesford/retrom
- Repository: https://github.com/jmberesford/retrom

## Overview

Retrom is a self-hosted game-library service with desktop and browser clients: users scan and manage a centralized collection, then install or download games and launch them across devices, including through emulators. The graph preserves the documented library, metadata, emulator-profile, save, and in-browser-emulation capabilities. Most runtime wiring was not sampled, so edges show only README-documented relationships or directly visible calls; the backend component boundaries are based on the repository tree.

Main entry points: [`packages/grpc-service/src/lib.rs`](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/lib.rs) (gRPC services), [`packages/service/src/main.rs`](https://github.com/jmberesford/retrom/blob/main/packages/service/src/main.rs) (Service runtime), [`packages/client-web/src/main.tsx`](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/main.tsx) (Client application), [`packages/client-web/src/routeTree.gen.ts`](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/routeTree.gen.ts) (Client routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client experiences"]
  node_webapp["Client application<br/>[main.tsx]"]
  node_routes["Client routes<br/>[routeTree.gen.ts]"]
  node_gamepad["Controller mapping<br/>[maps.tsx]"]
  node_play["Browser emulation<br/>[frame.lazy.tsx]"]
  node_clientapi["Client RPC access<br/>[client.tsx]"]
end

subgraph group_library["Library management"]
  node_libraryui["Library configuration<br/>[index.tsx]"]
  node_metadata["Metadata handlers"]
  node_jobs["Background jobs<br/>[job_manager.rs]"]
  node_gameops["Game operations<br/>[games.rs]"]
end

subgraph group_server["Server runtime"]
  node_grpc["gRPC services<br/>[lib.rs]"]
  node_service["Service runtime<br/>[main.rs]"]
  node_rest["REST endpoints<br/>[lib.rs]"]
  node_database[("Library database<br/>[lib.rs]")]
  node_media["Artwork cache<br/>[mod.rs]"]
  node_directories["Server directories<br/>[retrom_dirs.rs]"]
end

subgraph group_integrations["Platform integrations"]
  node_saves["Cloud save services<br/>[service.rs]"]
  node_emulatorprofiles["Emulator profiles<br/>[mod.rs]"]
  node_installer["Desktop installer<br/>[desktop.rs]"]
  node_launcher["Game launcher<br/>[commands.rs]"]
  node_steam["Steam integration<br/>[lib.rs]"]
  node_webdav["WebDAV client<br/>[desktop.rs]"]
end

subgraph group_contracts["Shared contracts"]
  node_protocols["API definitions<br/>[game-service.proto]"]
end

node_user(("Player / admin"))

node_user -->|"uses"| node_webapp
node_webapp -->|"starts router"| node_routes
node_routes -->|"routes to"| node_play
node_user -->|"configures library"| node_libraryui
node_user -->|"manages games"| node_gameops
node_user -->|"requests metadata"| node_metadata
node_metadata -->|"schedules jobs"| node_jobs
node_user -->|"installs games"| node_installer
node_user -->|"launches games"| node_launcher
node_user -->|"configures profiles"| node_emulatorprofiles
node_user -->|"syncs saves"| node_saves
node_user -->|"plays in browser"| node_play
node_user -->|"uses controller"| node_gamepad
node_clientapi -.->|"calls remotely"| node_grpc
node_grpc -.->|"implements API"| node_protocols
node_service -.->|"hosts services"| node_grpc
node_service -.->|"hosts endpoints"| node_rest
node_grpc -.->|"persists library"| node_database
node_media -->|"uses paths"| node_directories
node_saves -->|"uses save paths"| node_directories
node_user -->|"unifies libraries"| node_steam
node_user -.->|"uses remote files"| node_webdav

click node_webapp "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/main.tsx"
click node_routes "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/routeTree.gen.ts"
click node_gamepad "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/providers/gamepad/maps.tsx"
click node_play "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/routes/play/%24gameId/_layout/frame.lazy.tsx"
click node_clientapi "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/providers/retrom-client/client.tsx"
click node_libraryui "https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/components/modals/config/server/libraries-config/index.tsx"
click node_metadata "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/library/metadata_handlers.rs"
click node_jobs "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/jobs/job_manager.rs"
click node_gameops "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/games.rs"
click node_grpc "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/lib.rs"
click node_service "https://github.com/jmberesford/retrom/blob/main/packages/service/src/main.rs"
click node_rest "https://github.com/jmberesford/retrom/blob/main/packages/rest-service/src/lib.rs"
click node_database "https://github.com/jmberesford/retrom/blob/main/packages/db/src/lib.rs"
click node_media "https://github.com/jmberesford/retrom/blob/main/packages/service-common/src/media_cache/mod.rs"
click node_directories "https://github.com/jmberesford/retrom/blob/main/packages/service-common/src/retrom_dirs.rs"
click node_saves "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/saves/v2/service.rs"
click node_emulatorprofiles "https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/emulators/mod.rs"
click node_installer "https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-installer/src/desktop.rs"
click node_launcher "https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-launcher/src/commands.rs"
click node_steam "https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-steam/src/lib.rs"
click node_webdav "https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-webdav-client/src/desktop.rs"
click node_protocols "https://github.com/jmberesford/retrom/blob/main/packages/codegen/protos/retrom/services/game-service.proto"

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_webapp,node_routes,node_gamepad,node_play,node_clientapi toneBlue
class node_libraryui,node_metadata,node_jobs,node_gameops toneAmber
class node_grpc,node_service,node_rest,node_database,node_media,node_directories toneMint
class node_saves,node_emulatorprofiles,node_installer,node_launcher,node_steam,node_webdav toneRose
class node_protocols,node_user toneIndigo
```

## Components

### Client experiences

- [Client application](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/main.tsx): `packages/client-web/src/main.tsx`
- [Client routes](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/routeTree.gen.ts): `packages/client-web/src/routeTree.gen.ts`
- [Controller mapping](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/providers/gamepad/maps.tsx): `packages/client-web/src/providers/gamepad/maps.tsx`
- [Browser emulation](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/routes/play/%24gameId/_layout/frame.lazy.tsx): `packages/client-web/src/routes/play/$gameId/_layout/frame.lazy.tsx`
- [Client RPC access](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/providers/retrom-client/client.tsx): `packages/client-web/src/providers/retrom-client/client.tsx`

### Library management

- [Library configuration](https://github.com/jmberesford/retrom/blob/main/packages/client-web/src/components/modals/config/server/libraries-config/index.tsx): `packages/client-web/src/components/modals/config/server/libraries-config/index.tsx`
- [Metadata handlers](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/library/metadata_handlers.rs): `packages/grpc-service/src/library/metadata_handlers.rs`
- [Background jobs](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/jobs/job_manager.rs): `packages/grpc-service/src/jobs/job_manager.rs`
- [Game operations](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/games.rs): `packages/grpc-service/src/games.rs`

### Server runtime

- [gRPC services](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/lib.rs): `packages/grpc-service/src/lib.rs`
- [Service runtime](https://github.com/jmberesford/retrom/blob/main/packages/service/src/main.rs): `packages/service/src/main.rs`
- [REST endpoints](https://github.com/jmberesford/retrom/blob/main/packages/rest-service/src/lib.rs): `packages/rest-service/src/lib.rs`
- [Library database](https://github.com/jmberesford/retrom/blob/main/packages/db/src/lib.rs): `packages/db/src/lib.rs`
- [Artwork cache](https://github.com/jmberesford/retrom/blob/main/packages/service-common/src/media_cache/mod.rs): `packages/service-common/src/media_cache/mod.rs`
- [Server directories](https://github.com/jmberesford/retrom/blob/main/packages/service-common/src/retrom_dirs.rs): `packages/service-common/src/retrom_dirs.rs`

### Platform integrations

- [Cloud save services](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/saves/v2/service.rs): `packages/grpc-service/src/saves/v2/service.rs`
- [Emulator profiles](https://github.com/jmberesford/retrom/blob/main/packages/grpc-service/src/emulators/mod.rs): `packages/grpc-service/src/emulators/mod.rs`
- [Desktop installer](https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-installer/src/desktop.rs): `plugins/retrom-plugin-installer/src/desktop.rs`
- [Game launcher](https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-launcher/src/commands.rs): `plugins/retrom-plugin-launcher/src/commands.rs`
- [Steam integration](https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-steam/src/lib.rs): `plugins/retrom-plugin-steam/src/lib.rs`
- [WebDAV client](https://github.com/jmberesford/retrom/blob/main/plugins/retrom-plugin-webdav-client/src/desktop.rs): `plugins/retrom-plugin-webdav-client/src/desktop.rs`

### Shared contracts

- [API definitions](https://github.com/jmberesford/retrom/blob/main/packages/codegen/protos/retrom/services/game-service.proto): `packages/codegen/protos/retrom/services/game-service.proto`

### Other components

- **Player / admin**

## Connections

- Player / admin → Client application: uses (evidence: `README.md`)
- Client application → Client routes: starts router (evidence: `packages/client-web/src/main.tsx`)
- Client routes → Browser emulation: routes to (evidence: `packages/client-web/src/routeTree.gen.ts`)
- Player / admin → Library configuration: configures library (evidence: `README.md`)
- Player / admin → Game operations: manages games (evidence: `README.md`)
- Player / admin → Metadata handlers: requests metadata (evidence: `README.md`)
- Metadata handlers → Background jobs: schedules jobs (evidence: `packages/grpc-service/src/library/metadata_handlers.rs`)
- Player / admin → Desktop installer: installs games (evidence: `README.md`)
- Player / admin → Game launcher: launches games (evidence: `README.md`)
- Player / admin → Emulator profiles: configures profiles (evidence: `README.md`)
- Player / admin → Cloud save services: syncs saves (evidence: `README.md`)
- Player / admin → Browser emulation: plays in browser (evidence: `README.md`)
- Player / admin → Controller mapping: uses controller (evidence: `README.md`)
- Client RPC access → gRPC services: calls remotely
- gRPC services → API definitions: implements API
- Service runtime → gRPC services: hosts services
- Service runtime → REST endpoints: hosts endpoints
- gRPC services → Library database: persists library
- Artwork cache → Server directories: uses paths (evidence: `packages/service-common/src/media_cache/mod.rs`)
- Cloud save services → Server directories: uses save paths
- Player / admin → Steam integration: unifies libraries (evidence: `README.md`)
- Player / admin → WebDAV client: uses remote files
