# eujandergois/oxid architecture

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

- Interactive diagram: https://gitdiagram.com/eujandergois/oxid
- Repository: https://github.com/eujandergois/oxid

## Overview

Oxid is a CLI-first game engine: users create a JavaScript project, write game logic against built-in modules, then run it in a native Rust runtime. The runtime loads the project, executes lifecycle hooks through QuickJS, and renders queued drawing commands. The README also documents templates and generated editor typings. Some implementation files are listed but not sampled, so links among those components are limited to the documented workflow and explicit runtime entry points.

Main entry points: [`src/scripting/quickjs/mod.rs`](https://github.com/eujandergois/oxid/blob/main/src/scripting/quickjs/mod.rs) (QuickJS backend), [`src/runtime/game.rs`](https://github.com/eujandergois/oxid/blob/main/src/runtime/game.rs) (Game lifecycle), [`src/cli/mod.rs`](https://github.com/eujandergois/oxid/blob/main/src/cli/mod.rs) (CLI commands), [`src/main.rs`](https://github.com/eujandergois/oxid/blob/main/src/main.rs) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Project CLI"]
  node_cli_entry["CLI entry<br/>[main.rs]"]
  node_cli_commands["CLI commands<br/>[mod.rs]"]
  node_project_create["Project creation<br/>[new.rs]"]
  node_templates["Project templates<br/>[templates.rs]"]
  node_project_run["Project runner<br/>[run.rs]"]
end

subgraph group_script["JavaScript Scripting"]
  node_script_runtime["Runtime interface<br/>[runtime.rs]"]
  node_quickjs["QuickJS backend<br/>[mod.rs]"]
  node_script_loader["Script module loader<br/>[loader.rs]"]
  node_script_resolver["Module resolution<br/>[resolver.rs]"]
  node_api_plugins["Built-in JS API<br/>[registry.rs]"]
  node_type_generator["Type definitions<br/>[generator.rs]"]
end

subgraph group_engine["Native Engine"]
  node_project_load["Project loading<br/>[project.rs]"]
  node_game_loop["Game lifecycle<br/>[game.rs]"]
end

subgraph group_render["Rendering"]
  node_render_queue["Render queue<br/>[queue.rs]"]
  node_render_context["Active draw context<br/>[context.rs]"]
  node_renderer["Macroquad renderer<br/>[mq_renderer.rs]"]
  node_game_window["Game window"]
end

node_developer(("Game developer"))

node_developer -->|"runs CLI"| node_cli_entry
node_cli_entry -->|"dispatches"| node_cli_commands
node_cli_commands -->|"creates project"| node_project_create
node_project_create -->|"uses templates"| node_templates
node_cli_commands -->|"runs project"| node_project_run
node_project_run -->|"loads project"| node_project_load
node_project_load -->|"launches game"| node_game_loop
node_game_loop -->|"calls lifecycle"| node_script_runtime
node_quickjs -->|"implements"| node_script_runtime
node_quickjs -->|"configures loader"| node_script_loader
node_script_loader -->|"resolves imports"| node_script_resolver
node_quickjs -->|"registers modules"| node_api_plugins
node_api_plugins -->|"provides metadata"| node_type_generator
node_quickjs -->|"sets draw context"| node_render_context
node_render_context -->|"accesses queue"| node_render_queue
node_renderer -->|"renders commands"| node_render_queue
node_game_loop -->|"drives frames"| node_renderer
node_game_loop -->|"opens window"| node_game_window

click node_cli_entry "https://github.com/eujandergois/oxid/blob/main/src/main.rs"
click node_cli_commands "https://github.com/eujandergois/oxid/blob/main/src/cli/mod.rs"
click node_project_create "https://github.com/eujandergois/oxid/blob/main/src/cli/new.rs"
click node_templates "https://github.com/eujandergois/oxid/blob/main/src/cli/templates.rs"
click node_project_run "https://github.com/eujandergois/oxid/blob/main/src/cli/run.rs"
click node_project_load "https://github.com/eujandergois/oxid/blob/main/src/runtime/project.rs"
click node_game_loop "https://github.com/eujandergois/oxid/blob/main/src/runtime/game.rs"
click node_script_runtime "https://github.com/eujandergois/oxid/blob/main/src/scripting/runtime.rs"
click node_quickjs "https://github.com/eujandergois/oxid/blob/main/src/scripting/quickjs/mod.rs"
click node_script_loader "https://github.com/eujandergois/oxid/blob/main/src/scripting/quickjs/loader.rs"
click node_script_resolver "https://github.com/eujandergois/oxid/blob/main/src/scripting/resolver.rs"
click node_api_plugins "https://github.com/eujandergois/oxid/blob/main/src/scripting/plugins/registry.rs"
click node_type_generator "https://github.com/eujandergois/oxid/blob/main/src/scripting/generator.rs"
click node_render_queue "https://github.com/eujandergois/oxid/blob/main/src/renderer/queue.rs"
click node_render_context "https://github.com/eujandergois/oxid/blob/main/src/renderer/context.rs"
click node_renderer "https://github.com/eujandergois/oxid/blob/main/src/renderer/mq_renderer.rs"

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_cli_entry,node_cli_commands,node_project_create,node_templates,node_project_run toneBlue
class node_script_runtime,node_quickjs,node_script_loader,node_script_resolver,node_api_plugins,node_type_generator toneAmber
class node_project_load,node_game_loop toneMint
class node_render_queue,node_render_context,node_renderer,node_game_window toneRose
class node_developer toneIndigo
```

## Components

### Project CLI

- [CLI entry](https://github.com/eujandergois/oxid/blob/main/src/main.rs): `src/main.rs`
- [CLI commands](https://github.com/eujandergois/oxid/blob/main/src/cli/mod.rs): `src/cli/mod.rs`
- [Project creation](https://github.com/eujandergois/oxid/blob/main/src/cli/new.rs): `src/cli/new.rs`
- [Project templates](https://github.com/eujandergois/oxid/blob/main/src/cli/templates.rs): `src/cli/templates.rs`
- [Project runner](https://github.com/eujandergois/oxid/blob/main/src/cli/run.rs): `src/cli/run.rs`

### JavaScript Scripting

- [Runtime interface](https://github.com/eujandergois/oxid/blob/main/src/scripting/runtime.rs): `src/scripting/runtime.rs`
- [QuickJS backend](https://github.com/eujandergois/oxid/blob/main/src/scripting/quickjs/mod.rs): `src/scripting/quickjs/mod.rs`
- [Script module loader](https://github.com/eujandergois/oxid/blob/main/src/scripting/quickjs/loader.rs): `src/scripting/quickjs/loader.rs`
- [Module resolution](https://github.com/eujandergois/oxid/blob/main/src/scripting/resolver.rs): `src/scripting/resolver.rs`
- [Built-in JS API](https://github.com/eujandergois/oxid/blob/main/src/scripting/plugins/registry.rs): `src/scripting/plugins/registry.rs`
- [Type definitions](https://github.com/eujandergois/oxid/blob/main/src/scripting/generator.rs): `src/scripting/generator.rs`

### Native Engine

- [Project loading](https://github.com/eujandergois/oxid/blob/main/src/runtime/project.rs): `src/runtime/project.rs`
- [Game lifecycle](https://github.com/eujandergois/oxid/blob/main/src/runtime/game.rs): `src/runtime/game.rs`

### Rendering

- [Render queue](https://github.com/eujandergois/oxid/blob/main/src/renderer/queue.rs): `src/renderer/queue.rs`
- [Active draw context](https://github.com/eujandergois/oxid/blob/main/src/renderer/context.rs): `src/renderer/context.rs`
- [Macroquad renderer](https://github.com/eujandergois/oxid/blob/main/src/renderer/mq_renderer.rs): `src/renderer/mq_renderer.rs`
- **Game window**

### Other components

- **Game developer**

## Connections

- Game developer → CLI entry: runs CLI
- CLI entry → CLI commands: dispatches
- CLI commands → Project creation: creates project
- Project creation → Project templates: uses templates
- CLI commands → Project runner: runs project
- Project runner → Project loading: loads project
- Project loading → Game lifecycle: launches game
- Game lifecycle → Runtime interface: calls lifecycle
- QuickJS backend → Runtime interface: implements
- QuickJS backend → Script module loader: configures loader
- Script module loader → Module resolution: resolves imports
- QuickJS backend → Built-in JS API: registers modules
- Built-in JS API → Type definitions: provides metadata
- QuickJS backend → Active draw context: sets draw context
- Active draw context → Render queue: accesses queue
- Macroquad renderer → Render queue: renders commands
- Game lifecycle → Macroquad renderer: drives frames
- Game lifecycle → Game window: opens window
