> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sertifikasitrainer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dev lokal

> Menjalankan web, API, dan renderer di laptop.

## Start cepat

```bash theme={null}
./thub doctor    # pastikan env siap
./thub dev
```

Buka [http://localhost:5757](http://localhost:5757)

## Apa yang dijalankan

`./thub dev` men-start tiga proses:

1. **API** — `bun --watch src/server.ts` di `apps/api` (port `3739`)
2. **Web** — `vite` di `apps/web` (port `5757`)
3. **Renderer** — `bun --watch` di `apps/renderer` (port `8787`)

Semua env dibaca dari `apps/api/.env` / `apps/web/.env` hasil merge.

## Port sudah dipakai

Kalau `./thub dev` gagal dengan pesan port sudah dipakai:

```bash theme={null}
curl http://127.0.0.1:3739/api/health
curl http://127.0.0.1:5757/
```

Kalau sudah `200`, dev server memang sudah jalan — buka browser saja.

Stop proses lama di port tersebut, atau ubah port di `.env.development.local`:

```bash theme={null}
PORT=3740
```

Lalu `./thub env merge` dan `./thub dev`.

## Database lokal

Default di `.env.development.local.example`:

```
postgresql://trainerhub_beta:trainerhub_beta_2026@127.0.0.1:5432/trainerhub_beta_clean
```

Bootstrap pertama kali:

```bash theme={null}
bun run db:bootstrap:local
```

Ini menjalankan migrate + seed + admin user.

## PAYMENT\_PROVIDER di lokal

Wizard setup memakai `PAYMENT_PROVIDER=manual` di override dev agar API start tanpa credential Scalev.

Kalau API error terkait Scalev, pastikan di `.env.development.local`:

```bash theme={null}
PAYMENT_PROVIDER=manual
```

## Verifikasi

```bash theme={null}
./thub doctor --smoke
```

Atau manual:

```bash theme={null}
curl http://127.0.0.1:3739/api/health
curl http://127.0.0.1:8787/health
```
