# yildirimmmm/g-midi architecture

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

- Interactive diagram: https://gitdiagram.com/yildirimmmm/g-midi
- Repository: https://github.com/yildirimmmm/g-midi
- Video tour (about a minute): https://gitdiagram.com/yildirimmmm/g-midi/video

## Overview

G-Midi is an Electron-based Habbo MIDI player. Its main workflow is to load a MIDI file, control playback, and send piano-furni clicks through the Habbo extension. It also supports piano-key mapping, named mapping configurations, and app settings. The sampled source confirms server routes, configuration persistence, and Habbo packet handling; the README is empty, and the excerpts do not establish how the HTML pages call the server or how the extension is connected to a Habbo session.

Main entry points: [`main.mjs`](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs) (HTTP API), [`public/index.html`](https://github.com/yildirimmmm/g-midi/blob/main/public/index.html) (Player page), [`public/settings.html`](https://github.com/yildirimmmm/g-midi/blob/main/public/settings.html) (Settings page), [`public/editConfig.html`](https://github.com/yildirimmmm/g-midi/blob/main/public/editConfig.html) (Config editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_window["Electron window<br/>[main.mjs]"]
  node_home["Player page<br/>[index.html]"]
  node_settings_page["Settings page<br/>[settings.html]"]
  node_edit_config["Config editor<br/>[editConfig.html]"]
  node_server["HTTP API<br/>[main.mjs]"]
end

subgraph group_playback["MIDI playback"]
  node_midi["MIDI parser<br/>[main.mjs]"]
  node_playback_control["Playback controls<br/>[main.mjs]"]
  node_scheduler["Note scheduling<br/>[main.mjs]"]
end

subgraph group_habbo["Habbo piano"]
  node_mapping["Key mapping<br/>[main.mjs]"]
  node_extension["Habbo extension<br/>[main.mjs]"]
end

subgraph group_configuration["Configuration"]
  node_config_routes["Config routes<br/>[main.mjs]"]
  node_config_files[("Mapping configs<br/>[default.json]")]
  node_settings_routes["Settings handling<br/>[main.mjs]"]
  node_settings_file[("App settings<br/>[settings.json]")]
end

node_user(("User"))
node_habbo_server(("Habbo game server"))

node_user -->|"uses"| node_window
node_window -->|"loads"| node_home
node_window -->|"loads"| node_settings_page
node_window -->|"loads"| node_edit_config
node_server -->|"parses upload"| node_midi
node_server -->|"dispatches controls"| node_playback_control
node_playback_control -->|"schedules notes"| node_scheduler
node_scheduler -->|"maps notes"| node_mapping
node_mapping -->|"sends piano clicks"| node_extension
node_extension -->|"forwards packets"| node_habbo_server
node_server -->|"dispatches config requests"| node_config_routes
node_config_routes -->|"reads and writes"| node_config_files
node_server -->|"dispatches settings requests"| node_settings_routes
node_settings_routes -->|"reads and writes"| node_settings_file

click node_window "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_home "https://github.com/yildirimmmm/g-midi/blob/main/public/index.html"
click node_settings_page "https://github.com/yildirimmmm/g-midi/blob/main/public/settings.html"
click node_edit_config "https://github.com/yildirimmmm/g-midi/blob/main/public/editConfig.html"
click node_server "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_midi "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_playback_control "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_scheduler "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_mapping "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_extension "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_config_routes "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_config_files "https://github.com/yildirimmmm/g-midi/blob/main/configs/default.json"
click node_settings_routes "https://github.com/yildirimmmm/g-midi/blob/main/main.mjs"
click node_settings_file "https://github.com/yildirimmmm/g-midi/blob/main/public/settings.json"

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_window,node_home,node_settings_page,node_edit_config,node_server,node_user toneBlue
class node_midi,node_playback_control,node_scheduler toneAmber
class node_mapping,node_extension,node_habbo_server toneMint
class node_config_routes,node_config_files,node_settings_routes,node_settings_file toneRose
```

## Components

### Desktop interface

- [Electron window](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [Player page](https://github.com/yildirimmmm/g-midi/blob/main/public/index.html): `public/index.html`
- [Settings page](https://github.com/yildirimmmm/g-midi/blob/main/public/settings.html): `public/settings.html`
- [Config editor](https://github.com/yildirimmmm/g-midi/blob/main/public/editConfig.html): `public/editConfig.html`
- [HTTP API](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`

### MIDI playback

- [MIDI parser](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [Playback controls](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [Note scheduling](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`

### Habbo piano

- [Key mapping](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [Habbo extension](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`

### Configuration

- [Config routes](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [Mapping configs](https://github.com/yildirimmmm/g-midi/blob/main/configs/default.json): `configs/default.json`
- [Settings handling](https://github.com/yildirimmmm/g-midi/blob/main/main.mjs): `main.mjs`
- [App settings](https://github.com/yildirimmmm/g-midi/blob/main/public/settings.json): `public/settings.json`

### Other components

- **User**
- **Habbo game server**

## Connections

- User → Electron window: uses
- Electron window → Player page: loads
- Electron window → Settings page: loads
- Electron window → Config editor: loads
- HTTP API → MIDI parser: parses upload
- HTTP API → Playback controls: dispatches controls
- Playback controls → Note scheduling: schedules notes
- Note scheduling → Key mapping: maps notes
- Key mapping → Habbo extension: sends piano clicks
- Habbo extension → Habbo game server: forwards packets
- HTTP API → Config routes: dispatches config requests
- Config routes → Mapping configs: reads and writes
- HTTP API → Settings handling: dispatches settings requests
- Settings handling → App settings: reads and writes
