1. Architecture
Traffic Tool
  • Traffic Tool Docs
    • Tổng quan
      • Tổng Quan
      • Setup Guide
      • System Architecture
      • Code Structure
      • Logs and Monitoring
      • Environment & Configuration
      • Deployment
        • Local
        • Staging
        • Product
    • 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)
    • Project
      • ADMIN
        • Tổng quan
        • Hướng dẫn sử dung
          • Đăng Nhập & Xác Thực Hai Bước
          • 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
          • System Architecture
          • Code Structure
          • Environment & Configuration
          • Logs and Monitoring
        • Deployment
          • Local
          • Staging
          • Production
      • API
        • Tổng quan
        • Architecture
          • 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
          • 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. Architecture

Environment & Configuration

Cấu Hình Môi Trường — Admin Dashboard Traffic Tools V2#

Phiên bản: 0.0.1
Cập nhật lần cuối: 26/03/2026
Phạm vi: Toàn bộ cơ chế cấu hình môi trường của Admin Dashboard: biến môi trường Vite, cấu hình build, alias đường dẫn, chiến lược bundle và xử lý đa môi trường.

1. Tổng quan#

Admin Dashboard dùng hệ thống file .env của Vite để tách biệt cấu hình giữa các môi trường. Vite đọc tất cả biến bắt đầu bằng VITE_ và nhúng giá trị đó vào mã nguồn tại thời điểm build (compile-time), không phải lúc chạy (runtime).
Điều này có nghĩa là:
Biến môi trường không thể thay đổi sau khi build mà không build lại.
Để thay đổi địa chỉ API server mà không build lại, dùng cơ chế window.configs injection (xem mục 3).
Không có file .env nào chứa secret key hay mật khẩu database — mã nguồn frontend hoàn toàn có thể bị đọc qua DevTools.

2. Các file environment#

2.1. File .env theo môi trường#

FileLệnh kích hoạtMôi trường mục tiêu
.env.developmentnpm run dev hoặc npm run build:devMáy cục bộ của developer
.env.stagingnpm run build:stgServer kiểm thử chung
.env.releasenpm run build:releaseServer Release trước Production
.env.productionnpm run build:prod hoặc npm run build:prod:dockerMôi trường vận hành thực tế
Thứ tự ưu tiên đọc file: .env → .env.{mode} → .env.{mode}.local. File sau ghi đè file trước. File kết thúc bằng .local không được commit vào Git.

2.2. Nội dung các file#

.env.development:
NODE_MODE=development
VITE_API_SERVER=http://localhost:33001
.env.production:
NODE_MODE=production
VITE_API_SERVER=https://traffic-api.longtu.club
Các file .env.staging và .env.release có cấu trúc tương tự, chỉ khác ở giá trị VITE_API_SERVER.

3. Biến môi trường đang sử dụng#

3.1. Biến cấu hình chính#

Tên biếnDevProdÝ nghĩa
VITE_API_SERVERhttp://localhost:33001https://traffic-api.longtu.clubBase URL của Backend API Engine. Axios nối thêm /api vào sau.
NODE_MODEdevelopmentproductionPhân biệt chế độ chạy Node.js. Không có tiền tố VITE_.

3.2. Biến Vite hệ thống#

BiếnVí dụMô tả
import.meta.env.MODEdevelopment, staging, productionĐọc từ --mode của lệnh build.
import.meta.env.BASE_URL/Base URL của ứng dụng.
import.meta.env.PRODtrue / falsetrue khi MODE !== development.
import.meta.env.DEVtrue / falsetrue khi MODE === development.

3.3. Cách đọc biến môi trường trong mã nguồn#

Dự án dùng hàm useEnv trong src/composables/utils.ts thay vì đọc trực tiếp import.meta.env:
Thứ tự ưu tiên:
1.
window.configs[key] — Có thể được inject từ Nginx để override mà không cần build lại.
2.
import.meta.env[key] — Giá trị đã nhúng cứng lúc build.
3.
undefined nếu cả hai đều không có.
Nơi useEnv được dùng:

4. Window.configs — override không cần build lại#

4.1. Mục đích#

Trong production, build lại ứng dụng chỉ để thay đổi địa chỉ API server là không thực tế. Cơ chế window.configs cho phép inject giá trị cấu hình vào runtime mà không cần build lại.

4.2. Cách hoạt động#

File public/runtime.config.js được phục vụ trực tiếp bởi Nginx (không qua build pipeline) và được nhúng vào index.html trước khi ứng dụng Vue khởi động:
Nội dung runtime.config.js:

4.3. Override qua Nginx sub_filter#

Có thể inject window.configs trực tiếp qua Nginx sub_filter — hữu ích khi deploy cùng một Docker image lên nhiều môi trường khác nhau:

5. Cấu hình Vite#

5.1. Path alias#

AliasTrỏ đếnVí dụ
@./srcimport { useAuthStore } from '@/stores/authStore'
@api./src/services/apiimport { apiAuth } from '@api/auth'
@locales./localesDùng trong cấu hình i18n plugin

5.2. Auto-import plugin#

