Skip to content

Commit 5ff3945

Browse files
committed
v0.0.1: MultiWA — Open Source WhatsApp Business API Gateway
Features: - Multi-engine architecture (whatsapp-web.js, Baileys) - Admin Dashboard (Next.js 14) with real-time monitoring - Visual Automation Builder (drag & drop) - Knowledge Base AI (OpenAI, Google AI) - Broadcast, Contacts, Templates management - Webhook system & API key management - Official SDKs (TypeScript, Python, PHP) - BullMQ Worker (message, automation, webhook, scheduled queues) - Docker production deployment with CI/CD - GDPR compliance & Plugin system - Auto GitHub Release & Docker image publishing workflows
0 parents  commit 5ff3945

File tree

586 files changed

+71535
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

586 files changed

+71535
-0
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
**/node_modules
3+
**/.next
4+
**/dist
5+
.git
6+
.pnpm-store
7+
.turbo
8+
sessions
9+
*.md
10+
!**/README.md
11+
.vscode
12+
.idea

.env.example

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# MultiWA v1.0.0 - Environment Configuration
2+
# Copy to .env and configure for your environment
3+
4+
# ==============================================
5+
# DATABASE
6+
# ==============================================
7+
DATABASE_URL="postgresql://multiwa:multiwa123@localhost:5432/multiwa_gateway?schema=public"
8+
9+
# ==============================================
10+
# REDIS (Cache + Queue)
11+
# ==============================================
12+
REDIS_URL="redis://localhost:6379"
13+
14+
# ==============================================
15+
# API SERVICE
16+
# ==============================================
17+
API_PORT=3000
18+
API_HOST=0.0.0.0
19+
CORS_ORIGINS="http://localhost:3001,http://localhost:3000"
20+
21+
# ==============================================
22+
# AUTHENTICATION
23+
# ==============================================
24+
JWT_SECRET="your-super-secret-jwt-key-change-in-production"
25+
JWT_EXPIRES_IN="7d"
26+
JWT_REFRESH_EXPIRES_IN="30d"
27+
28+
# ==============================================
29+
# ADMIN DASHBOARD
30+
# ==============================================
31+
ADMIN_PORT=3001
32+
NEXT_PUBLIC_API_URL="http://localhost:3000"
33+
34+
# ==============================================
35+
# ENVIRONMENT
36+
# ==============================================
37+
NODE_ENV=development
38+
39+
# ==============================================
40+
# WHATSAPP ENGINE
41+
# ==============================================
42+
# Options: whatsapp-web-js, baileys
43+
DEFAULT_ENGINE=whatsapp-web-js
44+
45+
# Session storage directory
46+
SESSIONS_DIR=./sessions
47+
48+
# Puppeteer options (for whatsapp-web-js)
49+
PUPPETEER_HEADLESS=true
50+
PUPPETEER_NO_SANDBOX=false
51+
52+
# ==============================================
53+
# WEBHOOKS
54+
# ==============================================
55+
WEBHOOK_TIMEOUT_MS=30000
56+
WEBHOOK_RETRY_ATTEMPTS=3
57+
WEBHOOK_RETRY_DELAY_MS=5000
58+
59+
# ==============================================
60+
# STORAGE (Media files)
61+
# ==============================================
62+
STORAGE_TYPE=local # local or s3
63+
STORAGE_PATH=./media
64+
65+
# S3/MinIO (if STORAGE_TYPE=s3)
66+
S3_ENDPOINT=http://localhost:9000
67+
S3_ACCESS_KEY=minio
68+
S3_SECRET_KEY=minio123
69+
S3_BUCKET=multiwa-media

