| Module | Mô tả |
|---|---|
| User | Quản lý tài khoản, phân quyền, xác thực JWT |
| Server | Quản lý danh sách worker server |
Search (keyword_pool_task) | Nhận và phân phối tác vụ tìm kiếm keyword |
| Anchor Text | Nhận và phân phối tác vụ tìm kiếm anchor text |
| Webhook | Nhận callback kết quả từ worker, cấp phát proxy |
Module không còn sử dụng: keyword,proxy(vẫn còn code nhưng không có route hoạt động trực tiếp tương ứng từ phía client).
| Công cụ | Phiên bản |
|---|---|
| Go | >= 1.21 |
| MySQL | 8.x |
| MongoDB | 6.x |
| Redis | 7.x |
| Docker + Compose | Tuỳ chọn (khuyến nghị) |
# Chế độ app
APP_MODE=development
AUTO_MIGRATE_DATABASE=true # true = tự migration schema khi khởi động
# HTTP server
SERVER_PORT=33003
# MySQL — lưu trữ: users, servers
DB_MYSQL_HOST=localhost
DB_MYSQL_PORT=3306
DB_MYSQL_USER=root
DB_MYSQL_PASS=<password>
DB_MYSQL_NAME=search-api-mysql
# MongoDB — lưu trữ: keyword pool task, anchor text task
DB_MONGO_HOST=localhost
DB_MONGO_PORT=27017
DB_MONGO_USER=root
DB_MONGO_PASS=<password>
DB_MONGO_NAME=search-api-mongodb
# Redis — cache kết quả anchor text (TTL 5 phút)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
# JWT
JWT_SECRET=<secret>
# Token xác thực endpoint /search và /anchor-text
API_SEARCH_TOKEN=<token>
# Webhook URLs (API tự gọi lại chính nó — phải là URL có thể reach từ worker)
WEBHOOK_HOST=http://127.0.0.1:33003
WEBHOOK_UPDATE_SEARCH_RESULT=http://127.0.0.1:33003/webhook/update-search-result
WEBHOOK_UPDATE_SEARCH_ANCHOR_TEXT=http://127.0.0.1:33003/webhook/update-search-anchor-text
WEBHOOK_PROXY_GET_PROXY_URL=http://127.0.0.1:33003/webhook/proxy/get-proxy
WEBHOOK_KEY=<webhook-secret-key>http://localhost:33003