unplugin-auto-import tự động import vào mọi file từ:
vue, vue-router, pinia, @vueuse/core, @iconify/vue, naive-ui, zod.
src/composables/**, src/stores/**, src/services/api/**.
File khai báo type được tạo tự động tại types/auto-imports.d.ts.

5.3. Auto-import component#

unplugin-vue-components tự động resolve và import tất cả Naive UI components trong template — không cần import thủ công.

5.4. Phân tách bundle#

5.5. Xử lý xlsx-js-style#

5.6. Cấu hình i18n plugin#


6. Cấu hình TypeScript#

strict: true — Bật tất cả kiểm tra strict mode.
noUnusedLocals: true — Báo lỗi khi có biến cục bộ không dùng.
noUnusedParameters: true — Báo lỗi khi có tham số hàm không dùng.
noImplicitReturns: true — Báo lỗi khi hàm không có return rõ ràng.
paths — Khai báo alias @/* tương ứng với cấu hình Vite.
vue-tsc được dùng thay cho tsc để kiểm tra kiểu TypeScript trong file .vue. Lệnh npm run typecheck chạy vue-tsc --build --force.

7. Cấu hình Nginx cho frontend#

7.1. Cấu hình cơ bản#

7.2. Tại sao cần SPA fallback#

Admin Dashboard dùng HTML5 History Mode (createWebHistory()). Khi người dùng truy cập trực tiếp vào URL như /system-management/proxy-management hoặc F5 trang, Nginx sẽ tìm file vật lý tương ứng và trả về 404 nếu không có try_files. Cấu hình try_files $uri $uri/ /index.html đảm bảo mọi request đều trả về index.html và Vue Router xử lý điều hướng phía client.

7.3. Chiến lược cache#

File trong assets/ có hash trong tên — cache vĩnh viễn vì tên file thay đổi khi nội dung thay đổi.
index.html và runtime.config.js không có hash — phải cache với no-cache để browser luôn lấy phiên bản mới nhất.

8. Biến môi trường trong CI/CD#

8.1. GitLab CI variables#

BiếnMôi trườngMô tả
TRAFFIC_DEV_77_37_47_88_KEYDevelop, StagingSSH private key (base64) để kết nối server dev/staging.
TRAFFIC_DEV_77_37_47_88_USERDevelop, StagingUsername SSH.
TRAFFIC_DEV_77_37_47_88_IPDevelop, StagingĐịa chỉ IP server.
TRAFFIC_DEV_77_37_47_88_PORTDevelop, StagingPort SSH.
AWS_TRAFFIC_REL_KEYReleaseSSH private key cho server release.
BASTION_BUILD_KEYProduction BuildSSH private key cho Bastion Build Server.
BASTION_BUILD_USERProduction BuildUsername SSH.
BASTION_BUILD_IPProduction BuildĐịa chỉ IP.
BASTION_BUILD_PORTProduction BuildPort SSH.
AWS_TRAFFIC_PROD_KEYProduction DeploySSH private key cho server production.
AWS_ACCESS_KEY_IDProductionAWS Access Key ID để đăng nhập ECR.
AWS_SECRET_ACCESS_KEYProductionAWS Secret Access Key.
AWS_DEFAULT_REGIONProductionAWS Region (ap-southeast-1).

8.2. Biến cố định trong .gitlab-ci.yml#

TAG_COMMIT dùng $CI_COMMIT_SHORT_SHA — 8 ký tự đầu của commit hash — cho phép rollback về bất kỳ phiên bản nào bằng cách chỉ định tag cụ thể.

9. Cấu hình Tailwind CSS#


10. Cấu hình theme Naive UI#

Áp dụng trong App.vue:
<template>
  <NConfigProvider :theme-overrides="themeOverrides">
    <RouterView />
  </NConfigProvider>
</template>

11. Cấu hình ESLint#

vue/multi-word-component-names: off — Cho phép component tên một từ như IndexView.vue.
@typescript-eslint/no-explicit-any: warn — Cảnh báo khi dùng any, không chặn hoàn toàn.
no-console: warn — Cảnh báo khi dùng console.log, nhưng cho phép console.error và console.warn.

12. Cấu hình Prettier#

{
  "semi": false,
  "singleQuote": true,
  "printWidth": 100,
  "trailingComma": "none",
  "tabWidth": 2,
  "useTabs": false,
  "endOfLine": "lf",
  "vueIndentScriptAndStyle": false
}
semi: false — Không dùng dấu chấm phẩy cuối câu.
singleQuote: true — Dùng nháy đơn.
printWidth: 100 — Độ rộng tối đa 100 ký tự.
endOfLine: lf — Dùng LF (Unix) để nhất quán giữa các hệ điều hành.

13. Cấu hình Husky và lint-staged#

Pre-commit hook (.husky/pre-commit):
Commit-msg hook (.husky/commit-msg):
lint-staged (.husky/lintstagedrc.js):
Chỉ lint và format các file đã staged, không lint toàn bộ dự án mỗi lần commit.

14. Quản lý phiên bản#

Dự án dùng conventional-changelog-cli để tự động tạo CHANGELOG.md từ lịch sử commit:
Phiên bản hiện tại được định nghĩa trong package.json:
{
  "name": "wallet",
  "version": "0.0.1"
}
Tên package là wallet — đây là tên nội bộ của dự án.
Modified at 2026-03-27 04:33:22
Previous
Code Structure
Next
Logs and Monitoring
Built with