# Roster Guru PRO - Ready to Deploy

Paket ini SIAP DEPLOY. Tidak perlu npm install, tidak perlu build.

## Yang Sudah Termasuk:
- Source code (compiled ke production build)
- node_modules (bundled untuk standalone)
- Database SQLite (sudah ada data demo)
- Static assets
- Start scripts (Linux/Mac & Windows)

## Cara Menjalankan:

### Linux / Mac:
```bash
# 1. Extract ZIP
unzip Roster-Guru-PRO-Deploy.zip
cd roster-guru-pro-deploy

# 2. Jalankan
./start.sh

# 3. Buka browser
# http://localhost:3000
```

### Windows:
```bat
1. Extract ZIP
2. Buka folder roster-guru-pro-deploy
3. Double-click start.bat
4. Buka browser ke http://localhost:3000
```

### Manual (jika start.sh tidak jalan):
```bash
cd standalone
NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0 bun server.js
# atau
NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0 node server.js
```

## Requirements:
- Node.js 18+ ATAU Bun (salah satu)
- Tidak perlu npm install - sudah bundle!
- Tidak perlu build - sudah compiled!

## Port:
- Default: 3000
- Custom: set PORT=4000 ./start.sh

## Database:
- SQLite (file: ./db/custom.db)
- Tidak perlu setup database server
- Data tersimpan di localStorage browser juga

## Struktur Folder:
```
roster-guru-pro-deploy/
├── standalone/          # Server + node_modules + build
│   ├── server.js        # Entry point
│   ├── .next/           # Compiled build
│   ├── node_modules/    # Dependencies (bundled)
│   ├── public/          # Static files
│   ├── .env             # Environment config
│   └── package.json
├── prisma/              # Database schema
├── db/
│   └── custom.db        # SQLite database
├── start.sh             # Linux/Mac startup
├── start.bat            # Windows startup
└── README-DEPLOY.md     # File ini
```

## Deploy ke VPS / Cloud:

### Option 1: Direct Run
1. Upload ZIP ke server
2. Extract: `unzip Roster-Guru-PRO-Deploy.zip`
3. Run: `./start.sh`
4. Setup reverse proxy (nginx) ke port 3000

### Option 2: PM2 (recommended)
```bash
npm install -g pm2
cd roster-guru-pro-deploy/standalone
pm2 start server.js --name roster-guru
pm2 save
pm2 startup
```

### Option 3: Docker
Buat Dockerfile:
```dockerfile
FROM node:18-alpine
WORKDIR /app
COPY . .
EXPOSE 3000
CMD ["node", "standalone/server.js"]
```

Build & run:
```bash
docker build -t roster-guru-pro .
docker run -p 3000:3000 roster-guru-pro
```

## Troubleshooting:

Q: Error "Cannot find module" 
A: Pastikan jalankan dari folder standalone: `cd standalone && node server.js`

Q: Port 3000 sudah dipakai
A: Set PORT lain: `PORT=4000 ./start.sh`

Q: Database error
A: Pastikan folder db/ ada dan writable

## Backup Data:
- Data tersimpan di browser localStorage (otomatis)
- Export manual via Settings > Export JSON
- Database SQLite di ./db/custom.db
