# quantumxternal/quantum-obfuscator-lua-luau architecture

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

- Interactive diagram: https://gitdiagram.com/quantumxternal/quantum-obfuscator-lua-luau
- Repository: https://github.com/quantumxternal/quantum-obfuscator-lua-luau

## Overview

Clyde is a Luau obfuscator whose main workflow accepts source through the CLI or web interface, tokenizes and parses it, applies configurable AST transformations, then emits direct Luau or a protected stack/register VM script. Its other major capability is syntax validation. The graph preserves both VM backends and the shared bytecode layer. Some subsystem links rely on README architecture statements and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/engine/obfuscatePipeline.ts`](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/engine/obfuscatePipeline.ts) (Obfuscation Pipeline), [`src/vm/reg-vm-gen.ts`](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/reg-vm-gen.ts) (Register VM Generator), [`src/compiler/LuauCompiler.ts`](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/compiler/LuauCompiler.ts) (Syntax Validator), [`src/parser/Parser.ts`](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/parser/Parser.ts) (Luau Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Language Front End"]
  node_lexer["Lexer<br/>[Lexer.ts]"]
  node_tokens["Token Types<br/>[tokens.ts]"]
  node_parser["Luau Parser<br/>[Parser.ts]"]
  node_typeparser["Type Parser<br/>[TypeParser.ts]"]
  node_ast["AST Types<br/>[types.ts]"]
  node_validator["Syntax Validator<br/>[LuauCompiler.ts]"]
end

subgraph group_transform["Obfuscation"]
  node_pipeline["Obfuscation Pipeline"]
  node_profiles["Protection Profiles<br/>[profiles.ts]"]
  node_renamer["Identifier Renamer<br/>[Obfuscator.ts]"]
  node_stringencoder["String Encoder<br/>[StringEncoder.ts]"]
  node_scrambler["Flow Scrambler"]
  node_printer["Luau Printer<br/>[Printer.ts]"]
end

subgraph group_vm["VM Backends"]
  node_stackcompiler["Stack Compiler<br/>[Compiler.ts]"]
  node_regcompiler["Register Compiler<br/>[RegCompiler.ts]"]
  node_bytecode["Bytecode Format<br/>[bytecode.ts]"]
  node_stackgen["Stack VM Generator<br/>[vm-gen.ts]"]
  node_reggen["Register VM Generator<br/>[reg-vm-gen.ts]"]
  node_bootstrap["VM Bootstrap"]
  node_compression["LZMA Compression<br/>[lzma.ts]"]
  node_runner["VM Runner<br/>[vm-runner.ts]"]
  node_regrunner["Register VM Runner<br/>[reg-runner.ts]"]
end

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI Commands<br/>[obfuscate.ts]"]
  node_browser["Web UI<br/>[app.js]"]
  node_server["Web Server<br/>[server.ts]"]
end

node_user(("User"))
node_result["Obfuscated Luau"]

node_user -->|"runs command"| node_cli
node_user -->|"uses interface"| node_browser
node_browser -->|"requests obfuscation"| node_server
node_cli -->|"invokes"| node_pipeline
node_server -->|"invokes"| node_pipeline
node_server -->|"validates source"| node_validator
node_profiles -->|"configures"| node_pipeline
node_pipeline -->|"tokenizes"| node_lexer
node_lexer -->|"produces tokens"| node_tokens
node_pipeline -->|"parses tokens"| node_parser
node_parser -->|"delegates types"| node_typeparser
node_parser -->|"builds AST"| node_ast
node_validator -->|"tokenizes"| node_lexer
node_validator -->|"parses"| node_parser
node_validator -->|"prints AST"| node_printer
node_pipeline -->|"renames identifiers"| node_renamer
node_pipeline -->|"encodes strings"| node_stringencoder
node_pipeline -->|"scrambles flow"| node_scrambler
node_pipeline -->|"prints output"| node_printer
node_pipeline -->|"compiles stack VM"| node_stackcompiler
node_pipeline -->|"compiles register VM"| node_regcompiler
node_stackcompiler -->|"emits bytecode"| node_bytecode
node_regcompiler -->|"emits bytecode"| node_bytecode
node_pipeline -->|"generates stack VM"| node_stackgen
node_pipeline -->|"generates register VM"| node_reggen
node_stackgen -->|"encodes bytecode"| node_bytecode
node_reggen -->|"encodes bytecode"| node_bytecode
node_reggen -->|"uses bootstrap"| node_bootstrap
node_reggen -->|"compresses payload"| node_compression
node_stackgen -->|"emits script"| node_result
node_reggen -->|"emits script"| node_result
node_printer -->|"emits Luau"| node_result
node_stackcompiler -.->|"supports execution"| node_runner
node_regcompiler -.->|"supports execution"| node_regrunner

click node_cli "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/cli/obfuscate.ts"
click node_browser "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/public/app.js"
click node_server "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/server.ts"
click node_pipeline "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/engine/obfuscatePipeline.ts"
click node_profiles "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/engine/profiles.ts"
click node_lexer "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/lexer/Lexer.ts"
click node_tokens "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/tokens.ts"
click node_parser "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/parser/Parser.ts"
click node_typeparser "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/parser/TypeParser.ts"
click node_ast "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/ast/types.ts"
click node_validator "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/compiler/LuauCompiler.ts"
click node_renamer "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/Obfuscator.ts"
click node_stringencoder "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/StringEncoder.ts"
click node_scrambler "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/ControlFlowScrambler.ts"
click node_printer "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/Printer.ts"
click node_stackcompiler "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/Compiler.ts"
click node_regcompiler "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/RegCompiler.ts"
click node_bytecode "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/bytecode.ts"
click node_stackgen "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/vm-gen.ts"
click node_reggen "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/reg-vm-gen.ts"
click node_bootstrap "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/bootstrap-template.ts"
click node_compression "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/lzma.ts"
click node_runner "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/vm-runner.ts"
click node_regrunner "https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/reg-runner.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_lexer,node_tokens,node_parser,node_typeparser,node_ast,node_validator,node_user toneBlue
class node_pipeline,node_profiles,node_renamer,node_stringencoder,node_scrambler,node_printer toneAmber
class node_stackcompiler,node_regcompiler,node_bytecode,node_stackgen,node_reggen,node_bootstrap,node_compression,node_runner,node_regrunner toneMint
class node_cli,node_browser,node_server toneRose
class node_result toneIndigo
```

