# vekendian/nexus architecture

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

- Interactive diagram: https://gitdiagram.com/vekendian/nexus
- Repository: https://github.com/vekendian/nexus

## Overview

Nexus is an offline patcher that re-skins and rebrands an apktool-decoded GameGuardian tree without changing the input. The main workflow is CLI request → input validation and preflight → ID resolution and template generation → patch a copy → postflight. Its product capabilities include home/navbar and ENVIRONMENT UI, a power card, module picker and persistence, settings/dialog/keyboard styling, and app rebranding. Edges reflect README statements or sampled imports/calls; unsampled relationships are omitted rather than inferred.

Main entry points: [`nexus/cli.py`](https://github.com/vekendian/nexus/blob/main/nexus/cli.py) (Command dispatch), [`nexus/checks.py`](https://github.com/vekendian/nexus/blob/main/nexus/checks.py) (Preflight and postflight), [`nexus/smali.py`](https://github.com/vekendian/nexus/blob/main/nexus/smali.py) (Smali templates), [`nexus/tree.py`](https://github.com/vekendian/nexus/blob/main/nexus/tree.py) (Tree clone and I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and checks"]
  node_cli["Command dispatch<br/>[cli.py]"]
  node_preflight["Preflight and postflight<br/>[checks.py]"]
end

subgraph group_patch["Patch generation"]
  node_anchors["Exact anchor engine<br/>[anchors.py]"]
  node_ids["ID resolver and lock<br/>[ids.py]"]
  node_smali["Smali templates<br/>[smali.py]"]
end

subgraph group_target["Target and identity"]
  node_tree["Tree clone and I/O<br/>[tree.py]"]
  node_manifest["Rebrand transform<br/>[manifest.py]"]
end

subgraph group_ui["Nexus interface"]
  node_modules["Module runtime<br/>[modules.py]"]
  node_layout["Screen layouts<br/>[layout.py]"]
  node_resources["UI resources"]
end

node_user(("Patcher user"))
node_decoded["Decoded GG tree"]
node_patched["Patched tree copy"]
node_lockfile["Nexus ID lock<br/>[nexus_ids.json]"]

node_user -->|"runs command"| node_cli
node_cli -->|"runs checks"| node_preflight
node_cli -->|"loads IDs"| node_ids
node_cli -->|"resolves and clones"| node_tree
node_cli -->|"applies patch"| node_smali
node_cli -->|"rebrands tree"| node_manifest
node_cli -->|"transforms layouts"| node_layout
node_preflight -->|"checks anchors"| node_anchors
node_preflight -->|"audits bindings"| node_ids
node_preflight -->|"reads tree"| node_tree
node_ids -->|"loads lock"| node_lockfile
node_smali -->|"replaces anchors"| node_anchors
node_smali -->|"embeds methods"| node_modules
node_layout -->|"replaces blocks"| node_anchors
node_manifest -->|"replaces identity"| node_anchors
node_manifest -->|"reads and writes"| node_tree
node_cli -->|"accepts source"| node_decoded
node_tree -->|"reads source"| node_decoded
node_tree -->|"writes clone"| node_patched
node_smali -->|"patches smali"| node_patched
node_layout -->|"patches layouts"| node_patched
node_manifest -->|"rebrands copy"| node_patched
node_resources -->|"supplies assets"| node_patched
node_layout -->|"references assets"| node_resources
node_smali -->|"renders IDs"| node_ids
node_modules -->|"injects picker"| node_patched
node_preflight -->|"verifies output"| node_patched

click node_cli "https://github.com/vekendian/nexus/blob/main/nexus/cli.py"
click node_preflight "https://github.com/vekendian/nexus/blob/main/nexus/checks.py"
click node_anchors "https://github.com/vekendian/nexus/blob/main/nexus/anchors.py"
click node_ids "https://github.com/vekendian/nexus/blob/main/nexus/ids.py"
click node_smali "https://github.com/vekendian/nexus/blob/main/nexus/smali.py"
click node_modules "https://github.com/vekendian/nexus/blob/main/nexus/modules.py"
click node_layout "https://github.com/vekendian/nexus/blob/main/nexus/layout.py"
click node_resources "https://github.com/vekendian/nexus/tree/main/resources/res"
click node_tree "https://github.com/vekendian/nexus/blob/main/nexus/tree.py"
click node_manifest "https://github.com/vekendian/nexus/blob/main/nexus/manifest.py"
click node_lockfile "https://github.com/vekendian/nexus/blob/main/nexus_ids.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_cli,node_preflight,node_user toneBlue
class node_anchors,node_ids,node_smali toneAmber
class node_tree,node_manifest toneMint
class node_modules,node_layout,node_resources toneRose
class node_decoded,node_patched toneIndigo
class node_lockfile toneTeal
```

## Components

### CLI and checks

- [Command dispatch](https://github.com/vekendian/nexus/blob/main/nexus/cli.py): `nexus/cli.py`
- [Preflight and postflight](https://github.com/vekendian/nexus/blob/main/nexus/checks.py): `nexus/checks.py`

### Patch generation

- [Exact anchor engine](https://github.com/vekendian/nexus/blob/main/nexus/anchors.py): `nexus/anchors.py`
- [ID resolver and lock](https://github.com/vekendian/nexus/blob/main/nexus/ids.py): `nexus/ids.py`
- [Smali templates](https://github.com/vekendian/nexus/blob/main/nexus/smali.py): `nexus/smali.py`

### Target and identity

- [Tree clone and I/O](https://github.com/vekendian/nexus/blob/main/nexus/tree.py): `nexus/tree.py`
- [Rebrand transform](https://github.com/vekendian/nexus/blob/main/nexus/manifest.py): `nexus/manifest.py`

### Nexus interface

- [Module runtime](https://github.com/vekendian/nexus/blob/main/nexus/modules.py): `nexus/modules.py`
- [Screen layouts](https://github.com/vekendian/nexus/blob/main/nexus/layout.py): `nexus/layout.py`
- [UI resources](https://github.com/vekendian/nexus/tree/main/resources/res): `resources/res`

### Other components

- **Patcher user**
- **Decoded GG tree**
- **Patched tree copy**
- [Nexus ID lock](https://github.com/vekendian/nexus/blob/main/nexus_ids.json): `nexus_ids.json`

## Connections

- Patcher user → Command dispatch: runs command (evidence: `README.md`)
- Command dispatch → Preflight and postflight: runs checks (evidence: `nexus/cli.py`)
- Command dispatch → ID resolver and lock: loads IDs (evidence: `nexus/cli.py`)
- Command dispatch → Tree clone and I/O: resolves and clones (evidence: `nexus/cli.py`)
- Command dispatch → Smali templates: applies patch (evidence: `nexus/cli.py`)
- Command dispatch → Rebrand transform: rebrands tree (evidence: `nexus/cli.py`)
- Command dispatch → Screen layouts: transforms layouts (evidence: `nexus/cli.py`)
- Preflight and postflight → Exact anchor engine: checks anchors (evidence: `nexus/checks.py`)
- Preflight and postflight → ID resolver and lock: audits bindings (evidence: `nexus/checks.py`)
- Preflight and postflight → Tree clone and I/O: reads tree (evidence: `nexus/checks.py`)
- ID resolver and lock → Nexus ID lock: loads lock (evidence: `nexus/ids.py`)
- Smali templates → Exact anchor engine: replaces anchors (evidence: `nexus/smali.py`)
- Smali templates → Module runtime: embeds methods (evidence: `nexus/smali.py`)
- Screen layouts → Exact anchor engine: replaces blocks (evidence: `nexus/layout.py`)
- Rebrand transform → Exact anchor engine: replaces identity (evidence: `nexus/manifest.py`)
- Rebrand transform → Tree clone and I/O: reads and writes (evidence: `nexus/manifest.py`)
- Command dispatch → Decoded GG tree: accepts source (evidence: `README.md`)
- Tree clone and I/O → Decoded GG tree: reads source (evidence: `README.md`)
- Tree clone and I/O → Patched tree copy: writes clone (evidence: `README.md`)
- Smali templates → Patched tree copy: patches smali
- Screen layouts → Patched tree copy: patches layouts
- Rebrand transform → Patched tree copy: rebrands copy
- UI resources → Patched tree copy: supplies assets (evidence: `README.md`)
- Screen layouts → UI resources: references assets (evidence: `README.md`)
- Smali templates → ID resolver and lock: renders IDs (evidence: `nexus/cli.py`)
- Module runtime → Patched tree copy: injects picker (evidence: `nexus/modules.py`)
- Preflight and postflight → Patched tree copy: verifies output
