# 🚀 Panduan Deploy SKP Institut Kesehatan Immanuel

## Isi ZIP

```
dist/              ← Hasil build frontend (siap deploy, tidak perlu Node.js)
src/               ← Source code frontend React (untuk pengembangan)
backend/src/       ← Source code backend Express.js
backend/server.js  ← Entry point backend
backend/schema.sql ← Struktur database MySQL
backend/.env       ← Konfigurasi environment (DB, API Key, dll)
package.json       ← Dependensi frontend & backend
```

---

## ⚙️ Cara Deploy (Production)

### 1. Backend (Node.js + Express)

```bash
# Masuk ke folder backend
cd backend

# Install dependensi
npm install

# Jalankan server
node server.js
# atau gunakan PM2 agar berjalan terus:
# npm install -g pm2
# pm2 start server.js --name skp-backend
```

Backend akan berjalan di port yang dikonfigurasi di `.env`.

### 2. Frontend (Hasil Build)

Folder `dist/` berisi file statis HTML/CSS/JS yang sudah dikompilasi.
**Tidak perlu Node.js** untuk serve frontend.

**Opsi A – Nginx (Rekomendasi):**
```nginx
server {
    listen 80;
    root /path/to/dist;
    index index.html;
    
    location / {
        try_files $uri $uri/ /index.html;
    }
    
    location /api/ {
        proxy_pass http://localhost:3000;
    }
}
```

**Opsi B – Serve dengan npm (Testing):**
```bash
npm install -g serve
serve -s dist -l 5173
```

**Opsi C – Dev Mode (Pengembangan):**
```bash
cd web
npm install
npm run dev
```

---

## 🗄️ Setup Database

```bash
# Import schema ke MySQL
mysql -u root -p nama_database < backend/schema.sql
```

Edit `backend/.env` sesuai konfigurasi database Anda.

---

## 📝 Catatan

- Pastikan MySQL/MariaDB sudah berjalan sebelum menjalankan backend
- URL API SISTER dan Feeder dikonfigurasi di `backend/.env`
- Jika deploy di server terpisah, update `VITE_API_URL` di `.env` web dan rebuild
