Dự án mặc định chạy trên localhost. Không cần thay đổi gì cả.
Chỉ cần làm 3 bước:
Mở file backend/api_server/.env và sửa:
# Thay đổi FRONTEND_URL
FRONTEND_URL=http://vennv.ddns.net:5173
# Thay đổi ALLOWED_ORIGINS
ALLOWED_ORIGINS=http://vennv.ddns.net:5173,https://vennv.ddns.net:5173
# Thay đổi GOOGLE_CALLBACK_URL
GOOGLE_CALLBACK_URL=http://vennv.ddns.net:2030/api/v1/auth/google/callback
# Điền Google OAuth credentials (bắt buộc!)
GOOGLE_CLIENT_ID=your_actual_client_id_here
GOOGLE_CLIENT_SECRET=your_actual_client_secret_hereMở file frontend/project/.env và sửa:
# Comment localhost và uncomment DDNS
# VITE_AI_SERVER_URL=http://localhost:9999
# VITE_API_SERVER_URL=http://localhost:2030
VITE_AI_SERVER_URL=http://vennv.ddns.net:9999
VITE_API_SERVER_URL=http://vennv.ddns.net:2030- Vào https://console.cloud.google.com/apis/credentials
- Chọn OAuth 2.0 Client ID của bạn
- Thêm vào Authorized JavaScript origins:
http://vennv.ddns.net:5173
- Thêm vào Authorized redirect URIs:
http://vennv.ddns.net:2030/api/v1/auth/google/callback
# Windows
stop.cmd
start.cmd
# Linux/Mac
./stop-local.sh
./start-local.shChỉ cần comment/uncomment lại các dòng trong file .env:
Backend (backend/api_server/.env):
FRONTEND_URL=
ALLOWED_ORIGINS=
GOOGLE_CALLBACK_URL=Frontend (frontend/project/.env):
VITE_AI_SERVER_URL=http://localhost:9999
VITE_API_SERVER_URL=http://localhost:2030Sau đó restart lại services.
- File .env không được commit vào Git - Chỉ có
example-envmới được commit - Phải restart services sau khi thay đổi .env
- Phải cấu hình Google OAuth Console trước khi sử dụng DDNS
- Ports cần mở trên router/firewall:
- 5173 (Frontend)
- 2030 (API Server)
- 9999 (AI Server)