# orkestral/venom architecture

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

- Interactive diagram: https://gitdiagram.com/orkestral/venom
- Repository: https://github.com/orkestral/venom

## Overview

Venom is a Node.js WhatsApp Web automation library. A consumer calls `create`, which merges configuration, launches and prepares a Puppeteer page, handles QR authentication, injects the browser-side WAPI, and returns a client for messaging, retrieval, account/group operations, and events. The graph separates those user-facing domains while retaining browser setup, authentication, and event bridging as lifecycle stages. The sampled client and browser modules are partial; README-described capabilities are represented at the client boundary, without inferring unsampled internal calls.

Main entry points: [`src/core/client.ts`](https://github.com/orkestral/venom/blob/master/src/core/client.ts) (Venom client), [`src/core/initializer.ts`](https://github.com/orkestral/venom/blob/master/src/core/initializer.ts) (Client creation), [`src/index.ts`](https://github.com/orkestral/venom/blob/master/src/index.ts) (Public exports), [`src/utils/logger.ts`](https://github.com/orkestral/venom/blob/master/src/utils/logger.ts) (Session logger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Client lifecycle"]
  node_entry["Public exports<br/>[index.ts]"]
  node_create["Client creation<br/>[initializer.ts]"]
  node_browser["Browser and page<br/>[browser.ts]"]
  node_auth["QR authentication<br/>[initializer.ts]"]
  node_wapi["Browser WAPI<br/>[browser.ts]"]
  node_events["Event bridge<br/>[initializer.ts]"]
end

subgraph group_messaging["Messaging and data"]
  node_client["Venom client<br/>[client.ts]"]
  node_send["Message sending<br/>[client.ts]"]
  node_retrieve["Data retrieval<br/>[client.ts]"]
  node_event_api["Client events<br/>[client.ts]"]
end

subgraph group_management["WhatsApp management"]
  node_group_ops["Group operations<br/>[client.ts]"]
  node_profile["Profile and device<br/>[client.ts]"]
  node_chat_ops["Chat operations<br/>[client.ts]"]
  node_sessions["Session controls<br/>[client.ts]"]
end

subgraph group_support["Shared support"]
  node_configuration["Configuration<br/>[config.ts]"]
  node_logger["Session logger<br/>[logger.ts]"]
end

node_consumer(("Library consumer"))
node_whatsapp["WhatsApp Web"]

node_consumer -->|"imports"| node_entry
node_entry -->|"exports"| node_create
node_entry -->|"exports"| node_client
node_consumer -->|"creates client"| node_create
node_create -->|"merges defaults"| node_configuration
node_create -->|"launches and initializes"| node_browser
node_create -->|"handles login"| node_auth
node_auth -->|"reads QR state"| node_whatsapp
node_create -->|"injects"| node_wapi
node_wapi -->|"uses page modules"| node_whatsapp
node_create -->|"attaches listeners"| node_events
node_events -->|"emits events"| node_client
node_create -->|"constructs"| node_client
node_client -->|"provides"| node_send
node_client -->|"provides"| node_retrieve
node_client -->|"provides"| node_event_api
node_client -->|"provides"| node_group_ops
node_client -->|"provides"| node_profile
node_client -->|"provides"| node_chat_ops
node_client -->|"provides"| node_sessions
node_send -->|"evaluates WAPI calls"| node_whatsapp
node_retrieve -->|"evaluates WAPI calls"| node_whatsapp
node_group_ops -->|"evaluates actions"| node_whatsapp
node_profile -->|"evaluates WAPI calls"| node_whatsapp
node_chat_ops -->|"evaluates WAPI calls"| node_whatsapp
node_sessions -->|"evaluates commands"| node_whatsapp
node_browser -->|"gets session logger"| node_logger
node_client -->|"gets session logger"| node_logger
node_create -->|"gets session logger"| node_logger

click node_entry "https://github.com/orkestral/venom/blob/master/src/index.ts"
click node_create "https://github.com/orkestral/venom/blob/master/src/core/initializer.ts"
click node_configuration "https://github.com/orkestral/venom/blob/master/src/config.ts"
click node_browser "https://github.com/orkestral/venom/blob/master/src/controllers/browser.ts"
click node_auth "https://github.com/orkestral/venom/blob/master/src/core/initializer.ts"
click node_wapi "https://github.com/orkestral/venom/blob/master/src/controllers/browser.ts"
click node_events "https://github.com/orkestral/venom/blob/master/src/core/initializer.ts"
click node_client "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_send "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_retrieve "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_event_api "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_group_ops "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_profile "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_chat_ops "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_sessions "https://github.com/orkestral/venom/blob/master/src/core/client.ts"
click node_logger "https://github.com/orkestral/venom/blob/master/src/utils/logger.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_entry,node_create,node_browser,node_auth,node_wapi,node_events toneBlue
class node_client,node_send,node_retrieve,node_event_api toneAmber
class node_group_ops,node_profile,node_chat_ops,node_sessions toneMint
class node_configuration,node_logger toneRose
class node_consumer,node_whatsapp toneIndigo
```

## Components

### Client lifecycle

- [Public exports](https://github.com/orkestral/venom/blob/master/src/index.ts): `src/index.ts`
- [Client creation](https://github.com/orkestral/venom/blob/master/src/core/initializer.ts): `src/core/initializer.ts`
- [Browser and page](https://github.com/orkestral/venom/blob/master/src/controllers/browser.ts): `src/controllers/browser.ts`
- [QR authentication](https://github.com/orkestral/venom/blob/master/src/core/initializer.ts): `src/core/initializer.ts`
- [Browser WAPI](https://github.com/orkestral/venom/blob/master/src/controllers/browser.ts): `src/controllers/browser.ts`
- [Event bridge](https://github.com/orkestral/venom/blob/master/src/core/initializer.ts): `src/core/initializer.ts`

### Messaging and data

- [Venom client](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Message sending](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Data retrieval](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Client events](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`

### WhatsApp management

- [Group operations](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Profile and device](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Chat operations](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`
- [Session controls](https://github.com/orkestral/venom/blob/master/src/core/client.ts): `src/core/client.ts`

### Shared support

- [Configuration](https://github.com/orkestral/venom/blob/master/src/config.ts): `src/config.ts`
- [Session logger](https://github.com/orkestral/venom/blob/master/src/utils/logger.ts): `src/utils/logger.ts`

### Other components

- **Library consumer**
- **WhatsApp Web**

## Connections

- Library consumer → Public exports: imports (evidence: `README.md`)
- Public exports → Client creation: exports (evidence: `src/index.ts`)
- Public exports → Venom client: exports (evidence: `src/index.ts`)
- Library consumer → Client creation: creates client (evidence: `README.md`)
- Client creation → Configuration: merges defaults (evidence: `src/core/initializer.ts`)
- Client creation → Browser and page: launches and initializes (evidence: `src/core/initializer.ts`)
- Client creation → QR authentication: handles login (evidence: `src/core/initializer.ts`)
- QR authentication → WhatsApp Web: reads QR state (evidence: `src/core/initializer.ts`)
- Client creation → Browser WAPI: injects (evidence: `src/core/initializer.ts`)
- Browser WAPI → WhatsApp Web: uses page modules (evidence: `src/controllers/browser.ts`)
- Client creation → Event bridge: attaches listeners (evidence: `src/core/initializer.ts`)
- Event bridge → Venom client: emits events (evidence: `src/core/initializer.ts`)
- Client creation → Venom client: constructs (evidence: `src/core/initializer.ts`)
- Venom client → Message sending: provides (evidence: `README.md`)
- Venom client → Data retrieval: provides (evidence: `README.md`)
- Venom client → Client events: provides (evidence: `README.md`)
- Venom client → Group operations: provides (evidence: `README.md`)
- Venom client → Profile and device: provides (evidence: `README.md`)
- Venom client → Chat operations: provides (evidence: `README.md`)
- Venom client → Session controls: provides (evidence: `src/core/client.ts`)
- Message sending → WhatsApp Web: evaluates WAPI calls (evidence: `src/core/client.ts`)
- Data retrieval → WhatsApp Web: evaluates WAPI calls (evidence: `src/core/client.ts`)
- Group operations → WhatsApp Web: evaluates actions (evidence: `src/core/client.ts`)
- Profile and device → WhatsApp Web: evaluates WAPI calls (evidence: `src/core/client.ts`)
- Chat operations → WhatsApp Web: evaluates WAPI calls (evidence: `src/core/client.ts`)
- Session controls → WhatsApp Web: evaluates commands (evidence: `src/core/client.ts`)
- Browser and page → Session logger: gets session logger (evidence: `src/controllers/browser.ts`)
- Venom client → Session logger: gets session logger (evidence: `src/core/client.ts`)
- Client creation → Session logger: gets session logger (evidence: `src/core/initializer.ts`)
