# freycikkk/enjin architecture

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

- Interactive diagram: https://gitdiagram.com/freycikkk/enjin
- Repository: https://github.com/freycikkk/enjin

## Overview

Enjin is an owner-only Discord.js runtime inspection and execution engine. An owner invokes it on a message; the Enjin entry point checks the prefix and authorization, resolves input, and dispatches an engine. Engines inspect or execute against the bot and runtime, then return results through redaction and paginated Discord replies. The graph preserves the documented engine families and reporting features; some command implementations are unsampled, so only documented or indexed dispatch links are shown. Optional edit/reply-message invocation is documented but its internal handling is not fully visible.

Main entry points: [`src/index.ts`](https://github.com/freycikkk/enjin/blob/main/src/index.ts) (Enjin dispatch), [`src/utils/respond.ts`](https://github.com/freycikkk/enjin/blob/main/src/utils/respond.ts) (Response and redaction), [`src/commands/channel.ts`](https://github.com/freycikkk/enjin/blob/main/src/commands/channel.ts) (Channel reports), [`src/commands/guild.ts`](https://github.com/freycikkk/enjin/blob/main/src/commands/guild.ts) (Guild reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation"]
  node_enjin["Enjin dispatch<br/>[index.ts]"]
  node_sharding["Shard detection<br/>[detectShardType.ts]"]
  node_context["Command context<br/>[Context.ts]"]
end

subgraph group_engines["Command engines"]
  node_eval["JavaScript evaluation<br/>[js.ts]"]
  node_iife["IIFE evaluation<br/>[iife.ts]"]
  node_shell["Shell execution<br/>[shell.ts]"]
  node_http["HTTP requests<br/>[curl.ts]"]
  node_file["File inspection<br/>[cat.ts]"]
  node_latency["Round-trip latency<br/>[rtt.ts]"]
  node_shard["Shard inspection<br/>[shard.ts]"]
end

subgraph group_reports["Reports"]
  node_guild["Guild reports<br/>[guild.ts]"]
  node_channel["Channel reports<br/>[channel.ts]"]
  node_member["Member reports<br/>[member.ts]"]
  node_cache["Cache report<br/>[cache.ts]"]
  node_memory["Memory report<br/>[memory.ts]"]
  node_process["Process report<br/>[process.ts]"]
  node_otherinfo["Other info engines"]
  node_report["Report builder<br/>[InfoReport.ts]"]
  node_format["Report formatting<br/>[format.ts]"]
  node_access["Safe property access<br/>[access.ts]"]
  node_snowflake["Snowflake parsing<br/>[snowflake.ts]"]
end

subgraph group_output["Output"]
  node_respond["Response and redaction<br/>[respond.ts]"]
  node_sanitize["Secret redaction<br/>[sanitize.ts]"]
  node_chunking["Output chunking<br/>[Chunking.ts]"]
  node_paginator["Interactive pagination<br/>[paginator.ts]"]
end

node_owner(("Bot owner"))
node_discord["Discord.js client"]

node_owner -->|"submits command"| node_enjin
node_discord -->|"provides messages"| node_enjin
node_enjin -->|"detects sharding"| node_sharding
node_enjin -->|"dispatches"| node_eval
node_enjin -->|"dispatches"| node_iife
node_enjin -->|"dispatches"| node_shell
node_enjin -->|"dispatches"| node_http
node_enjin -->|"dispatches"| node_file
node_enjin -->|"dispatches"| node_latency
node_enjin -->|"dispatches"| node_shard
node_enjin -->|"dispatches"| node_guild
node_enjin -->|"dispatches"| node_channel
node_enjin -->|"dispatches"| node_member
node_enjin -->|"dispatches"| node_cache
node_enjin -->|"dispatches"| node_memory
node_enjin -->|"dispatches"| node_process
node_enjin -->|"dispatches"| node_otherinfo
node_guild -->|"builds report"| node_report
node_channel -->|"builds report"| node_report
node_cache -->|"builds report"| node_report
node_process -->|"builds report"| node_report
node_guild -->|"formats fields"| node_format
node_channel -->|"reads properties"| node_access
node_channel -->|"parses identifiers"| node_snowflake
node_cache -->|"formats counts"| node_format
node_guild -->|"sends report"| node_respond
node_channel -->|"sends report"| node_respond
node_cache -->|"sends report"| node_respond
node_process -->|"sends report"| node_respond
node_respond -->|"redacts secrets"| node_sanitize
node_respond -->|"splits output"| node_chunking
node_respond -->|"creates pages"| node_paginator
node_paginator -->|"splits streaming output"| node_chunking

click node_enjin "https://github.com/freycikkk/enjin/blob/main/src/index.ts"
click node_sharding "https://github.com/freycikkk/enjin/blob/main/src/utils/detectShardType.ts"
click node_context "https://github.com/freycikkk/enjin/blob/main/src/interface/Context.ts"
click node_eval "https://github.com/freycikkk/enjin/blob/main/src/commands/js.ts"
click node_iife "https://github.com/freycikkk/enjin/blob/main/src/commands/iife.ts"
click node_shell "https://github.com/freycikkk/enjin/blob/main/src/commands/shell.ts"
click node_http "https://github.com/freycikkk/enjin/blob/main/src/commands/curl.ts"
click node_file "https://github.com/freycikkk/enjin/blob/main/src/commands/cat.ts"
click node_latency "https://github.com/freycikkk/enjin/blob/main/src/commands/rtt.ts"
click node_shard "https://github.com/freycikkk/enjin/blob/main/src/commands/shard.ts"
click node_guild "https://github.com/freycikkk/enjin/blob/main/src/commands/guild.ts"
click node_channel "https://github.com/freycikkk/enjin/blob/main/src/commands/channel.ts"
click node_member "https://github.com/freycikkk/enjin/blob/main/src/commands/member.ts"
click node_cache "https://github.com/freycikkk/enjin/blob/main/src/commands/cache.ts"
click node_memory "https://github.com/freycikkk/enjin/blob/main/src/commands/memory.ts"
click node_process "https://github.com/freycikkk/enjin/blob/main/src/commands/process.ts"
click node_otherinfo "https://github.com/freycikkk/enjin/tree/main/src/commands"
click node_report "https://github.com/freycikkk/enjin/blob/main/src/class/InfoReport.ts"
click node_format "https://github.com/freycikkk/enjin/blob/main/src/utils/format.ts"
click node_access "https://github.com/freycikkk/enjin/blob/main/src/utils/access.ts"
click node_snowflake "https://github.com/freycikkk/enjin/blob/main/src/utils/snowflake.ts"
click node_respond "https://github.com/freycikkk/enjin/blob/main/src/utils/respond.ts"
click node_sanitize "https://github.com/freycikkk/enjin/blob/main/src/utils/sanitize.ts"
click node_chunking "https://github.com/freycikkk/enjin/blob/main/src/utils/Chunking.ts"
click node_paginator "https://github.com/freycikkk/enjin/blob/main/src/utils/paginator.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_enjin,node_sharding,node_context,node_discord toneBlue
class node_eval,node_iife,node_shell,node_http,node_file,node_latency,node_shard toneAmber
class node_guild,node_channel,node_member,node_cache,node_memory,node_process,node_otherinfo,node_report,node_format,node_access,node_snowflake toneMint
class node_respond,node_sanitize,node_chunking,node_paginator toneRose
class node_owner toneIndigo
```

## Components

### Invocation

- [Enjin dispatch](https://github.com/freycikkk/enjin/blob/main/src/index.ts): `src/index.ts`
- [Shard detection](https://github.com/freycikkk/enjin/blob/main/src/utils/detectShardType.ts): `src/utils/detectShardType.ts`
- [Command context](https://github.com/freycikkk/enjin/blob/main/src/interface/Context.ts): `src/interface/Context.ts`

### Command engines

- [JavaScript evaluation](https://github.com/freycikkk/enjin/blob/main/src/commands/js.ts): `src/commands/js.ts`
- [IIFE evaluation](https://github.com/freycikkk/enjin/blob/main/src/commands/iife.ts): `src/commands/iife.ts`
- [Shell execution](https://github.com/freycikkk/enjin/blob/main/src/commands/shell.ts): `src/commands/shell.ts`
- [HTTP requests](https://github.com/freycikkk/enjin/blob/main/src/commands/curl.ts): `src/commands/curl.ts`
- [File inspection](https://github.com/freycikkk/enjin/blob/main/src/commands/cat.ts): `src/commands/cat.ts`
- [Round-trip latency](https://github.com/freycikkk/enjin/blob/main/src/commands/rtt.ts): `src/commands/rtt.ts`
- [Shard inspection](https://github.com/freycikkk/enjin/blob/main/src/commands/shard.ts): `src/commands/shard.ts`

### Reports

- [Guild reports](https://github.com/freycikkk/enjin/blob/main/src/commands/guild.ts): `src/commands/guild.ts`
- [Channel reports](https://github.com/freycikkk/enjin/blob/main/src/commands/channel.ts): `src/commands/channel.ts`
- [Member reports](https://github.com/freycikkk/enjin/blob/main/src/commands/member.ts): `src/commands/member.ts`
- [Cache report](https://github.com/freycikkk/enjin/blob/main/src/commands/cache.ts): `src/commands/cache.ts`
- [Memory report](https://github.com/freycikkk/enjin/blob/main/src/commands/memory.ts): `src/commands/memory.ts`
- [Process report](https://github.com/freycikkk/enjin/blob/main/src/commands/process.ts): `src/commands/process.ts`
- [Other info engines](https://github.com/freycikkk/enjin/tree/main/src/commands): `src/commands`
- [Report builder](https://github.com/freycikkk/enjin/blob/main/src/class/InfoReport.ts): `src/class/InfoReport.ts`
- [Report formatting](https://github.com/freycikkk/enjin/blob/main/src/utils/format.ts): `src/utils/format.ts`
- [Safe property access](https://github.com/freycikkk/enjin/blob/main/src/utils/access.ts): `src/utils/access.ts`
- [Snowflake parsing](https://github.com/freycikkk/enjin/blob/main/src/utils/snowflake.ts): `src/utils/snowflake.ts`

### Output

- [Response and redaction](https://github.com/freycikkk/enjin/blob/main/src/utils/respond.ts): `src/utils/respond.ts`
- [Secret redaction](https://github.com/freycikkk/enjin/blob/main/src/utils/sanitize.ts): `src/utils/sanitize.ts`
- [Output chunking](https://github.com/freycikkk/enjin/blob/main/src/utils/Chunking.ts): `src/utils/Chunking.ts`
- [Interactive pagination](https://github.com/freycikkk/enjin/blob/main/src/utils/paginator.ts): `src/utils/paginator.ts`

### Other components

- **Bot owner**
- **Discord.js client**

## Connections

- Bot owner → Enjin dispatch: submits command (evidence: `README.md`)
- Discord.js client → Enjin dispatch: provides messages (evidence: `README.md`)
- Enjin dispatch → Shard detection: detects sharding (evidence: `src/index.ts`)
- Enjin dispatch → JavaScript evaluation: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → IIFE evaluation: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Shell execution: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → HTTP requests: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → File inspection: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Round-trip latency: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Shard inspection: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Guild reports: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Channel reports: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Member reports: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Cache report: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Memory report: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Process report: dispatches (evidence: `src/index.ts`)
- Enjin dispatch → Other info engines: dispatches (evidence: `src/index.ts`)
- Guild reports → Report builder: builds report (evidence: `src/commands/guild.ts`)
- Channel reports → Report builder: builds report (evidence: `src/commands/channel.ts`)
- Cache report → Report builder: builds report (evidence: `src/commands/cache.ts`)
- Process report → Report builder: builds report (evidence: `src/commands/process.ts`)
- Guild reports → Report formatting: formats fields (evidence: `src/commands/guild.ts`)
- Channel reports → Safe property access: reads properties (evidence: `src/commands/channel.ts`)
- Channel reports → Snowflake parsing: parses identifiers (evidence: `src/commands/channel.ts`)
- Cache report → Report formatting: formats counts (evidence: `src/commands/cache.ts`)
- Guild reports → Response and redaction: sends report (evidence: `src/commands/guild.ts`)
- Channel reports → Response and redaction: sends report (evidence: `src/commands/channel.ts`)
- Cache report → Response and redaction: sends report (evidence: `src/commands/cache.ts`)
- Process report → Response and redaction: sends report (evidence: `src/commands/process.ts`)
- Response and redaction → Secret redaction: redacts secrets (evidence: `src/utils/respond.ts`)
- Response and redaction → Output chunking: splits output (evidence: `src/utils/respond.ts`)
- Response and redaction → Interactive pagination: creates pages (evidence: `src/utils/respond.ts`)
- Interactive pagination → Output chunking: splits streaming output (evidence: `src/utils/paginator.ts`)