.env.production.example

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# MultiWA Gateway - Production Environment
2+
# Copy this to .env.production and fill in your values
3+
4+
# ─── Database ─────────────────────────────────────
5+
DATABASE_URL=postgresql://multiwa:CHANGE_ME@postgres:5432/multiwa
6+
7+
# ─── Redis ────────────────────────────────────────
8+
REDIS_URL=redis://:CHANGE_ME@redis:6379
9+
REDIS_PASSWORD=CHANGE_ME
10+
11+
# ─── Security (REQUIRED - generate with: openssl rand -base64 32) ───
12+
JWT_SECRET=CHANGE_ME
13+
JWT_REFRESH_SECRET=CHANGE_ME
14+
15+
# Encryption key for settings at rest (generate with: openssl rand -hex 32)
16+
ENCRYPTION_KEY=CHANGE_ME
17+
18+
# ─── API ──────────────────────────────────────────
19+
API_PORT=3000
20+
API_HOST=0.0.0.0
21+
NODE_ENV=production
22+
CORS_ORIGINS=https://wa.yourdomain.com
23+
24+
# ─── Admin Dashboard ─────────────────────────────
25+
ADMIN_URL=https://wa.yourdomain.com
26+
API_URL=https://api.yourdomain.com
27+
28+
# ─── S3 / MinIO Storage ──────────────────────────
29+
S3_ENDPOINT=http://minio:9000
30+
S3_PORT=9000
31+
S3_USE_SSL=false
32+
S3_ACCESS_KEY=CHANGE_ME
33+
S3_SECRET_KEY=CHANGE_ME
34+
S3_BUCKET=multiwa
35+
S3_REGION=us-east-1
36+
37+
# ─── WhatsApp Engine ─────────────────────────────
38+
WHATSAPP_ENGINE=whatsapp-web.js
39+
CHROMIUM_PATH=/usr/bin/chromium
40+
41+
# ─── Database Credentials (for docker-compose) ───
42+
DB_USER=multiwa
43+
DB_PASSWORD=CHANGE_ME
44+
DB_NAME=multiwa
45+
46+
# ─── Nginx (for docker-compose.production.yml) ───
47+
HTTP_PORT=80
48+
HTTPS_PORT=443
49+
50+
# ─── Rate Limiting ───────────────────────────────
51+
RATE_LIMIT_SHORT=10/1s
52+
RATE_LIMIT_MEDIUM=100/1m
53+
RATE_LIMIT_LONG=1000/1h
54+
55+
# ─── Logging ─────────────────────────────────────
56+
LOG_LEVEL=warn
57+
58+
# ─── Optional: Email Notifications ───────────────
59+
# SMTP_HOST=smtp.gmail.com
60+
# SMTP_PORT=587
61+
# SMTP_SECURE=false
62+
# SMTP_USER=your@email.com
63+
# SMTP_PASS=your-app-password
64+
# SMTP_FROM=noreply@yourdomain.com
65+
66+
# ─── Optional: Sentry ────────────────────────────
67+
# SENTRY_DSN=https://key@sentry.io/project

.github/FUNDING.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# These are supported funding model platforms
2+
3+
github: [ribato22]
4+
# ko_fi: # Replace with your Ko-fi username
5+
# buy_me_a_coffee: # Replace with your Buy Me a Coffee username
6+
# custom: ["https://your-donation-link.com"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help us improve
4+
title: "[BUG] "
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
A clear and concise description of the bug.
11+
12+
## Steps to Reproduce
13+
1. Go to '...'
14+
2. Click on '...'
15+
3. See error
16+
17+
## Expected Behavior
18+
What you expected to happen.
19+
20+
## Actual Behavior
21+
What actually happened.
22+
23+
## Environment
24+
- **OS**: [e.g., Ubuntu 22.04, macOS 14]
25+
- **Node.js**: [e.g., 20.x]
26+
- **Docker**: [e.g., 24.x]
27+
- **Browser**: [e.g., Chrome 122]
28+
- **WhatsApp Engine**: [e.g., whatsapp-web.js]
29+
30+
## Screenshots / Logs
31+
If applicable, add screenshots or relevant log output.
32+
33+
## Additional Context
34+
Any other context about the problem.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for MultiWA
4+
title: "[FEATURE] "
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem
10+
A clear description of the problem this feature would solve.
11+
12+
## Proposed Solution
13+
Describe the solution you'd like.
14+
15+
## Alternatives Considered
16+
Any alternative solutions or features you've considered.
17+
18+
## Additional Context
19+
Any other context, mockups, or screenshots about the feature request.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Description
2+
Brief description of what this PR does.
3+
4+
## Type of Change
5+
- [ ] 🐛 Bug fix
6+
- [ ] ✨ New feature
7+
- [ ] 💥 Breaking change
8+
- [ ] 📝 Documentation update
9+
- [ ] 🔧 Refactor
10+
11+
## Changes Made
12+
-
13+
14+
## Testing
15+
- [ ] Tested locally with `pnpm dev`
16+
- [ ] Tested with Docker (`docker compose -f docker-compose.dev.yml up`)
17+
- [ ] Added/updated tests
18+
- [ ] Existing tests pass
19+
20+
## Screenshots
21+
If applicable, add screenshots of the changes.
22+
23+
## Checklist
24+
- [ ] Code follows the project's style guidelines
25+
- [ ] Self-review of the code completed
26+
- [ ] Documentation updated (if needed)
27+
- [ ] No new warnings introduced

