# loki-xer/jarvis architecture

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

- Interactive diagram: https://gitdiagram.com/loki-xer/jarvis
- Repository: https://github.com/loki-xer/jarvis

## Overview

Jarvis MD is a multi-device WhatsApp bot. Its principal workflow is WhatsApp activity entering the bot runtime, being handled as messages/commands, and producing replies or actions through feature plugins. The repository also includes persistent user and schedule data, scheduling/calendar features, and AI, media, group, search, and administration capabilities. The startup excerpt shows runtime initialization; plugin references and several implementation excerpts are obfuscated or incomplete, so uncertain internal dispatch and storage links are omitted.

Main entry points: [`lib/index.js`](https://github.com/loki-xer/jarvis/blob/main/lib/index.js) (Command utilities), [`index.js`](https://github.com/loki-xer/jarvis/blob/main/index.js) (Startup), [`plugins/calendar.js`](https://github.com/loki-xer/jarvis/blob/main/plugins/calendar.js) (Calendar), [`plugins/schedule.js`](https://github.com/loki-xer/jarvis/blob/main/plugins/schedule.js) (Scheduling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_startup["Startup<br/>[index.js]"]
  node_engine["Bot engine<br/>[Base.js]"]
  node_client["WhatsApp client<br/>[Client.js]"]
  node_handler["Message handling<br/>[Handle.js]"]
  node_message["Message model<br/>[Message.js]"]
  node_transport["Baileys adapter<br/>[index.js]"]
  node_commands["Command utilities<br/>[index.js]"]
  node_config["Bot configuration<br/>[config.js]"]
end

subgraph group_features["Bot features"]
  node_general["General commands<br/>[misc.js]"]
  node_groups["Group commands<br/>[group.js]"]
  node_admin["Bot management<br/>[manage.js]"]
  node_media["Media tools<br/>[fancy.js]"]
  node_downloads["Downloads<br/>[download.js]"]
  node_ai["AI features<br/>[ai.js]"]
  node_calendar["Calendar<br/>[calendar.js]"]
  node_schedule["Scheduling<br/>[schedule.js]"]
end

subgraph group_state["Persistent data"]
  node_personal[("Personal data<br/>[Personal.js]")]
  node_scheduledata[("Schedule data<br/>[Schedule.js]")]
  node_store[("Message store<br/>[Store.js]")]
end

subgraph group_integrations["External services"]
  node_whatsapp(("WhatsApp"))
end

node_user(("WhatsApp user"))

node_user -.->|"sends messages"| node_whatsapp
node_whatsapp -.->|"delivers events"| node_transport
node_startup -->|"starts"| node_engine
node_startup -->|"loads"| node_config
node_engine -.->|"delegates"| node_handler
node_handler -.->|"handles"| node_message
node_client -.->|"connects through"| node_transport
node_general -->|"uses"| node_commands
node_groups -->|"uses"| node_commands
node_admin -->|"uses"| node_commands
node_downloads -->|"uses"| node_commands
node_media -->|"uses"| node_commands
node_ai -.->|"uses"| node_commands
node_calendar -.->|"uses"| node_commands
node_schedule -.->|"uses"| node_commands
node_calendar -.->|"uses"| node_scheduledata
node_schedule -.->|"uses"| node_scheduledata

click node_startup "https://github.com/loki-xer/jarvis/blob/main/index.js"
click node_engine "https://github.com/loki-xer/jarvis/blob/main/lib/Base/Base.js"
click node_client "https://github.com/loki-xer/jarvis/blob/main/lib/Base/Client.js"
click node_handler "https://github.com/loki-xer/jarvis/blob/main/lib/Base/Handle.js"
click node_message "https://github.com/loki-xer/jarvis/blob/main/lib/Base/Message.js"
click node_transport "https://github.com/loki-xer/jarvis/blob/main/lib/bailys/index.js"
click node_commands "https://github.com/loki-xer/jarvis/blob/main/lib/index.js"
click node_general "https://github.com/loki-xer/jarvis/blob/main/plugins/misc.js"
click node_groups "https://github.com/loki-xer/jarvis/blob/main/plugins/group.js"
click node_admin "https://github.com/loki-xer/jarvis/blob/main/plugins/manage.js"
click node_media "https://github.com/loki-xer/jarvis/blob/main/plugins/client/fancy.js"
click node_downloads "https://github.com/loki-xer/jarvis/blob/main/plugins/download.js"
click node_ai "https://github.com/loki-xer/jarvis/blob/main/plugins/ai.js"
click node_calendar "https://github.com/loki-xer/jarvis/blob/main/plugins/calendar.js"
click node_schedule "https://github.com/loki-xer/jarvis/blob/main/plugins/schedule.js"
click node_personal "https://github.com/loki-xer/jarvis/blob/main/lib/database/Personal.js"
click node_scheduledata "https://github.com/loki-xer/jarvis/blob/main/lib/database/Schedule.js"
click node_store "https://github.com/loki-xer/jarvis/blob/main/lib/database/Store.js"
click node_config "https://github.com/loki-xer/jarvis/blob/main/config.js"

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_startup,node_engine,node_client,node_handler,node_message,node_transport,node_commands,node_config,node_user toneBlue
class node_general,node_groups,node_admin,node_media,node_downloads,node_ai,node_calendar,node_schedule toneAmber
class node_personal,node_scheduledata,node_store toneMint
class node_whatsapp toneRose
```

## Components

### Bot runtime

- [Startup](https://github.com/loki-xer/jarvis/blob/main/index.js): `index.js`
- [Bot engine](https://github.com/loki-xer/jarvis/blob/main/lib/Base/Base.js): `lib/Base/Base.js`
- [WhatsApp client](https://github.com/loki-xer/jarvis/blob/main/lib/Base/Client.js): `lib/Base/Client.js`
- [Message handling](https://github.com/loki-xer/jarvis/blob/main/lib/Base/Handle.js): `lib/Base/Handle.js`
- [Message model](https://github.com/loki-xer/jarvis/blob/main/lib/Base/Message.js): `lib/Base/Message.js`
- [Baileys adapter](https://github.com/loki-xer/jarvis/blob/main/lib/bailys/index.js): `lib/bailys/index.js`
- [Command utilities](https://github.com/loki-xer/jarvis/blob/main/lib/index.js): `lib/index.js`
- [Bot configuration](https://github.com/loki-xer/jarvis/blob/main/config.js): `config.js`

### Bot features

- [General commands](https://github.com/loki-xer/jarvis/blob/main/plugins/misc.js): `plugins/misc.js`
- [Group commands](https://github.com/loki-xer/jarvis/blob/main/plugins/group.js): `plugins/group.js`
- [Bot management](https://github.com/loki-xer/jarvis/blob/main/plugins/manage.js): `plugins/manage.js`
- [Media tools](https://github.com/loki-xer/jarvis/blob/main/plugins/client/fancy.js): `plugins/client/fancy.js`
- [Downloads](https://github.com/loki-xer/jarvis/blob/main/plugins/download.js): `plugins/download.js`
- [AI features](https://github.com/loki-xer/jarvis/blob/main/plugins/ai.js): `plugins/ai.js`
- [Calendar](https://github.com/loki-xer/jarvis/blob/main/plugins/calendar.js): `plugins/calendar.js`
- [Scheduling](https://github.com/loki-xer/jarvis/blob/main/plugins/schedule.js): `plugins/schedule.js`

### Persistent data

- [Personal data](https://github.com/loki-xer/jarvis/blob/main/lib/database/Personal.js): `lib/database/Personal.js`
- [Schedule data](https://github.com/loki-xer/jarvis/blob/main/lib/database/Schedule.js): `lib/database/Schedule.js`
- [Message store](https://github.com/loki-xer/jarvis/blob/main/lib/database/Store.js): `lib/database/Store.js`

### External services

- **WhatsApp**

### Other components

- **WhatsApp user**

## Connections

- WhatsApp user → WhatsApp: sends messages
- WhatsApp → Baileys adapter: delivers events
- Startup → Bot engine: starts (evidence: `index.js`)
- Startup → Bot configuration: loads (evidence: `index.js`)
- Bot engine → Message handling: delegates
- Message handling → Message model: handles
- WhatsApp client → Baileys adapter: connects through
- General commands → Command utilities: uses
- Group commands → Command utilities: uses (evidence: `plugins/group.js`)
- Bot management → Command utilities: uses (evidence: `plugins/manage.js`)
- Downloads → Command utilities: uses (evidence: `plugins/download.js`)
- Media tools → Command utilities: uses (evidence: `plugins/converter.js`)
- AI features → Command utilities: uses
- Calendar → Command utilities: uses
- Scheduling → Command utilities: uses
- Calendar → Schedule data: uses
- Scheduling → Schedule data: uses
