This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Venom is a high-performance WhatsApp bot library built with TypeScript and JavaScript. It uses Puppeteer to automate WhatsApp Web and provides an extensive API for creating WhatsApp bots with features like sending messages, media, managing groups, and handling various WhatsApp events.
npm run build- Full build (includes WAPI, middleware, counter, and TypeScript compilation)npm run build:wapi- Build WhatsApp API functions (webpack)npm run build:middleware- Build middleware layernpm run build:venom- Compile TypeScript to JavaScriptnpm run build:counter- Build counter module
npm run start- Build and run the applicationnpm run watch- Watch mode for developmentnpm test- Run tests (executes ./test/index.js)npm run test:app- Run the example application
npm run lint- Run ESLint on both TypeScript and JavaScript filesnpm run lint:fix- Auto-fix linting issuesnpm run lint:ts- Lint TypeScript files onlynpm run lint:js- Lint JavaScript files onlynpm run knip- Run dependency analysis with knip
npm run generate-api-docs- Generate API documentation with TypeDoc
-
API Layer (
src/api/)layers/- Functionality layers that compose the WhatsApp clientsender.layer.ts- Message sending functionalitylistener.layer.ts- Event listeners and message handlersgroup.layer.ts- Group management operationsprofile.layer.ts- Profile and status operationscontrols.layer.ts- Connection and session controlretriever.layer.ts- Data retrieval methods
model/- TypeScript interfaces and data modelshelpers/- Utility functions for encryption, QR codes, etc.
-
WAPI Layer (
src/lib/wapi/)- Browser-injected JavaScript functions that interact directly with WhatsApp Web
- Contains the core WhatsApp Web API manipulation logic
- Built with webpack and injected into the Puppeteer browser context
-
Controllers (
src/controllers/)initializer.ts- Main entry point for creating WhatsApp sessionsbrowser.ts- Puppeteer browser managementauth.ts- Authentication and QR code handling
-
Configuration (
src/config/)- Browser and Puppeteer configuration
- Session management options
The project uses a multi-step build process:
- WAPI functions are bundled with webpack
- Middleware is compiled separately
- TypeScript code is compiled to JavaScript
- All outputs go to the
dist/directory
- Layer Architecture: Functionality is organized in layers that build upon each other
- Event-Driven: Heavy use of event emitters for WhatsApp events
- Promise-Based API: All async operations return promises
- Session Management: Supports multiple concurrent WhatsApp sessions
- WAPI functions in
src/lib/wapi/functions/are JavaScript files that get injected into the browser - These functions directly manipulate WhatsApp Web's internal objects
- Changes to WAPI functions require rebuilding with
npm run build:wapi
- Target: ESNext with CommonJS modules
- Output directory:
./dist - Declaration files are generated
- Source maps are enabled
- Main test file:
test/index.js - Example application:
app.js - No formal test framework - tests are basic scripts
- Sessions are stored in a
tokensfolder by default - Each session maintains its browser state for persistence
- QR codes are only needed for initial authentication
Currently on dependency-scan branch with extensive modifications to project files.