## Components

### Language Front End

- [Lexer](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/lexer/Lexer.ts): `src/lexer/Lexer.ts`
- [Token Types](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/tokens.ts): `src/tokens.ts`
- [Luau Parser](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/parser/Parser.ts): `src/parser/Parser.ts`
- [Type Parser](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/parser/TypeParser.ts): `src/parser/TypeParser.ts`
- [AST Types](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/ast/types.ts): `src/ast/types.ts`
- [Syntax Validator](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/compiler/LuauCompiler.ts): `src/compiler/LuauCompiler.ts`

### Obfuscation

- [Obfuscation Pipeline](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/engine/obfuscatePipeline.ts): `src/engine/obfuscatePipeline.ts`
- [Protection Profiles](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/engine/profiles.ts): `src/engine/profiles.ts`
- [Identifier Renamer](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/Obfuscator.ts): `src/obfuscator/Obfuscator.ts`
- [String Encoder](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/StringEncoder.ts): `src/obfuscator/StringEncoder.ts`
- [Flow Scrambler](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/ControlFlowScrambler.ts): `src/obfuscator/ControlFlowScrambler.ts`
- [Luau Printer](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/obfuscator/Printer.ts): `src/obfuscator/Printer.ts`

### VM Backends

- [Stack Compiler](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/Compiler.ts): `src/vm/Compiler.ts`
- [Register Compiler](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/RegCompiler.ts): `src/vm/RegCompiler.ts`
- [Bytecode Format](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/bytecode.ts): `src/vm/bytecode.ts`
- [Stack VM Generator](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/vm-gen.ts): `src/vm/vm-gen.ts`
- [Register VM Generator](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/reg-vm-gen.ts): `src/vm/reg-vm-gen.ts`
- [VM Bootstrap](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/bootstrap-template.ts): `src/vm/bootstrap-template.ts`
- [LZMA Compression](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/lzma.ts): `src/vm/lzma.ts`
- [VM Runner](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/vm-runner.ts): `src/vm/vm-runner.ts`
- [Register VM Runner](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/vm/reg-runner.ts): `src/vm/reg-runner.ts`

