cd frontend
npm run buildĐã có sẵn vercel.json và backend/api/index.py
# Cài đặt Vercel CLI
npm i -g vercel
# Login vào Vercel
vercel login
# Deploy từ thư mục root
vercel
# Follow prompts:
# - Project name: vimedical
# - Framework: Other
# - Output directory: frontend/build-
Push code lên GitHub repo cá nhân (✅ ĐÃ HOÀN THÀNH):
Code đã được push thành công lên: https://github.com/Ne4nf/ViNNan_app
Nếu cần push lại hoặc update code:
# Kiểm tra trạng thái git status # Add file đã thay đổi git add . # Commit git commit -m "Update: mô tả thay đổi" # Push lên GitHub git push origin main
Lưu ý:
- File
.gitignoređã được cấu hình để loại trừ file lớn (node_modules, venv, build, .env, ...) - Repo hiện tại chỉ chứa code cần thiết, không có file nhạy cảm.
- Để cập nhật code, chỉ cần add -> commit -> push như bình thường.
- File
-
Connect với Vercel:
- Vào vercel.com
- Sign up/Login với GitHub
- Click "New Project"
- Import từ GitHub repository
- Configure:
- Framework Preset: Other
- Root Directory: .
- Build Command:
cd frontend && npm run build - Output Directory:
frontend/build
Trong Vercel Dashboard > Settings > Environment Variables, thêm:
OPENROUTER_API_KEY=sk-or-v1-your-key-here
QDRANT_URL=https://your-qdrant-url
QDRANT_API_KEY=your-qdrant-key
REACT_APP_API_URL=https://your-app-name.vercel.app/api/v1
vimedical/
├── vercel.json # Vercel config
├── frontend/
│ ├── build/ # React build output
│ ├── package.json
│ └── ...
├── backend/
│ ├── api/
│ │ └── index.py # Vercel entry point
│ ├── app/
│ ├── requirements.txt
│ └── ...
File này đã configure:
- Frontend serving từ
/ - Backend API từ
/api/* - Environment variables
- Build settings
Nếu gặp vấn đề với full-stack deploy, có thể deploy riêng:
cd frontend
vercelDeploy backend lên Railway hoặc Render, rồi update REACT_APP_API_URL
Sau khi deploy:
- App URL:
https://your-app-name.vercel.app - API:
https://your-app-name.vercel.app/api/v1 - Frontend:
https://your-app-name.vercel.app
-
Build failed:
# Đảm bảo build local trước cd frontend && npm run build
-
API không hoạt động:
- Kiểm tra Environment Variables
- Xem logs trong Vercel Dashboard
-
CORS issues:
- Đã configure CORS trong FastAPI
- Kiểm tra domain trong
allow_origins
Vercel Free:
- ✅ 100GB bandwidth/month
- ✅ Unlimited static deployments
- ✅ Serverless functions (limited)
⚠️ 10GB storage⚠️ 100 serverless function executions/day
- App loads correctly
- API endpoints work
- Chat functionality works
- Dark/Light theme works
- Mobile responsive
- Custom domain (optional)
URL sẽ có dạng: https://vimedical-yourname.vercel.app
- Netlify: Drag & drop build folder
- GitHub Pages: Static hosting
- Surge.sh: CLI deployment
- Railway: Free tier với PostgreSQL
- Render: Free tier với sleep mode
- Heroku: Free dynos (limited)
- Frontend: Vercel + Backend: Railway
- Frontend: Netlify + Backend: Render
- Full-stack: Vercel (như hướng dẫn trên)
Chọn combo phù hợp với nhu cầu và experience!
Happy Deploying! 🚀