1. API
Traffic Tool
  • Traffic Tool Docs
    • Tổng Quan
    • Buisness | Logic
      • Hệ thống được tạo ra để làm gì?
      • Tạo chiến dịch như thế nào?
      • Xử lý sự cố thường gặp
      • Báo cáo bảo mật tự động
      • Tổng hợp báo cáo như thế nào?
    • Project
      • ADMIN
        • Tổng quan
        • Hướng dẫn sử dung
          • Đăng Nhập & Xác Thực Hai Bước
          • HOME TRAFFIC & KILL TRAFFIC
          • CLICK ADS
          • REPORT SITE
          • Thống Kê Hệ Thống
          • Thống Kê Hàng Ngày
          • Tìm Kiếm Tự Động
          • Trung Tâm Báo Cáo
          • Quản Lý Tài Khoản
          • Quản Lý Server
          • Quản Lý Proxy
          • Quản Lý Gói Proxy
          • Quản Lý Nhà Cung Cấp Proxy
          • Quản Lý Backup Proxy
          • Quản Lý Tài Khoản Google
          • User Guide
        • Architecture
          • Setup Guide
          • System Architecture
          • Code Structure
          • Environment & Configuration
          • Logs and Monitoring
        • Deployment
          • Local
          • Staging
          • Production
        • Bussiness | Logic
          • 1. Thống kê hàng ngày (Daily Statistics)
          • 2. Thống kê hệ thống (System Statistics)
          • 3. Tìm kiếm tự động (Automated Discovery)
          • 4. Trung tâm Báo cáo (Report Center)
          • 5. Quản lý tài khoản (Account Management)
          • 6. Quản lý Hệ thống (System Management)
          • 7. Quản lý tài khoản Google (Google Account Management)
      • API
        • Tổng quan
        • Architecture
          • Setup Guide
          • Database Schema
          • System Architecture
          • Code Structure
          • Environment & Configuration
          • Logs and Monitoring
        • Deployment
          • Local
          • Staging
          • Production
        • API Interface
          • 🔑 Identity & Session
            • Đăng nhập hệ thống (Login)
            • Đăng ký tài khoản mới (Public)
            • Lấy danh sách người dùng (Phân trang)
            • Admin tạo người dùng mới
            • Lấy thông tin cá nhân hiện tại
            • Khởi tạo bảo mật 2FA
            • Xác thực mã OTP
            • Chi tiết người dùng theo ID
            • Cập nhật thông tin người dùng
            • Xóa tài khoản người dùng
            • Đổi mật khẩu
            • Kiểm tra Cấu hình Thông báo Telegram Toàn hệ thống
            • Bật/Tắt Thông báo Telegram Toàn cục
          • 📁 Campaign Management
            • Danh sách Chiến dịch Toàn cầu
            • Khởi tạo Chiến dịch Mới
            • Chi tiết Chiến dịch
            • Cập nhật Chiến dịch
            • Xóa Chiến dịch
            • Tắt/Mở Chiến dịch (Hàng loạt)
            • Dữ liệu Hình mẫu SEO (Negative SEO)
          • ⚙️ Project Mechanics
            • Danh sách Dự án (Projects List)
            • Khởi tạo Kịch bản Mô phỏng
            • Lấy chi tiết cấu hình Dự án
            • Cập nhật Kịch bản chạy
            • Xóa Dự án
            • Chỉnh sửa Hàng loạt (Bulk)
            • Bật/Tắt Dự án
          • 👤 Profile Management
            • Danh sách Vân tay số (Profiles Data)
            • Tạo Hồ sơ Đơn lẻ (Tạo Vân tay mới)
            • Nhập kho Tài khoản Email (Bulk Import)
            • Chi tiết Session/Cookies
            • Chỉnh sửa Hồ sơ/Ghi chú
            • Xóa Vân tay số và Dữ liệu Local
            • Mở khóa Captcha/Trạng thái Blocked
            • Tra cứu Kho Profile Khả dụng
            • Báo cáo Sức khỏe Kho Tài Khoản
          • 🦾 Worker Interface
            • Đăng ký Khởi tạo Node (Handshake)
            • Nhịp Tim Khảo Sát Tình Trạng (Heartbeat)
            • Nhận Cấu hình Bypass & Hệ thống
            • Kéo (PULL) Nhiệm vụ Traffic SEO
            • Báo cáo Sự cố Node (Crash Report)
          • 📊 Report: Execution
            • Kéo Công việc Báo cáo (Worker Pull)
            • Quản lý Giám sát Nhiệm vụ (Task Dashboard)
            • Bắn Lại Báo Cáo Thất Bại (Manual Retry)
          • 📊 Report: Discovery
            • Danh sách Tên miền Chờ Xử Lý (Discovery Pool)
            • Nhập Mục Tiêu Thủ Công (Manual Insert)
            • Kích hoạt Heuristic Scanner (Cào tự động)
            • Chi tiết Bằng Chứng (Evidence Data)
            • Dán nhãn Vi Phạm / Cập nhật Screenshot
            • Loại Bỏ Mục Tiêu
            • Duyệt Yêu Cầu (Approve to Execution)
          • 📊 Report: Platforms Configuration
            • Truy vấn Danh sách Nền tảng Đối tác (Vendor)
            • Tạo Nền tảng Vendor Báo cáo Mới
            • Bật/Tắt Trang báo cáo theo Loại
            • Cập nhật Metadata Trang
            • Xóa Trang Báo Cáo
            • Lấy Cài đặt LLM cho Vendor cụ thể
            • Cập nhật Cài đặt Tạo mẫu LLM
            • Lấy Cấu hình Schema Biểu mẫu cho Vendor
            • Cập nhật Yêu cầu Trường Biểu mẫu
          • 📊 Report: Email Automation
            • Danh sách SMTP/Mailer Server
            • Thêm kết nối SMTP Mới
            • Nhật ký Nhiệm vụ Gửi Mail (Email Log)
            • Phân tích Tỉ lệ Chuyển đổi (Email Delivery Analytics)
          • 🌐 Global Proxies
            • Danh sách Kho Proxy Phân trang (Proxy Pool)
            • Thêm mới Tuyến IP (Bulk Import)
            • Cập nhật Thông tin máy chủ Proxy
            • Xóa Proxy (Thu hồi tài nguyên)
            • Kích hoạt Xoay vòng (Rotate IP) Cưỡng bức
          • 📈 System Intelligence
            • Báo cáo Luồng Bảo mật Hợp nhất (Colossal Report)
            • Bản Đồ Lưu Lượng GeoIP (Heatmap)
          • 🪝 Webhook Integrations
            • Callback Hoàn tất Gói Lưu lượng SEO (Traffic Node)
            • Callback Thông báo Hoàn tất Bắn Report AI
      • Tool
        • Tổng quan
        • Architecture
          • Setup Guide
          • System Architecture
          • Code Structure
          • Environment & Configuration
          • Logs And Monitoring
          • Database Schema
        • Deployment
          • Local
          • Staging
          • Production
        • API interface
          • Tasks
            • Lấy tasks có phân trang và lọc
            • Xóa tất cả tasks
            • Get all tasks
            • Cập nhật một task
            • Xóa một task theo ID
            • Get all tasks
          • Group task
            • Tạo nhiều task groups
            • Lấy tất cả task groups
            • Xóa tất cả task groups
            • Xóa một task group theo ID
            • Endpoint /api/task-traffics/
            • Test parse proxy string
            • Endpoint /api/task-traffics/
          • Test
            • Mock proxy endpoint cho development
            • Mock profile endpoint cho development
            • Endpoint /api/test
            • Endpoint /api/test/account-stats
            • Endpoint /api/test/session-recommendation
            • Endpoint /api/test/check-browser
            • Endpoint /api/test/clear-browser-sessions
          • Proxies
            • Lấy tất cả proxy records
            • Tạo proxy record mới
            • Xóa tất cả proxies
            • Get all proxies
            • Xóa một proxy theo ID
            • Reset proxy process counter
            • Get all proxies
            • Get all proxies
          • Report Platforms
            • Submit report to multiple platforms
            • Submit report to specific platform
            • Get available platforms
            • Get platform statistics
            • Health check
          • Reports
            • Create a new report
            • Create a new report
            • Get report by ID
            • Get report by ID
            • Get report statistics
            • Get report groups
            • Get report groups
            • Get report group
            • Add report to group
            • Bulk add reports to group
            • Get report group statistics
            • Get analytics data
            • Get platform success rates
            • Get reports by platform
            • Get reports by group
            • Create test reports in bulk
            • Tạo PC report CSV
            • Lấy PC report JSON
            • Lấy report tasks
            • Giám sát report tasks
            • Report tasks đang hoạt động
            • Chi tiết report task
            • Thống kê reports
            • Dữ liệu biểu đồ reports
            • Lấy danh sách report sites
            • Tạo report site
            • Thống kê sites
            • Toggle site enabled/disabled
            • Toggle tất cả sites
            • Toggle sites theo type
            • Cập nhật hàng loạt AI prompts
            • Cập nhật site
            • Xóa site
            • Lấy cấu hình đầy đủ của site
            • Lấy AI prompt của site
            • Cập nhật AI prompt của site
            • Lấy GPT config của site
            • Cập nhật GPT config
            • Lấy response config của site
            • Cập nhật response config
            • Lấy security vendors đang bật
            • Phân tích keywords
            • Top keywords
            • Thống kê analytics
            • PC report dashboard
            • Lấy report domains
            • Thêm report domain
            • Chi tiết report domain
            • Thống kê hàng ngày
            • Cập nhật hàng loạt reports
          • Test Report
            • Test Microsoft report submission
            • Test AdGuard report submission
            • Test Google Ads report submission
            • Test Spamhaus report submission
            • Test ESET report submission
            • Test multi-platform report submission
            • Get available platforms
          • ESET Test
            • Simple test
            • Minimal POST test
            • Generate ESET report content
            • Get sample test data
            • Test form filling
            • Test full form submission
          • Spamhaus Test
            • Simple test
            • Minimal POST test
            • Generate Spamhaus report content
            • Get sample test data
            • Test Spamhaus form filling
            • Test full Spamhaus form submission
          • Report Scheduler
            • Get report scheduler statistics
            • Process ad detection result
            • Submit a scheduled report
            • Start report scheduler
            • Stop report scheduler
            • Get scheduler status
            • Process scheduled reports
            • Test browser session (non-headless)
            • Test report submission (non-headless)
          • Comprehensive Analytics
            • Get comprehensive dashboard analytics
            • Get overview statistics
            • Get brand-wise statistics
            • Get daily statistics
            • Get platform success rates
            • Get account performance
            • Get summary report
          • Search
            • Tạo nhiều search tasks
            • Lấy tổng số search tasks
          • Report Tasks
            • Tạo report tasks cho một domain
            • Tạo report tasks trực tiếp (hỗ trợ profileCountry và domainType rõ ràng)
            • Tạo report tasks cho nhiều domains cùng lúc
            • Tạo email-based report tasks
            • Lấy report task PENDING tiếp theo
            • Cập nhật status của report task
            • Lấy danh sách platforms có sẵn
            • Thống kê report tasks
            • Kích hoạt thực thi thủ công
          • Monitor
            • Thông tin tài nguyên hệ thống
          • System
            • Hello World
            • Health check
            • Đọc file log từ xa
            • Monitor worker status
          • Auth
            • Đăng nhập
            • Đăng ký tài khoản
          • User Management
            • Danh sách users có phân trang
            • Tạo user mới (Admin only)
            • Lấy tất cả users (không phân trang)
            • Lấy thông tin profile của user hiện tại
            • Tạo QR code TOTP cho 2FA
            • Xác thực TOTP để bật 2FA
            • Lấy user theo ID
            • Cập nhật thông tin user
            • Xóa user
            • Đổi mật khẩu user
          • Campaign Management
            • Danh sách campaigns có phân trang
            • Tạo campaign mới
            • Lấy tất cả campaigns
            • Thống kê tổng hợp campaigns
            • Xuất campaigns ra Excel
            • Lấy dữ liệu Negative SEO
            • Xuất dữ liệu Negative SEO ra Excel
            • Xuất Negative SEO theo IDs
            • Lấy dữ liệu Home Traffic
            • Xuất Home Traffic ra Excel
            • Xuất Home Traffic theo IDs
            • Lấy báo cáo campaigns (Public)
            • Lấy tất cả báo cáo campaigns (Public)
            • Lấy chi tiết campaign
            • Cập nhật campaign
            • Xóa campaign
            • Lấy campaigns đã fired theo type
          • Server Management
            • Danh sách servers có phân trang
            • Tạo server mới
            • Lấy tất cả servers
            • Lấy servers từ MongoDB
            • Báo cáo hiệu suất server
            • Thống kê health check
            • Thống kê task monitor
            • Lịch sử lỗi server
            • Thống kê lỗi server
            • Thay đổi trạng thái server
            • Xóa nhiều servers
            • Lấy server theo ID
            • Cập nhật server
            • Xóa server
            • Báo cáo servers (Public)
          • Project Management
            • Lấy tất cả projects
            • Tạo project mới
            • Lấy projects theo campaign
            • Cập nhật dữ liệu traffic
            • Cập nhật nhiều projects
            • Xóa nhiều projects
            • Lấy project theo ID
            • Cập nhật project
            • Cập nhật state của project
            • Cập nhật status của project
            • Tính lại chi tiết project
          • Task Management
            • Worker yêu cầu tasks
            • Reset task creation
          • Proxy Management
            • Danh sách proxies
            • Tạo proxy mới
            • Xóa tất cả proxies
            • Xuất proxies ra Excel
            • Tải template Excel mẫu
            • Tạo nhiều proxies
            • Import proxies từ Excel
            • Import từ tất cả providers
            • Xóa nhiều proxies
            • Lấy proxy theo ID
            • Cập nhật proxy
            • Xóa proxy
            • Toggle trạng thái proxy
          • Backup Proxy
            • Lấy danh sách backup proxies
            • Tạo backup proxy
            • Xóa nhiều backup proxies
            • Import từ Proxifly
            • Chạy health check
            • Lấy backup proxy theo ID
            • Cập nhật backup proxy
            • Xóa backup proxy
            • Test backup proxy
          • Proxy Providers
            • Lấy danh sách proxy providers
            • Tạo proxy provider
            • Xóa nhiều providers
            • Lấy provider theo ID
            • Cập nhật provider
            • Xóa provider
          • Proxy Packages
            • Lấy danh sách proxy packages
            • Tạo proxy package
            • Xóa nhiều packages
            • Lấy package theo ID
            • Cập nhật package
            • Xóa package
          • Profiles
            • Lấy profiles khả dụng (Public)
            • Lấy profile ngẫu nhiên (Public)
            • Danh sách profiles có phân trang
            • Phân tích profiles
            • Health check profiles
            • Tạo profile session
            • Lấy profile session
            • Cập nhật profile session
            • Xóa profile session
            • Đánh dấu profile đã dùng
            • Cập nhật nhiều profiles
            • Tạo nhiều profiles
            • Dọn dẹp sessions hết hạn
            • Dọn dẹp toàn diện
            • Tạo profile mới
            • Lấy profile theo ID
            • Cập nhật profile
            • Xóa profile
            • Thống kê profile
            • Sessions của profile (phân trang)
            • Report tasks của profile
            • Domains đã report bởi profile
            • Tasks theo domain của profile
            • Reset cooldown của profile
            • Test kết nối profile
            • Reset số lần đăng nhập thất bại
            • Ghi nhận đăng nhập thất bại
          • Keywords
            • Danh sách keywords
            • Tạo keyword mới
            • Xuất keywords ra Excel
            • Xác nhận fire keyword
            • Reset tất cả keywords
            • Lấy keyword theo ID
            • Cập nhật keyword
            • Xóa keyword
            • Reset keyword
            • Cập nhật status keyword
            • Kết quả SERP của keyword
          • Dashboard
            • Dữ liệu tổng hợp dashboard
            • Thống kê hệ thống
            • Thống kê traffic theo ID
            • Dữ liệu bảng biểu đồ traffic
            • Xuất báo cáo ra Excel
            • Lấy dữ liệu báo cáo
            • Cập nhật hàng loạt dashboard
            • Tính lại chi tiết projects (Admin only)
          • System Settings
            • Toggle Telegram notifications
            • Trạng thái Telegram notification
          • Activity Logs
            • Lấy activity logs
          • Locations
            • Lấy tất cả locations
            • Tạo location mới
            • Lấy location theo ID
            • Cập nhật location
            • Xóa location
          • Evidence
            • Kiểm tra evidence tồn tại
            • Kiểm tra evidence hàng loạt
            • Lấy evidence mới nhất
          • Files
            • Upload file
            • Download file
          • Server Hourly Reports
            • Lấy server hourly reports
          • Task Logs
            • Lấy task logs
          • Webhooks - Proxy
            • Lấy proxy cho task (Worker webhook)
            • Lấy proxies có thể rotate (Worker webhook)
            • Báo cáo kết quả proxy rotation (Worker webhook)
            • Lấy backup proxy (Worker webhook)
          • Webhooks - Profile
            • Lấy profiles (admin view, webhook)
            • Lấy profile ngẫu nhiên (Worker webhook)
            • Profiles khả dụng (webhook)
            • Lấy profile session (webhook)
            • Tạo profile session (webhook)
            • Đánh dấu profile đã dùng (webhook)
            • Lấy profile tags (webhook)
            • Lấy tất cả profile sessions (webhook)
          • Webhooks - Task
            • Cập nhật kết quả thực thi task (Worker webhook)
          • Webhooks - Search
            • Báo cáo domains đã click (webhook)
            • Lấy clicked domains (webhook)
            • Báo cáo domains (webhook)
            • Third party callback (webhook)
          • Webhooks - Logs
            • Lấy file logs (webhook)
            • Xóa nội dung log (webhook)
            • Kiểm tra IP address (webhook)
          • Webhooks - Keyword
            • Gửi kết quả SERP keyword (webhook)
          • Webhooks - Report
            • Cập nhật trạng thái report task (webhook)
          • Webhooks - CocCoc Token
            • Lấy CocCoc tokens (webhook)
            • Lock CocCoc token (webhook)
            • Unlock CocCoc token (webhook)
    • Schemas
      • LoginRequest
      • UpdateTask
      • WorkerStatus
      • StandardResponse
      • UserResponseDto
      • CreateTaskGroupRequest
      • HealthResponse
      • UserModel
      • CreateProxy
      • ErrorResponse
      • Pagination
      • CreateUserRequest
      • ReportTaskCreation
      • ErrorResponseFull
      • BulkDeleteRequest
      • UpdateUserRequest
      • CreateEmail
      • MessageResponse
      • UserResponse
      • PagingInfo
      • CreateMultipleSearchRequest
      • TrafficType
      • CampaignResponse
      • ProfileModel
      • CreateMultipleReportRequest
      • ServerResponse
      • CreateProfileRequest
      • UpdateReportStatusRequest
      • Task
      • BulkImportProfileReq
      • TestProxyRequest
      • TaskGroup
      • ProxyResponse
      • UpdateProfileRequest
      • CreateTask
      • UpdateTaskBody
      • KeywordResponse
      • CampaignModel
      • CreateSearch
      • TaskPaginatedResponse
      • LocationResponse
      • CreateCampaignRequest
      • ProxyTestResult
      • UpdateCampaignRequest
      • CreateReportTaskBody
      • BulkUpdateCampaignStatusReq
      • CreateEmailReportTaskBody
      • NegativeSeoData
      • BatchReportTaskItem
      • CreateProjectRequest
      • CreateReportTaskResponse
      • UpdateProjectRequest
      • BatchReportTaskResponse
      • ProjectModel
      • BulkUpdateProjectRequest
      • ReportTask
      • WorkerHandshakeRequest
      • UpdateReportTaskStatusBody
      • WorkerHandshakeResponse
      • UpdateReportTaskStatusResponse
      • WorkerHeartbeatPayload
      • PlatformsListResponse
      • WorkerGlobalSettings
      • ReportTaskStatsResponse
      • TaskPullRequest
      • ExecuteReportTaskResponse
      • WorkerFatalLog
      • CreateSearchTask
      • TaskModel
      • Proxy
      • TaskUpdateDto
      • CreateProxyBody
      • ReportTaskModel
      • CreateProxyResponse
      • ReportTaskResult
      • ResetProcessResponse
      • PCReportResponse
      • MonitorResponse
      • ReportSiteItem
      • CreateReportSiteRequest
      • TestProxyResponse
      • GPTConfig
      • TestProfileResponse
      • ResponseConfig
      • ReportDomainsResponse
      • ReportDomainItem
      • AddReportDomainRequest
      • UpdateReportDomainRequest
      • BulkUpdateDashboardRequest
      • ProxyModel
      • CreateProxyRequest
      • UpdateProxyRequest
      • SMTPServerConfig
      • EmailTaskLog
      • GeoLocation
      • CampaignConfigs
      • ProjectAttribute
      • TaskTrafficType
      • ReportTaskItem
      • SummaryStats
      • DailyStats
      • BrandStats
      • ProfileStats
      • FieldConfig
  1. API