### User Interfaces

- [CLI Commands](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/cli/obfuscate.ts): `src/cli/obfuscate.ts`
- [Web UI](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/public/app.js): `public/app.js`
- [Web Server](https://github.com/quantumxternal/quantum-obfuscator-lua-luau/blob/main/src/server.ts): `src/server.ts`

### Other components

- **User**
- **Obfuscated Luau**

## Connections

- User → CLI Commands: runs command (evidence: `README.md`)
- User → Web UI: uses interface (evidence: `README.md`)
- Web UI → Web Server: requests obfuscation (evidence: `README.md`)
- CLI Commands → Obfuscation Pipeline: invokes (evidence: `src/cli/obfuscate.ts`)
- Web Server → Obfuscation Pipeline: invokes (evidence: `src/server.ts`)
- Web Server → Syntax Validator: validates source (evidence: `src/server.ts`)
- Protection Profiles → Obfuscation Pipeline: configures (evidence: `src/engine/profiles.ts`)
- Obfuscation Pipeline → Lexer: tokenizes (evidence: `README.md`)
- Lexer → Token Types: produces tokens (evidence: `src/lexer/Lexer.ts`)
- Obfuscation Pipeline → Luau Parser: parses tokens (evidence: `src/engine/obfuscatePipeline.ts`)
- Luau Parser → Type Parser: delegates types (evidence: `src/parser/Parser.ts`)
- Luau Parser → AST Types: builds AST (evidence: `README.md`)
- Syntax Validator → Lexer: tokenizes (evidence: `src/compiler/LuauCompiler.ts`)
- Syntax Validator → Luau Parser: parses (evidence: `src/compiler/LuauCompiler.ts`)
- Syntax Validator → Luau Printer: prints AST (evidence: `src/compiler/LuauCompiler.ts`)
- Obfuscation Pipeline → Identifier Renamer: renames identifiers (evidence: `src/engine/obfuscatePipeline.ts`)
- Obfuscation Pipeline → String Encoder: encodes strings (evidence: `src/engine/obfuscatePipeline.ts`)
- Obfuscation Pipeline → Flow Scrambler: scrambles flow (evidence: `src/engine/obfuscatePipeline.ts`)
- Obfuscation Pipeline → Luau Printer: prints output (evidence: `README.md`)
- Obfuscation Pipeline → Stack Compiler: compiles stack VM (evidence: `src/engine/obfuscatePipeline.ts`)
- Obfuscation Pipeline → Register Compiler: compiles register VM (evidence: `README.md`)
- Stack Compiler → Bytecode Format: emits bytecode (evidence: `src/vm/Compiler.ts`)
- Register Compiler → Bytecode Format: emits bytecode (evidence: `src/vm/RegCompiler.ts`)
- Obfuscation Pipeline → Stack VM Generator: generates stack VM (evidence: `README.md`)
- Obfuscation Pipeline → Register VM Generator: generates register VM (evidence: `src/engine/obfuscatePipeline.ts`)
- Stack VM Generator → Bytecode Format: encodes bytecode (evidence: `src/vm/vm-gen.ts`)
- Register VM Generator → Bytecode Format: encodes bytecode (evidence: `src/vm/reg-vm-gen.ts`)
- Register VM Generator → VM Bootstrap: uses bootstrap (evidence: `src/vm/reg-vm-gen.ts`)
- Register VM Generator → LZMA Compression: compresses payload (evidence: `src/vm/reg-vm-gen.ts`)
- Stack VM Generator → Obfuscated Luau: emits script (evidence: `README.md`)
- Register VM Generator → Obfuscated Luau: emits script (evidence: `README.md`)
- Luau Printer → Obfuscated Luau: emits Luau (evidence: `README.md`)
- Stack Compiler → VM Runner: supports execution
- Register Compiler → Register VM Runner: supports execution
