# webyter/autoviewbot architecture

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

- Interactive diagram: https://gitdiagram.com/webyter/autoviewbot
- Repository: https://github.com/webyter/autoviewbot

## Overview

AutoViewer is a multi-user WhatsApp automation platform: users register and sign in to a web dashboard, pair a WhatsApp account by QR or code, configure features, and run an individual bot worker. The manager handles accounts, sessions, persistence, and worker lifecycle; the worker handles WhatsApp events and commands, including status automation, message recovery, group tools, and AI replies. The graph preserves README capabilities and indexed core modules. Some worker, route, and integration wiring is documented or indexed but not visible in the excerpts, so those links are dashed where unverified.

Main entry points: [`bot_worker.js`](https://github.com/webyter/autoviewbot/blob/master/bot_worker.js) (Bot Worker), [`autoviewer.js`](https://github.com/webyter/autoviewbot/blob/master/autoviewer.js) (Web Manager), [`commands.js`](https://github.com/webyter/autoviewbot/blob/master/commands.js) (Bot Commands), [`lib/groqAI.js`](https://github.com/webyter/autoviewbot/blob/master/lib/groqAI.js) (AI and Transcription)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard and API"]
  node_dashboard["User Dashboard<br/>[app.js]"]
  node_admin_ui["Admin Dashboard<br/>[admin.js]"]
  node_registration_ui["Registration UI<br/>[register.js]"]
end

subgraph group_management["Account Management"]
  node_manager["Web Manager<br/>[autoviewer.js]"]
  node_compat_api["Compatibility API<br/>[compat-api.js]"]
  node_db[("User Database<br/>[db.js]")]
  node_invites["Invite Codes<br/>[invites.js]"]
  node_session_store[("Web Sessions<br/>[session-store.js]")]
  node_audit["Audit Logging<br/>[audit.js]"]
  node_backup["Backup<br/>[backup.js]"]
  node_keepalive["Keepalive<br/>[keepalive.js]"]
  node_render_config["Runtime Configuration<br/>[render-config.js]"]
  node_config["Environment Config<br/>[config.js]"]
end

subgraph group_automation["WhatsApp Automation"]
  node_worker["Bot Worker<br/>[bot_worker.js]"]
  node_commands["Bot Commands<br/>[commands.js]"]
  node_message_store[("Message Store<br/>[store.js]")]
  node_media["Media Recovery<br/>[media.js]"]
  node_quoted_media["Quoted Media<br/>[quoted-media.js]"]
  node_forward["Message Forwarding<br/>[forward.js]"]
  node_status_features["Status Automation<br/>[status-post.js]"]
  node_status_content["Status Content<br/>[status-content.js]"]
  node_status_reaction["Status Reactions<br/>[status-reaction.js]"]
  node_status_ack["Status Acknowledgement<br/>[status-ack.js]"]
  node_session_heal["Session Healing<br/>[session-heal.js]"]
  node_presence["Presence Diagnostics"]
  node_creds_guard["Credential Guard"]
  node_notification_presence["Notification Presence"]
end

subgraph group_integrations["External Services"]
  node_ai["AI and Transcription<br/>[groqAI.js]"]
end

node_visitor(("Dashboard User"))
node_whatsapp(("WhatsApp"))
node_groq(("Groq API"))

node_visitor -->|"uses"| node_dashboard
node_visitor -->|"registers"| node_registration_ui
node_dashboard -.->|"calls dashboard API"| node_manager
node_admin_ui -.->|"calls admin API"| node_manager
node_registration_ui -.->|"submits registration"| node_manager
node_manager -->|"reads and writes"| node_db
node_manager -.->|"stores sessions"| node_session_store
node_manager -->|"uses invites"| node_invites
node_invites -->|"shares write queue"| node_db
node_manager -->|"registers routes"| node_compat_api
node_manager -->|"records events"| node_audit
node_manager -->|"uses backups"| node_backup
node_manager -->|"starts keepalive"| node_keepalive
node_manager -->|"loads configuration"| node_render_config
node_manager -.->|"starts per-user worker"| node_worker
node_worker -.->|"connects via Baileys"| node_whatsapp
node_worker -->|"dispatches commands"| node_commands
node_worker -->|"uses message storage"| node_message_store
node_worker -->|"uses AI"| node_ai
node_worker -->|"uses media recovery"| node_media
node_worker -->|"uses forwarding"| node_forward
node_worker -->|"uses diagnostics"| node_presence
node_worker -->|"uses credential guard"| node_creds_guard
node_worker -->|"uses session healing"| node_session_heal
node_worker -->|"uses acknowledgements"| node_status_ack
node_worker -->|"uses status content"| node_status_content
node_worker -->|"uses status posting"| node_status_features
node_worker -->|"uses reactions"| node_status_reaction
node_worker -->|"uses presence settings"| node_notification_presence
node_commands -->|"uses media tools"| node_media
node_commands -->|"uses quoted media"| node_quoted_media
node_quoted_media -->|"delegates downloads"| node_media
node_ai -->|"reads defaults"| node_config
node_ai -->|"requests chat and transcription"| node_groq

click node_dashboard "https://github.com/webyter/autoviewbot/blob/master/public/app.js"
click node_admin_ui "https://github.com/webyter/autoviewbot/blob/master/public/admin.js"
click node_registration_ui "https://github.com/webyter/autoviewbot/blob/master/public/register.js"
click node_manager "https://github.com/webyter/autoviewbot/blob/master/autoviewer.js"
click node_compat_api "https://github.com/webyter/autoviewbot/blob/master/lib/compat-api.js"
click node_db "https://github.com/webyter/autoviewbot/blob/master/lib/db.js"
click node_invites "https://github.com/webyter/autoviewbot/blob/master/lib/invites.js"
click node_session_store "https://github.com/webyter/autoviewbot/blob/master/lib/session-store.js"
click node_audit "https://github.com/webyter/autoviewbot/blob/master/lib/audit.js"
click node_backup "https://github.com/webyter/autoviewbot/blob/master/lib/backup.js"
click node_keepalive "https://github.com/webyter/autoviewbot/blob/master/lib/keepalive.js"
click node_render_config "https://github.com/webyter/autoviewbot/blob/master/lib/render-config.js"
click node_worker "https://github.com/webyter/autoviewbot/blob/master/bot_worker.js"
click node_commands "https://github.com/webyter/autoviewbot/blob/master/commands.js"
click node_message_store "https://github.com/webyter/autoviewbot/blob/master/lib/store.js"
click node_media "https://github.com/webyter/autoviewbot/blob/master/lib/media.js"
click node_quoted_media "https://github.com/webyter/autoviewbot/blob/master/lib/quoted-media.js"
click node_forward "https://github.com/webyter/autoviewbot/blob/master/lib/forward.js"
click node_status_features "https://github.com/webyter/autoviewbot/blob/master/lib/status-post.js"
click node_status_content "https://github.com/webyter/autoviewbot/blob/master/lib/status-content.js"
click node_status_reaction "https://github.com/webyter/autoviewbot/blob/master/lib/status-reaction.js"
click node_status_ack "https://github.com/webyter/autoviewbot/blob/master/lib/status-ack.js"
click node_session_heal "https://github.com/webyter/autoviewbot/blob/master/lib/session-heal.js"
click node_presence "https://github.com/webyter/autoviewbot/blob/master/lib/presence-diagnostics.js"
click node_creds_guard "https://github.com/webyter/autoviewbot/blob/master/lib/creds-presence-guard.js"
click node_notification_presence "https://github.com/webyter/autoviewbot/blob/master/lib/notification-presence.js"
click node_ai "https://github.com/webyter/autoviewbot/blob/master/lib/groqAI.js"
click node_config "https://github.com/webyter/autoviewbot/blob/master/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_dashboard,node_admin_ui,node_registration_ui,node_visitor toneBlue
class node_manager,node_compat_api,node_db,node_invites,node_session_store,node_audit,node_backup,node_keepalive,node_render_config,node_config toneAmber
class node_worker,node_commands,node_message_store,node_media,node_quoted_media,node_forward,node_status_features,node_status_content,node_status_reaction,node_status_ack,node_session_heal,node_presence,node_creds_guard,node_notification_presence,node_groq toneMint
class node_ai toneRose
class node_whatsapp toneIndigo
```

## Components

### Dashboard and API

- [User Dashboard](https://github.com/webyter/autoviewbot/blob/master/public/app.js): `public/app.js`
- [Admin Dashboard](https://github.com/webyter/autoviewbot/blob/master/public/admin.js): `public/admin.js`
- [Registration UI](https://github.com/webyter/autoviewbot/blob/master/public/register.js): `public/register.js`

### Account Management

- [Web Manager](https://github.com/webyter/autoviewbot/blob/master/autoviewer.js): `autoviewer.js`
- [Compatibility API](https://github.com/webyter/autoviewbot/blob/master/lib/compat-api.js): `lib/compat-api.js`
- [User Database](https://github.com/webyter/autoviewbot/blob/master/lib/db.js): `lib/db.js`
- [Invite Codes](https://github.com/webyter/autoviewbot/blob/master/lib/invites.js): `lib/invites.js`
- [Web Sessions](https://github.com/webyter/autoviewbot/blob/master/lib/session-store.js): `lib/session-store.js`
- [Audit Logging](https://github.com/webyter/autoviewbot/blob/master/lib/audit.js): `lib/audit.js`
- [Backup](https://github.com/webyter/autoviewbot/blob/master/lib/backup.js): `lib/backup.js`
- [Keepalive](https://github.com/webyter/autoviewbot/blob/master/lib/keepalive.js): `lib/keepalive.js`
- [Runtime Configuration](https://github.com/webyter/autoviewbot/blob/master/lib/render-config.js): `lib/render-config.js`
- [Environment Config](https://github.com/webyter/autoviewbot/blob/master/config.js): `config.js`

### WhatsApp Automation

- [Bot Worker](https://github.com/webyter/autoviewbot/blob/master/bot_worker.js): `bot_worker.js`
- [Bot Commands](https://github.com/webyter/autoviewbot/blob/master/commands.js): `commands.js`
- [Message Store](https://github.com/webyter/autoviewbot/blob/master/lib/store.js): `lib/store.js`
- [Media Recovery](https://github.com/webyter/autoviewbot/blob/master/lib/media.js): `lib/media.js`
- [Quoted Media](https://github.com/webyter/autoviewbot/blob/master/lib/quoted-media.js): `lib/quoted-media.js`
- [Message Forwarding](https://github.com/webyter/autoviewbot/blob/master/lib/forward.js): `lib/forward.js`
- [Status Automation](https://github.com/webyter/autoviewbot/blob/master/lib/status-post.js): `lib/status-post.js`
- [Status Content](https://github.com/webyter/autoviewbot/blob/master/lib/status-content.js): `lib/status-content.js`
- [Status Reactions](https://github.com/webyter/autoviewbot/blob/master/lib/status-reaction.js): `lib/status-reaction.js`
- [Status Acknowledgement](https://github.com/webyter/autoviewbot/blob/master/lib/status-ack.js): `lib/status-ack.js`
- [Session Healing](https://github.com/webyter/autoviewbot/blob/master/lib/session-heal.js): `lib/session-heal.js`
- [Presence Diagnostics](https://github.com/webyter/autoviewbot/blob/master/lib/presence-diagnostics.js): `lib/presence-diagnostics.js`
- [Credential Guard](https://github.com/webyter/autoviewbot/blob/master/lib/creds-presence-guard.js): `lib/creds-presence-guard.js`
- [Notification Presence](https://github.com/webyter/autoviewbot/blob/master/lib/notification-presence.js): `lib/notification-presence.js`

### External Services

- [AI and Transcription](https://github.com/webyter/autoviewbot/blob/master/lib/groqAI.js): `lib/groqAI.js`

### Other components

- **Dashboard User**
- **WhatsApp**
- **Groq API**

## Connections

- Dashboard User → User Dashboard: uses (evidence: `README.md`)
- Dashboard User → Registration UI: registers (evidence: `README.md`)
- User Dashboard → Web Manager: calls dashboard API
- Admin Dashboard → Web Manager: calls admin API
- Registration UI → Web Manager: submits registration
- Web Manager → User Database: reads and writes (evidence: `autoviewer.js`)
- Web Manager → Web Sessions: stores sessions (evidence: `autoviewer.js`)
- Web Manager → Invite Codes: uses invites (evidence: `autoviewer.js`)
- Invite Codes → User Database: shares write queue (evidence: `lib/invites.js`)
- Web Manager → Compatibility API: registers routes (evidence: `autoviewer.js`)
- Web Manager → Audit Logging: records events (evidence: `autoviewer.js`)
- Web Manager → Backup: uses backups (evidence: `autoviewer.js`)
- Web Manager → Keepalive: starts keepalive (evidence: `autoviewer.js`)
- Web Manager → Runtime Configuration: loads configuration (evidence: `autoviewer.js`)
- Web Manager → Bot Worker: starts per-user worker
- Bot Worker → WhatsApp: connects via Baileys
- Bot Worker → Bot Commands: dispatches commands (evidence: `bot_worker.js`)
- Bot Worker → Message Store: uses message storage (evidence: `bot_worker.js`)
- Bot Worker → AI and Transcription: uses AI (evidence: `bot_worker.js`)
- Bot Worker → Media Recovery: uses media recovery (evidence: `bot_worker.js`)
- Bot Worker → Message Forwarding: uses forwarding (evidence: `bot_worker.js`)
- Bot Worker → Presence Diagnostics: uses diagnostics (evidence: `bot_worker.js`)
- Bot Worker → Credential Guard: uses credential guard (evidence: `bot_worker.js`)
- Bot Worker → Session Healing: uses session healing (evidence: `bot_worker.js`)
- Bot Worker → Status Acknowledgement: uses acknowledgements (evidence: `bot_worker.js`)
- Bot Worker → Status Content: uses status content (evidence: `bot_worker.js`)
- Bot Worker → Status Automation: uses status posting (evidence: `bot_worker.js`)
- Bot Worker → Status Reactions: uses reactions (evidence: `bot_worker.js`)
- Bot Worker → Notification Presence: uses presence settings (evidence: `bot_worker.js`)
- Bot Commands → Media Recovery: uses media tools (evidence: `commands.js`)
- Bot Commands → Quoted Media: uses quoted media (evidence: `commands.js`)
- Quoted Media → Media Recovery: delegates downloads (evidence: `lib/quoted-media.js`)
- AI and Transcription → Environment Config: reads defaults (evidence: `lib/groqAI.js`)
- AI and Transcription → Groq API: requests chat and transcription (evidence: `lib/groqAI.js`)
