5.7 KiB
5.7 KiB
🚀 Deploy Web Javaherbal ke Vercel
✅ Persiapan Selesai!
File-file yang sudah disiapkan:
- ✅
.gitignore- Exclude node_modules, dist, .env - ✅
vercel.json- Konfigurasi Vercel - ✅
package.json- Script build sudah ada
📋 LANGKAH-LANGKAH DEPLOY
1️⃣ Push ke GitHub
A. Buat Repository Baru di GitHub
- Buka https://github.com
- Klik tombol "New" (repository baru)
- Isi:
- Repository name:
frondend-web - Description:
Web dashboard untuk sistem pengeringan cabai jawa - Visibility: Public atau Private
- Repository name:
- JANGAN centang "Add a README file"
- Klik "Create repository"
B. Push Code ke GitHub
cd javaherbal-v2/javaherbal2
# Initialize git
git init
# Add all files
git add .
# Commit
git commit -m "Initial commit - Web Javaherbal"
# Add remote
git remote add origin https://github.com/flemss/frondend-web.git
# Push
git branch -M main
git push -u origin main
2️⃣ Deploy ke Vercel
A. Buka Vercel
- Buka https://vercel.com
- Klik "Sign Up" atau "Login"
- Login dengan GitHub
B. Import Project
- Klik "Add New..." → "Project"
- Pilih "Import Git Repository"
- Cari repository "frondend-web"
- Klik "Import"
C. Configure Project
- Project Name:
frondend-web(atau nama lain) - Framework Preset: Vercel akan auto-detect Vite
- Root Directory:
./(default) - Build Command:
npm run build(auto-filled) - Output Directory:
dist(auto-filled) - Install Command:
npm install(auto-filled)
D. Environment Variables (Opsional)
Jika ada environment variables, tambahkan di sini. Untuk saat ini, tidak perlu karena API_URL sudah hardcoded.
E. Deploy!
- Klik "Deploy"
- Tunggu 1-2 menit
- Selesai! 🎉
🌐 URL VERCEL
Setelah deploy selesai, Vercel akan memberikan URL seperti:
https://frondend-web.vercel.app
atau
https://frondend-web-flemss.vercel.app
🧪 TESTING
1. Buka URL Vercel
https://frondend-web.vercel.app
2. Test Register
- Klik "Daftar di sini"
- Isi form registrasi
- Klik "Daftar"
- Expected: Alert "Registrasi berhasil!" → Redirect ke login
3. Test Login
- Isi form login
- Klik "Masuk"
- Expected: Redirect ke beranda
- Expected: Floating stat suhu muncul
4. Test Control Panel
- Klik menu "Control"
- Expected: Panel kontrol muncul
- Expected: Data suhu real-time
- Expected: Toggle heater berfungsi
🔄 UPDATE WEB
Setiap kali ada perubahan code:
cd javaherbal-v2/javaherbal2
# Add changes
git add .
# Commit
git commit -m "Update: deskripsi perubahan"
# Push
git push origin main
Vercel akan otomatis:
- Detect perubahan di GitHub
- Build ulang
- Deploy versi baru
- Zero downtime!
⚙️ CUSTOM DOMAIN (Opsional)
Jika ingin pakai domain sendiri (contoh: javaherbal.com):
1. Beli Domain
- Namecheap, GoDaddy, Niagahoster, dll
2. Tambah Domain di Vercel
- Buka project di Vercel dashboard
- Klik tab "Settings"
- Klik "Domains"
- Klik "Add"
- Masukkan domain Anda
- Follow instruksi untuk update DNS
3. Update DNS
Di provider domain Anda, tambahkan record:
Type: CNAME
Name: www
Value: cname.vercel-dns.com
Tunggu 5-60 menit untuk propagasi DNS.
🔐 ENVIRONMENT VARIABLES (Jika Diperlukan)
Jika ingin API_URL bisa diubah tanpa rebuild:
1. Buat file .env.production
VITE_API_URL=https://web-production-32384.up.railway.app/api
2. Update code untuk pakai env variable
// Sebelum
const API_URL = 'https://web-production-32384.up.railway.app/api'
// Sesudah
const API_URL = import.meta.env.VITE_API_URL || 'https://web-production-32384.up.railway.app/api'
3. Set di Vercel Dashboard
- Buka project di Vercel
- Klik tab "Settings"
- Klik "Environment Variables"
- Tambah:
- Key:
VITE_API_URL - Value:
https://web-production-32384.up.railway.app/api
- Key:
- Save
4. Redeploy
Vercel akan auto redeploy dengan env variable baru.
📊 MONITORING
Vercel Dashboard
Fitur:
- ✅ Deployment history
- ✅ Build logs
- ✅ Analytics (traffic, performance)
- ✅ Error tracking
- ✅ Custom domains
- ✅ Environment variables
🔍 TROUBLESHOOTING
Problem: Build Failed
Solusi:
- Cek build logs di Vercel dashboard
- Test build lokal:
npm run build - Fix error yang muncul
- Push lagi ke GitHub
Problem: 404 Not Found
Solusi:
- Pastikan
vercel.jsonada dan benar - Pastikan rewrites sudah diset untuk SPA routing
- Redeploy
Problem: API Not Working
Solusi:
- Cek backend Railway masih online
- Cek CORS di backend
- Cek API_URL di code
- Cek browser console untuk error
✅ CHECKLIST
Sebelum Deploy:
.gitignoresudah dibuatvercel.jsonsudah dibuatpackage.jsonscript build ada- API_URL sudah diset ke Railway
- Test build lokal (
npm run build) - Push ke GitHub
Setelah Deploy:
- URL Vercel bisa diakses
- Register berfungsi
- Login berfungsi
- Control panel berfungsi
- Data real-time muncul
🎉 SELESAI!
Web Javaherbal sekarang online di Vercel!
Keuntungan:
- ✅ Gratis unlimited
- ✅ Auto deploy dari GitHub
- ✅ HTTPS otomatis
- ✅ CDN global (cepat)
- ✅ Zero downtime deployment
- ✅ Custom domain support
Selamat! Web Anda sekarang production-ready! 🚀
📞 SUPPORT
Vercel Documentation
Vite Documentation
React Router Documentation
Created: May 21, 2026
Status: ✅ Ready to Deploy