Skip to content

Commit ddbaf23

Browse files
authored
Merge pull request #3 from ricaelchiquetti/fix/evolution_baileys_7
Fix/evolution baileys 7
2 parents b640329 + 20c8a2f commit ddbaf23

18 files changed

+3169
-1524
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ SQS_REGION=
9999
# Websocket - Environment variables
100100
WEBSOCKET_ENABLED=false
101101
WEBSOCKET_GLOBAL_EVENTS=false
102+
WEBSOCKET_ALLOWED_HOSTS=127.0.0.1,::1,::ffff:127.0.0.1
102103

103104
# Pusher - Environment variables
104105
PUSHER_ENABLED=false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Repo
2+
Baileys
13
# compiled output
24
/dist
35
/node_modules

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.3.3 (develop)
2+
3+
### Testing
4+
5+
* Baileys Updates: v7.0.0-rc.3 ([Link](https://github.com/WhiskeySockets/Baileys/releases/tag/v7.0.0-rc.3))
6+
17
# 2.3.2 (2025-09-02)
28

39
### Features

CLAUDE.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Development Commands
6+
7+
### Core Commands
8+
- **Run development server**: `npm run dev:server` - Starts the server with hot reload using tsx watch
9+
- **Build project**: `npm run build` - Runs TypeScript check and builds with tsup
10+
- **Start production**: `npm run start:prod` - Runs the compiled application from dist/
11+
- **Lint code**: `npm run lint` - Runs ESLint with auto-fix on TypeScript files
12+
- **Check lint**: `npm run lint:check` - Runs ESLint without auto-fix
13+
14+
### Database Commands
15+
The project uses Prisma with support for multiple database providers (PostgreSQL, MySQL, psql_bouncer). Commands automatically use the DATABASE_PROVIDER from .env:
16+
17+
- **Generate Prisma client**: `npm run db:generate`
18+
- **Deploy migrations**: `npm run db:deploy` (Unix/Mac) or `npm run db:deploy:win` (Windows)
19+
- **Open Prisma Studio**: `npm run db:studio`
20+
- **Create new migration**: `npm run db:migrate:dev` (Unix/Mac) or `npm run db:migrate:dev:win` (Windows)
21+
22+
## Architecture Overview
23+
24+
### Project Structure
25+
Evolution API is a WhatsApp integration platform built with TypeScript and Express, supporting both Baileys (WhatsApp Web) and WhatsApp Cloud API connections.
26+
27+
### Core Components
28+
29+
**API Layer** (`src/api/`)
30+
- **Controllers**: Handle HTTP requests for different resources (instance, chat, group, sendMessage, etc.)
31+
- **Services**: Business logic layer containing auth, cache, channel, monitor, proxy services
32+
- **Routes**: RESTful API endpoints with authentication guards
33+
- **DTOs**: Data transfer objects for request/response validation using class-validator
34+
- **Repository**: Database access layer using Prisma ORM
35+
36+
**Integrations** (`src/api/integrations/`)
37+
- **Chatbot**: Supports multiple chatbot platforms (Typebot, Chatwoot, Dify, OpenAI, Flowise, N8N)
38+
- **Event**: WebSocket, RabbitMQ, Amazon SQS event systems
39+
- **Storage**: S3/Minio file storage integration
40+
- **Channel**: Multi-channel messaging support
41+
42+
**Configuration** (`src/config/`)
43+
- Environment configuration management
44+
- Database provider switching (PostgreSQL/MySQL/PgBouncer)
45+
- Multi-tenant support via DATABASE_CONNECTION_CLIENT_NAME
46+
47+
### Key Design Patterns
48+
49+
1. **Multi-Provider Database**: Uses `runWithProvider.js` to dynamically select database provider and migrations
50+
2. **Module System**: Path aliases configured in tsconfig.json (@api, @cache, @config, @utils, @validate)
51+
3. **Event-Driven**: EventEmitter2 for internal events, supports multiple external event systems
52+
4. **Instance Management**: Each WhatsApp connection is managed as an instance with memory lifecycle (DEL_INSTANCE config)
53+
54+
### Database Schema
55+
- Supports multiple providers with provider-specific schemas in `prisma/`
56+
- Separate migration folders for each provider (postgresql-migrations, mysql-migrations)
57+
- psql_bouncer uses PostgreSQL migrations but with connection pooling
58+
59+
### Authentication & Security
60+
- JWT-based authentication
61+
- API key support
62+
- Instance-specific authentication
63+
- Configurable CORS settings
64+
65+
### Messaging Features
66+
- WhatsApp Web (Baileys library) and WhatsApp Cloud API support
67+
- Message queue support (RabbitMQ, SQS)
68+
- Real-time updates via WebSocket
69+
- Media file handling with S3/Minio storage
70+
- Multiple chatbot integrations with trigger management
71+
72+
### Environment Variables
73+
Critical configuration in `.env`:
74+
- SERVER_TYPE, SERVER_PORT, SERVER_URL
75+
- DATABASE_PROVIDER and DATABASE_CONNECTION_URI
76+
- Log levels and Baileys-specific logging
77+
- Instance lifecycle management (DEL_INSTANCE)
78+
- Feature toggles for data persistence (DATABASE_SAVE_*)

docker-compose.dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ services:
55
build: .
66
restart: always
77
ports:
8-
- 8080:8080
8+
- 9000:9000
99
volumes:
1010
- evolution_instances:/evolution/instances
1111
networks:
1212
- evolution-net
1313
env_file:
1414
- .env
1515
expose:
16-
- 8080
16+
- 9000
1717

1818
volumes:
1919
evolution_instances:

0 commit comments

Comments
 (0)