# StarCustomPrinting — Panduan Instalasi

Source code aplikasi custom printing / POD commerce (Laravel 12).

## Mulai di sini

1. Baca **`BACA-DULU.txt`** (di root zip)
2. Buka **`PANDUAN-INSTALASI.html`** di browser — panduan HTML lengkap hosting + VPS
3. Centang langkah di **`CHECKLIST-INSTALASI.txt`**

## Dua versi paket

| File | Isi | Untuk siapa |
|------|-----|-------------|
| **`starcustomeprinting-full.zip`** | + folder `vendor/` + panduan lengkap | **Pembeli / hosting tanpa Composer** |
| `starcustomeprinting-source.zip` | Tanpa vendor (perlu `composer install`) | Developer |

## Cara termudah: Wizard Instalasi (tanpa terminal)

Setelah upload source ke server dan arahkan document root ke folder **`public/`**:

1. Buka **`https://namadomain.com/install`**
2. Ikuti 4 langkah wizard:
   - Cek persyaratan server
   - Pilih **SQLite** atau **MySQL**
   - Isi nama toko, URL, akun admin
   - Klik **Instal sekarang**

Wizard otomatis menulis `.env`, migrate, seed data demo, dan membuat admin.

> Jika sudah terinstal, `/install` akan redirect ke homepage. Untuk reinstall, hapus file `storage/app/installed` dan kosongkan/hapus `.env`, lalu buka `/install` lagi.

---

## Persyaratan server

| Komponen | Minimum |
|----------|---------|
| PHP | **8.2+** (disarankan 8.3) |
| Ekstensi PHP | `openssl`, `pdo`, `mbstring`, `tokenizer`, `xml`, `ctype`, `json`, `bcmath`, `fileinfo`, `curl` |
| Composer | 2.x |
| Web server | Nginx / Apache (document root → folder **`public/`**) |
| Database | SQLite (default) atau MySQL/MariaDB |
| Cron | Wajib untuk reminder pembayaran & scheduler Laravel |

Opsional: Node.js 18+ hanya jika Anda ingin rebuild asset frontend (`npm run build`). Aplikasi sudah bisa jalan dengan Tailwind CDN.

---

## Instalasi cepat (VPS / Cloud)

```bash
# 1. Upload & extract zip ke folder web, misalnya:
cd /var/www/namadomain.com

# 2. Dependency PHP
composer install --no-dev --optimize-autoloader

# 3. Environment
cp .env.example .env
php artisan key:generate

# Edit .env — minimal set:
# APP_NAME="Toko Anda"
# APP_ENV=production
# APP_DEBUG=false
# APP_URL=https://namadomain.com

# 4. Database SQLite (default)
touch database/database.sqlite
chmod 664 database/database.sqlite
# Atau gunakan MySQL — ubah DB_* di .env

# 5. Migrate + data awal (admin, kategori, produk demo)
php artisan migrate --force
php artisan db:seed --force

# 6. Permission
chmod -R ug+rwx storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache database/database.sqlite

# 7. Cache production
php artisan config:cache
php artisan route:cache
php artisan view:cache

# 8. Storage symlink (upload gambar)
php artisan storage:link
```

### Nginx (contoh)

```nginx
server {
    listen 80;
    server_name namadomain.com;
    root /var/www/namadomain.com/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}
```

Aktifkan SSL dengan Certbot (`certbot --nginx`).

---

## Shared hosting (cPanel / Plesk)

1. Upload isi zip ke folder di luar `public_html`, misalnya `/home/user/starcustom`.
2. Arahkan **document root** subdomain/domain ke **`/home/user/starcustom/public`**.
3. Via **Terminal** atau **Setup PHP App**, jalankan perintah Composer & Artisan di atas.
4. Pastikan PHP versi **8.2+** dipilih di panel hosting.
5. Tambahkan **Cron Job** (lihat bawah).

Jika hosting tidak punya SSH: gunakan fitur **Git Deploy** / **Composer** panel, atau install lokal lalu upload folder `vendor` (ukuran lebih besar).

---

## Cron job (wajib)

Tambahkan di crontab server:

```cron
* * * * * cd /path/ke/project && php artisan schedule:run >> /dev/null 2>&1
```

Digunakan untuk: pengingat pembayaran, maintenance scheduler Laravel.

---

## Login admin default

Setelah `db:seed`:

| | |
|---|---|
| URL | `https://namadomain.com/login` |
| Email | `admin@ciptaloka.test` |
| Password | `password` |

**Segera ganti password** setelah login pertama.

Admin panel: `https://namadomain.com/admin`

---

## Konfigurasi setelah install

Semua di **Admin → Pengaturan**:

| Tab | Isi |
|-----|-----|
| Toko & Kontak | Nama toko, WA, email |
| Pembayaran | Rekening transfer + **Tripay** (API key, private key, merchant code) |
| Operasional | SLA produksi, ongkir |
| Notifikasi | Email (Mailketing/SMTP), WhatsApp (StarSender) |

### Tripay Payment Gateway

1. Daftar merchant di [tripay.co.id](https://tripay.co.id/developer)
2. Admin → Pengaturan → Pembayaran → aktifkan Tripay, isi credential
3. Set **Callback URL** di dashboard Tripay:
   ```
   https://namadomain.com/callback/tripay
   ```
4. Aktifkan channel (QRIS, VA, Indomaret, dll.) di merchant Tripay
5. Mode **Sandbox** untuk testing, **Production** untuk live

### RajaOngkir

Admin → **Ongkir & ekspedisi** — pilih provider RajaOngkir, isi API key & origin.

---

## Troubleshooting

| Masalah | Solusi |
|---------|--------|
| 500 / permission denied | `chmod -R ug+rwx storage bootstrap/cache` |
| APP_KEY missing | `php artisan key:generate` |
| CSS kosong | Normal jika CDN; pastikan server bisa akses internet |
| Callback Tripay gagal | Pastikan URL HTTPS, CSRF except sudah ada di `bootstrap/app.php`, whitelist IP Tripay jika perlu |
| SQLite readonly | `chmod 664 database/database.sqlite` + ownership www-data |

---

## Struktur fitur utama

- Storefront, editor desain, keranjang, checkout
- Transfer bank manual + Tripay (QRIS, e-wallet, retail)
- Produksi, QC, packing, resi
- Notifikasi email & WhatsApp
- Seller store, dropship, afiliasi, komisi
- Admin CMS, voucher, laporan

---

## Lisensi & support

Software ini dijual sebagai lisensi source code. Hubungi penjual untuk update versi dan bantuan instalasi.