Tổng quan

Go API Backend — Tổng Quan#

Go API Backend là trung tâm điều phối của toàn hệ thống Traffic Tools V2. Đây là thành phần duy nhất có quyền truy cập trực tiếp vào cơ sở dữ liệu. Mọi yêu cầu từ Admin Dashboard, mọi kết quả từ Worker đều đi qua đây.
Xây dựng bằng Go + Fiber v2, chạy trên cổng 33003. Giao tiếp với 3 đối tượng: Admin Dashboard (REST API có xác thực JWT), Tools V2 Worker (phân phối task và nhận kết quả qua webhook), và các cơ sở dữ liệu (MySQL, MongoDB, Redis).

Các nhóm chức năng chính#

Xác thực và phân quyền — JWT + Device Token 2 lớp, 2FA TOTP qua Google Authenticator, phân quyền Admin/User.
Phân phối tác vụ — Cron job mỗi phút giao task đến worker đang online. Worker polling API mỗi giây để nhận task mới.
Nhận kết quả qua webhook — Worker gửi kết quả về qua các endpoint /webhook/* (luôn public, không cần JWT).
15+ cron job tự động — Phân phối task, reset task bị kẹt, quét thứ hạng từ khóa, kiểm tra sức khỏe proxy, báo cáo định kỳ...
36 module nghiệp vụ — Mỗi module quản lý một domain: user, campaign, proxy, keyword, profile, report...
Background services — HealthCheckCron (ping worker định kỳ) và TaskMonitor (phát hiện và reset task bị kẹt).
Thông báo — Telegram (3 kênh: chung, báo cáo, lỗi nghiêm trọng) và Mattermost (báo cáo hàng ngày lúc 9:00).

Bussiness | Logic#

Tài liệu nghiệp vụ mô tả các tính năng mà API Backend phục vụ — từ góc nhìn người vận hành, không có code.
1. Thống kê hàng ngày — API tổng hợp dữ liệu traffic theo giờ từ MySQL + MongoDB, trả về cấu trúc lồng nhau theo ngày → loại traffic → từ khóa → 24 giờ. Có cơ chế deduplication ở cả frontend và backend để tránh query nặng trùng lặp.
2. Thống kê hệ thống — API phân loại chiến dịch theo flag only_ads và is_kill. Ba endpoint riêng cho 3 tab: Click Ads, Negative SEO, Traffic Tự Nhiên. Dùng Go Map thay vì SQL JOIN để tránh row explosion.
3. Tìm kiếm tự động — API tạo task tìm kiếm cho mọi tổ hợp engine × device × deviceOS. Confirm Fire kết nối MongoDB (keyword) sang MySQL (project). Cron job quét lại mỗi 30 phút.
4. Trung tâm Báo cáo — API quản lý report_sites (cấu hình AI prompt, GPT config, form schema), report_domains (soft delete), report_tasks (PENDING → IN_PROGRESS → COMPLETED/FAILED). Webhook nhận callback từ Worker sau mỗi lần gửi báo cáo.
5. Quản lý tài khoản — CRUD user, bcrypt password, TOTP 2FA, Device Token per-login, session timeout qua Redis, activity log ghi lại mọi hành động.
6. Quản lý Hệ thống — API quản lý server worker (MySQL), proxy pool (MongoDB với array domain_used/domain_blocks), xoay IP tự động qua webhook, import song song từ nhiều nhà cung cấp, backup proxy health check.
7. Quản lý tài khoản Google — API quản lý Browser Profile (MongoDB), chọn profile ngẫu nhiên cho task với giới hạn 5 báo cáo/ngày/server, ghi nhận đăng nhập thất bại (3 lần → vô hiệu hóa), dọn dẹp session hết hạn.

Architecture#

Tài liệu kỹ thuật cho developer làm việc với Go API Backend.
Database Schema — Schema đầy đủ của MySQL (users, campaigns, servers, proxies, keywords...), MongoDB collections (tasks, profiles, keyword_results, evidences...) và Redis key patterns.
System Architecture — Kiến trúc phân lớp (Handler → Service → Repository), middleware chain (Recover → CORS → Helmet → Timeout → Auth → JWT), dependency injection với go.uber.org/dig, background services (HealthCheckCron + TaskMonitor), luồng dữ liệu chi tiết.
Code Structure — Cây thư mục đầy đủ: cmd/, bootstrap/, internal/ (36 modules), pkg/ (shared packages). Pattern tổ chức module 4 lớp nhất quán. Channel-based logging theo từng module.
Environment & Configuration — Danh sách đầy đủ biến môi trường: database connections, JWT secret, webhook URLs, cron schedules, Telegram tokens, proxy provider credentials.
Logs and Monitoring — Hệ thống log theo channel (mỗi module một thư mục riêng), cách đọc log từ xa, Telegram alerts, Mattermost reports, HealthCheckCron và TaskMonitor.

Deployment#

Local — Chạy API trên máy local với air -c .air.toml (hot-reload), database trong Docker. Cấu hình env với localhost + cổng ánh xạ ra ngoài (33022, 33021, 33023).
Staging — Pipeline GitLab tự động: SSH vào server, git pull, docker compose up --build -d. Build trực tiếp trên server, mất 5–10 phút.
Production — Mô hình 2 giai đoạn: build Go binary trên Bastion Server → push image lên AWS ECR → pull và deploy trên EC2. Rollback bằng cách đổi tag image, hoàn thành trong ~5 giây.

API Interface#

Tài liệu chi tiết từng endpoint, được nhóm theo chức năng.
🔑 Identity & Session — Đăng nhập, đăng ký, lấy profile, thiết lập 2FA, xác thực OTP, quản lý user (CRUD, đổi mật khẩu), cấu hình Telegram notification.
Đăng nhập hệ thống — Xác thực email và mật khẩu. Nếu tài khoản có bật 2FA, hệ thống trả về yêu cầu xác thực OTP bước 2.
Khởi tạo bảo mật 2FA — Sinh khóa bí mật dùng cho Google Authenticator.
Xác thực mã OTP — Kiểm tra mã 6 số để hoàn tất đăng nhập hoặc thiết lập 2FA.
📁 Campaign Management — CRUD chiến dịch, bật/tắt hàng loạt, lấy dữ liệu Negative SEO.
Danh sách Chiến dịch — Lấy danh sách chiến dịch, hỗ trợ tìm kiếm, phân trang và lọc theo trạng thái.
Tắt/Mở Chiến dịch hàng loạt — Cập nhật trạng thái nhiều chiến dịch cùng lúc.
Dữ liệu Negative SEO — Thống kê hiệu quả rớt hạng SEO của đối thủ.
⚙️ Project Mechanics — CRUD project, cập nhật kịch bản chạy (loại traffic, device, thời gian onsite), chỉnh sửa hàng loạt.
Khởi tạo Kịch bản Mô phỏng — Tạo cài đặt quy định cách Worker phải chạy (truy cập trực tiếp hay tìm kiếm, click quảng cáo hay bỏ qua).
Chỉnh sửa Hàng loạt (Bulk) — Thay đổi cùng lúc Device, OS, hoặc Loại Traffic cho hàng trăm Project.
👤 Profile Management — CRUD Browser Profile, bulk import, mở khóa captcha/blocked, tra cứu profile khả dụng, báo cáo sức khỏe kho tài khoản.
Nhập kho Tài khoản Email (Bulk Import) — Nhận danh sách account định dạng account|password|recovery_email để đăng nhập giả lập số lượng lớn.
Tra cứu Kho Profile Khả dụng — Trả về các profile đã xả xong cooldown và không bị khóa. Dùng cho Node tự động điều phối.
Báo cáo Sức khỏe Kho Tài Khoản — Tính toán Tỉ lệ sống (Survival Rate), số lượng Click đã tạo.
🦾 Worker Interface — Handshake đăng ký node, heartbeat ping định kỳ, nhận cấu hình bypass, kéo nhiệm vụ traffic SEO, báo cáo sự cố crash.
Đăng ký Khởi tạo Node (Handshake) — Worker gọi khi chạy lần đầu. Cung cấp API_KEY và thông số máy. Hệ thống cấp worker_id và JWT Access Token 24h.
Nhịp Tim Khảo Sát Tình Trạng (Heartbeat) — Worker ping định kỳ để báo cáo health. Mất ping quá 3 phút → Admin Dashboard cảnh báo Node chết.
Kéo (PULL) Nhiệm vụ Traffic SEO — Worker kéo danh sách tác vụ kèm Proxy, Profile để thực hiện thao tác SEO.
📊 Report: Execution — Worker kéo công việc báo cáo, giám sát nhiệm vụ, bắn lại báo cáo thất bại.
Kéo Công việc Báo cáo (Worker Pull) — API độc quyền cho Report Worker. Hệ thống nhả Prompt và Metadata của nền tảng đích.
Bắn Lại Báo Cáo Thất Bại — Admin kích hoạt chạy lại Report đã FAILED do Form Timeout hoặc Proxy chết.
📊 Report: Discovery — Quản lý domain pool chờ xử lý, nhập mục tiêu thủ công, kích hoạt scanner tự động, duyệt yêu cầu để chuyển sang Execution.
Danh sách Tên miền Chờ Xử Lý — Lấy danh sách domain đang bị nghi ngờ vi phạm, lọc theo Keyword, Status và Loại.
Kích hoạt Heuristic Scanner — Gửi chỉ thị cho Worker cào Google SERPs tìm URL lừa đảo tự động đẩy vào Discovery Pool.
Duyệt Yêu Cầu (Approve to Execution) — Chốt chặn xác thực cuối cùng. Domain chuyển từ pending sang ready để phân bổ cho luồng Execution.
📊 Report: Platforms Configuration — CRUD nền tảng báo cáo, bật/tắt theo loại, cập nhật AI prompt và GPT config, cấu hình schema biểu mẫu.
Truy vấn Danh sách Nền tảng Đối tác — Lấy cấu hình hoạt động cho hơn 30 vendors (Spamhaus, Microsoft...), bao gồm BROWSER_BASED và EMAIL_BASED.
📊 Report: Email Automation — Quản lý SMTP server, nhật ký gửi mail, phân tích tỉ lệ chuyển đổi.
Danh sách SMTP/Mailer Server — Lấy danh sách tài khoản SMTP đang hoạt động dùng để bắn Email-Based Report.
Nhật ký Nhiệm vụ Gửi Mail — Trace trạng thái từng Message: Pending, Delivered, Bounced, Spam_Detected.
🌐 Global Proxies — CRUD proxy pool, bulk import, cập nhật thông tin, xoay vòng IP cưỡng bức.
Danh sách Kho Proxy — Lấy danh sách IP hiện có, hỗ trợ tìm kiếm theo IP, khu vực và thống kê số lỗi kết nối.
Kích hoạt Xoay vòng (Rotate IP) Cưỡng bức — Ping API nhà cung cấp để ép reset IP mới thay vì chờ vòng lặp định kỳ. Hữu hiệu để vượt Cloudflare Block.
📈 System Intelligence — Báo cáo luồng bảo mật hợp nhất, bản đồ lưu lượng GeoIP heatmap.
Báo cáo Luồng Bảo mật Hợp nhất — Phân tích số liệu lớn: Total Dead Ads, Brand Tracking, Survival Profile Rates.
Bản Đồ Lưu Lượng GeoIP (Heatmap) — Dữ liệu Heatmap mật độ Click/View theo múi giờ và tỉnh thành. Dùng vẽ bản đồ ECharts.
🪝 Webhook Integrations — Callback hoàn tất gói lưu lượng SEO, callback hoàn tất bắn Report AI.
Callback Hoàn tất Gói Lưu lượng SEO — Hứng HTTP POST từ máy chủ Node sau khi đã Onsite đủ Time On Page.
Callback Thông báo Hoàn tất Bắn Report AI — Nhận kết quả cuối (Success/Fail) kèm Screenshot bằng chứng submit từ Worker.
Modified at 2026-03-31 03:53:48
Previous
7. Quản lý tài khoản Google (Google Account Management)
Next
Setup Guide
Built with