.github/workflows/ci.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, production]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-build:
11+
name: Lint, Typecheck & Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: pnpm/action-setup@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: 'pnpm'
23+
24+
- name: Install dependencies
25+
run: pnpm install --frozen-lockfile
26+
27+
- name: Generate Prisma Client
28+
run: pnpm --filter database exec prisma generate
29+
30+
- name: Build Database package
31+
run: pnpm --filter database build
32+
33+
- name: Build Engines package
34+
run: pnpm --filter engines build
35+
36+
- name: Build API
37+
run: pnpm --filter api build
38+
39+
- name: Build Worker
40+
run: pnpm --filter worker build
41+
42+
- name: Build Admin
43+
run: pnpm --filter admin build
44+
env:
45+
NEXT_PUBLIC_API_URL: http://localhost:3000
46+
47+
docker-build:
48+
name: Docker Build Test
49+
runs-on: ubuntu-latest
50+
needs: lint-and-build
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Build API Image
56+
run: docker build -f docker/Dockerfile.api -t multiwa-api:test .
57+
58+
- name: Build Worker Image
59+
run: docker build -f docker/Dockerfile.worker -t multiwa-worker:test .
60+
61+
- name: Build Admin Image
62+
run: |
63+
docker build -f docker/Dockerfile.admin \
64+
--build-arg NEXT_PUBLIC_API_URL=http://localhost:3000 \
65+
-t multiwa-admin:test .
66+
67+
test:
68+
name: Tests
69+
runs-on: ubuntu-latest
70+
needs: lint-and-build
71+
72+
services:
73+
postgres:
74+
image: postgres:16-alpine
75+
env:
76+
POSTGRES_USER: test
77+
POSTGRES_PASSWORD: test
78+
POSTGRES_DB: multiwa_test
79+
options: >-
80+
--health-cmd pg_isready
81+
--health-interval 10s
82+
--health-timeout 5s
83+
--health-retries 5
84+
ports:
85+
- 5432:5432
86+
87+
redis:
88+
image: redis:7-alpine
89+
options: >-
90+
--health-cmd "redis-cli ping"
91+
--health-interval 10s
92+
--health-timeout 5s
93+
--health-retries 5
94+
ports:
95+
- 6379:6379
96+
97+
steps:
98+
- uses: actions/checkout@v4
99+
100+
- uses: pnpm/action-setup@v4
101+
102+
- uses: actions/setup-node@v4
103+
with:
104+
node-version: 20
105+
cache: 'pnpm'
106+
107+
- name: Install dependencies
108+
run: pnpm install --frozen-lockfile
109+
110+
- name: Generate Prisma Client
111+
run: pnpm --filter database exec prisma generate
112+
113+
- name: Build Database package
114+
run: pnpm --filter database build
115+
116+
- name: Build Engines package
117+
run: pnpm --filter engines build
118+
119+
- name: Run API tests
120+
run: pnpm --filter api test -- --run
121+
env:
122+
DATABASE_URL: postgresql://test:test@localhost:5432/multiwa_test
123+
REDIS_URL: redis://localhost:6379
124+
JWT_SECRET: test-jwt-secret
125+
JWT_REFRESH_SECRET: test-jwt-refresh-secret
126+
ENCRYPTION_KEY: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

0 commit comments

Comments
 (0)