# nghslab/norideck architecture

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

- Interactive diagram: https://gitdiagram.com/nghslab/norideck
- Repository: https://github.com/nghslab/norideck

## Overview

NoriDeck is a desktop retro-console for importing, organizing, and running TypeScript game cartridges packaged as .nori files. The main user flow is to add a cartridge to the library, select it from the home screen, validate and load it, then play through a console session with mapped input, screen handling, and saves. The repository also includes cartridge creation and packaging tools plus the SDK contract. Some UI and storage wiring is unsampled, so uncertain links are omitted.

Main entry points: [`desktop/src/main.ts`](https://github.com/nghslab/norideck/blob/dev/desktop/src/main.ts) (Desktop process), [`runtime/src/boot.ts`](https://github.com/nghslab/norideck/blob/dev/runtime/src/boot.ts) (Console boot), [`cli/src/nori.ts`](https://github.com/nghslab/norideck/blob/dev/cli/src/nori.ts) (CLI commands), [`runtime/src/session.ts`](https://github.com/nghslab/norideck/blob/dev/runtime/src/session.ts) (Game session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop shell"]
  node_desktop_main["Desktop process<br/>[main.ts]"]
  node_data_root["Data location<br/>[dataRoot.ts]"]
  node_desktop_library[("Cartridge storage<br/>[library.ts]")]
end

subgraph group_runtime["Console runtime"]
  node_runtime_entry["Runtime entry<br/>[main.ts]"]
  node_boot["Console boot<br/>[boot.ts]"]
  node_home["Home screen<br/>[home.ts]"]
  node_library_actions["Library actions<br/>[libraryActions.ts]"]
  node_runtime_library["Library interface<br/>[library.ts]"]
  node_session["Game session<br/>[session.ts]"]
  node_nori_open["Cartridge validation<br/>[openNori.ts]"]
  node_loader["Module loader<br/>[loader.ts]"]
  node_console["Console hardware<br/>[createConsole.ts]"]
  node_input["Input mapping<br/>[keymap.ts]"]
  node_settings["Console settings<br/>[settings.ts]"]
  node_dialogs["Console dialogs<br/>[dialogs.ts]"]
  node_menus["Platform menus<br/>[menus.ts]"]
  node_i18n["UI localization<br/>[i18n.ts]"]
end

subgraph group_cartridges["Cartridge tools"]
  node_cli_init["Project scaffolding<br/>[init.ts]"]
  node_cli_commands["CLI commands<br/>[nori.ts]"]
  node_cli_build["Cartridge build<br/>[build.ts]"]
  node_cli_check["Cartridge validation<br/>[check.ts]"]
  node_archive["Archive handling<br/>[archive.ts]"]
end

subgraph group_sdk["Cartridge SDK"]
  node_sdk["Console cartridge API<br/>[index.ts]"]
  node_manifest["Manifest validation<br/>[manifest.ts]"]
end

node_user(("Player"))
node_cart_user(("Cartridge developer"))

node_user -->|"launches"| node_desktop_main
node_desktop_main -->|"configures storage"| node_data_root
node_desktop_main -->|"registers library IPC"| node_desktop_library
node_desktop_main -->|"loads renderer"| node_runtime_entry
node_runtime_entry -->|"starts"| node_boot
node_boot -->|"shows"| node_home
node_boot -->|"creates"| node_session
node_home -.->|"offers actions"| node_library_actions
node_library_actions -->|"uses"| node_runtime_library
node_session -->|"opens file"| node_nori_open
node_session -->|"creates"| node_console
node_nori_open -->|"selects cartridge"| node_loader
node_console -->|"uses mapping"| node_input
node_console -->|"reads settings"| node_settings
node_boot -->|"installs"| node_menus
node_menus -->|"opens"| node_dialogs
node_dialogs -->|"translates strings"| node_i18n
node_user -->|"adds cartridge"| node_desktop_library
node_user -->|"selects game"| node_home
node_cart_user -->|"creates project"| node_cli_init
node_cli_commands -->|"dispatches"| node_cli_init
node_cli_commands -->|"dispatches"| node_cli_build
node_cli_commands -->|"dispatches"| node_cli_check
node_cli_build -->|"packages files"| node_archive
node_cli_check -->|"checks archive"| node_archive
node_cli_init -->|"uses contract"| node_sdk
node_sdk -->|"re-exports types"| node_manifest

click node_desktop_main "https://github.com/nghslab/norideck/blob/dev/desktop/src/main.ts"
click node_data_root "https://github.com/nghslab/norideck/blob/dev/desktop/src/dataRoot.ts"
click node_desktop_library "https://github.com/nghslab/norideck/blob/dev/desktop/src/library.ts"
click node_runtime_entry "https://github.com/nghslab/norideck/blob/dev/runtime/src/main.ts"
click node_boot "https://github.com/nghslab/norideck/blob/dev/runtime/src/boot.ts"
click node_home "https://github.com/nghslab/norideck/blob/dev/runtime/src/home.ts"
click node_library_actions "https://github.com/nghslab/norideck/blob/dev/runtime/src/libraryActions.ts"
click node_runtime_library "https://github.com/nghslab/norideck/blob/dev/runtime/src/library.ts"
click node_session "https://github.com/nghslab/norideck/blob/dev/runtime/src/session.ts"
click node_nori_open "https://github.com/nghslab/norideck/blob/dev/runtime/src/nori/openNori.ts"
click node_loader "https://github.com/nghslab/norideck/blob/dev/runtime/src/loader.ts"
click node_console "https://github.com/nghslab/norideck/blob/dev/runtime/src/console/createConsole.ts"
click node_input "https://github.com/nghslab/norideck/blob/dev/runtime/src/console/keymap.ts"
click node_settings "https://github.com/nghslab/norideck/blob/dev/runtime/src/console/settings.ts"
click node_dialogs "https://github.com/nghslab/norideck/blob/dev/runtime/src/platform/dialogs.ts"
click node_menus "https://github.com/nghslab/norideck/blob/dev/runtime/src/platform/menus.ts"
click node_i18n "https://github.com/nghslab/norideck/blob/dev/runtime/src/i18n.ts"
click node_cli_init "https://github.com/nghslab/norideck/blob/dev/cli/src/init.ts"
click node_cli_commands "https://github.com/nghslab/norideck/blob/dev/cli/src/nori.ts"
click node_cli_build "https://github.com/nghslab/norideck/blob/dev/cli/src/build.ts"
click node_cli_check "https://github.com/nghslab/norideck/blob/dev/cli/src/check.ts"
click node_archive "https://github.com/nghslab/norideck/blob/dev/cli/src/archive.ts"
click node_sdk "https://github.com/nghslab/norideck/blob/dev/sdk/src/index.ts"
click node_manifest "https://github.com/nghslab/norideck/blob/dev/sdk/src/manifest.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_desktop_main,node_data_root,node_desktop_library toneBlue
class node_runtime_entry,node_boot,node_home,node_library_actions,node_runtime_library,node_session,node_nori_open,node_loader,node_console,node_input,node_settings,node_dialogs,node_menus,node_i18n toneAmber
class node_cli_init,node_cli_commands,node_cli_build,node_cli_check,node_archive toneMint
class node_sdk,node_manifest toneRose
class node_user,node_cart_user toneIndigo
```

## Components

### Desktop shell

- [Desktop process](https://github.com/nghslab/norideck/blob/dev/desktop/src/main.ts): `desktop/src/main.ts`
- [Data location](https://github.com/nghslab/norideck/blob/dev/desktop/src/dataRoot.ts): `desktop/src/dataRoot.ts`
- [Cartridge storage](https://github.com/nghslab/norideck/blob/dev/desktop/src/library.ts): `desktop/src/library.ts`

### Console runtime

- [Runtime entry](https://github.com/nghslab/norideck/blob/dev/runtime/src/main.ts): `runtime/src/main.ts`
- [Console boot](https://github.com/nghslab/norideck/blob/dev/runtime/src/boot.ts): `runtime/src/boot.ts`
- [Home screen](https://github.com/nghslab/norideck/blob/dev/runtime/src/home.ts): `runtime/src/home.ts`
- [Library actions](https://github.com/nghslab/norideck/blob/dev/runtime/src/libraryActions.ts): `runtime/src/libraryActions.ts`
- [Library interface](https://github.com/nghslab/norideck/blob/dev/runtime/src/library.ts): `runtime/src/library.ts`
- [Game session](https://github.com/nghslab/norideck/blob/dev/runtime/src/session.ts): `runtime/src/session.ts`
- [Cartridge validation](https://github.com/nghslab/norideck/blob/dev/runtime/src/nori/openNori.ts): `runtime/src/nori/openNori.ts`
- [Module loader](https://github.com/nghslab/norideck/blob/dev/runtime/src/loader.ts): `runtime/src/loader.ts`
- [Console hardware](https://github.com/nghslab/norideck/blob/dev/runtime/src/console/createConsole.ts): `runtime/src/console/createConsole.ts`
- [Input mapping](https://github.com/nghslab/norideck/blob/dev/runtime/src/console/keymap.ts): `runtime/src/console/keymap.ts`
- [Console settings](https://github.com/nghslab/norideck/blob/dev/runtime/src/console/settings.ts): `runtime/src/console/settings.ts`
- [Console dialogs](https://github.com/nghslab/norideck/blob/dev/runtime/src/platform/dialogs.ts): `runtime/src/platform/dialogs.ts`
- [Platform menus](https://github.com/nghslab/norideck/blob/dev/runtime/src/platform/menus.ts): `runtime/src/platform/menus.ts`
- [UI localization](https://github.com/nghslab/norideck/blob/dev/runtime/src/i18n.ts): `runtime/src/i18n.ts`

### Cartridge tools

- [Project scaffolding](https://github.com/nghslab/norideck/blob/dev/cli/src/init.ts): `cli/src/init.ts`
- [CLI commands](https://github.com/nghslab/norideck/blob/dev/cli/src/nori.ts): `cli/src/nori.ts`
- [Cartridge build](https://github.com/nghslab/norideck/blob/dev/cli/src/build.ts): `cli/src/build.ts`
- [Cartridge validation](https://github.com/nghslab/norideck/blob/dev/cli/src/check.ts): `cli/src/check.ts`
- [Archive handling](https://github.com/nghslab/norideck/blob/dev/cli/src/archive.ts): `cli/src/archive.ts`

### Cartridge SDK

- [Console cartridge API](https://github.com/nghslab/norideck/blob/dev/sdk/src/index.ts): `sdk/src/index.ts`
- [Manifest validation](https://github.com/nghslab/norideck/blob/dev/sdk/src/manifest.ts): `sdk/src/manifest.ts`

### Other components

- **Player**
- **Cartridge developer**

## Connections

- Player → Desktop process: launches
- Desktop process → Data location: configures storage (evidence: `desktop/src/main.ts`)
- Desktop process → Cartridge storage: registers library IPC (evidence: `desktop/src/main.ts`)
- Desktop process → Runtime entry: loads renderer (evidence: `desktop/src/main.ts`)
- Runtime entry → Console boot: starts (evidence: `runtime/src/main.ts`)
- Console boot → Home screen: shows (evidence: `runtime/src/boot.ts`)
- Console boot → Game session: creates (evidence: `runtime/src/boot.ts`)
- Home screen → Library actions: offers actions (evidence: `runtime/src/libraryActions.ts`)
- Library actions → Library interface: uses (evidence: `runtime/src/libraryActions.ts`)
- Game session → Cartridge validation: opens file (evidence: `runtime/src/session.ts`)
- Game session → Console hardware: creates (evidence: `runtime/src/session.ts`)
- Cartridge validation → Module loader: selects cartridge (evidence: `runtime/src/nori/openNori.ts`)
- Console hardware → Input mapping: uses mapping (evidence: `runtime/src/console/createConsole.ts`)
- Console hardware → Console settings: reads settings (evidence: `runtime/src/console/createConsole.ts`)
- Console boot → Platform menus: installs (evidence: `runtime/src/boot.ts`)
- Platform menus → Console dialogs: opens (evidence: `runtime/src/platform/menus.ts`)
- Console dialogs → UI localization: translates strings (evidence: `runtime/src/platform/dialogs.ts`)
- Player → Cartridge storage: adds cartridge
- Player → Home screen: selects game
- Cartridge developer → Project scaffolding: creates project
- CLI commands → Project scaffolding: dispatches (evidence: `cli/src/nori.ts`)
- CLI commands → Cartridge build: dispatches (evidence: `cli/src/nori.ts`)
- CLI commands → Cartridge validation: dispatches (evidence: `cli/src/nori.ts`)
- Cartridge build → Archive handling: packages files (evidence: `cli/src/build.ts`)
- Cartridge validation → Archive handling: checks archive (evidence: `cli/src/check.ts`)
- Project scaffolding → Console cartridge API: uses contract (evidence: `cli/src/init.ts`)
- Console cartridge API → Manifest validation: re-exports types (evidence: `sdk/src/index.ts`)
