> ## 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.

# Stack teknologi

> Bahasa, framework, database, dan layanan yang dipakai AI Mentor.

Ringkasan teknologi **production** (`app.sertifikasitrainer.com`). Dev lokal memakai stack yang sama; DB bisa Postgres lokal atau Neon.

## Diagram stack

```mermaid theme={null}
flowchart TB
  subgraph client["Client"]
    browser["Browser\nReact 19 + Vite"]
  end

  subgraph edge["Cloudflare Edge"]
    webW["Web Worker\nstatic SPA"]
    apiW["API Worker\nHono"]
    renderW["Renderer Worker\nDOCX/PPTX"]
  end

  subgraph data["Data & media"]
    neon["Neon Postgres\nvia Hyperdrive"]
    r2["Cloudflare R2\nfile upload"]
    mux["Mux\nvideo streaming"]
  end

  subgraph external["Layanan eksternal"]
    deepseek["DeepSeek API\nAI generate"]
    scalev["Scalev\npayment ID"]
    resend["Resend\nemail"]
    wsp["WSP API\ndata SKKNI"]
  end

  browser --> webW
  browser --> apiW
  apiW --> neon
  apiW --> r2
  apiW --> renderW
  apiW --> deepseek
  apiW --> scalev
  apiW --> resend
  apiW --> mux
  apiW --> wsp
  browser --> mux
```

## Per lapisan

| Lapisan           | Teknologi                                  | Catatan                                    |
| ----------------- | ------------------------------------------ | ------------------------------------------ |
| **Runtime**       | [Bun](https://bun.sh) 1.3                  | Monorepo, API dev, tests                   |
| **Frontend**      | React 19, Vite 6, TypeScript               | Port dev `5757`                            |
| **Routing**       | React Router 7                             | Public + workspace `/:slug/*` + `/admin/*` |
| **State / fetch** | TanStack Query, Axios                      | Cache API, mutations                       |
| **Styling**       | Tailwind CSS 4                             | Utility-first                              |
| **Video player**  | `@mux/mux-player-react`                    | Playback signed JWT                        |
| **API**           | [Hono](https://hono.dev) + OpenAPI         | `apps/api`                                 |
| **Auth**          | [Better Auth](https://www.better-auth.com) | Cookie session + role                      |
| **ORM**           | Drizzle ORM                                | Schema + migrate di `apps/api`             |
| **Database**      | PostgreSQL (Neon prod)                     | Hyperdrive di Workers                      |
| **Job queue**     | PgBoss                                     | Generate dokumen async                     |
| **AI SDK**        | Vercel AI SDK + DeepSeek                   | Chat, enricher, section gen                |
| **Dokumen**       | docx, docx-templates, pptxgenjs            | Renderer service                           |
| **Storage**       | Cloudflare R2 (S3 API)                     | Foto, upload file                          |
| **Video CDN**     | Mux                                        | Upload, transcode, signed playback         |
| **Payment**       | Scalev API v3                              | QRIS, VA, e-wallet                         |
| **Email**         | Resend                                     | Invite & notifikasi                        |
| **Deploy**        | Cloudflare Workers + Wrangler              | `./thub deploy`                            |
| **Docs**          | Mintlify                                   | Folder `apps/docs`                         |
| **CI**            | GitHub Actions + Biome + Vitest            | `.github/workflows/ci.yml`                 |

## Monorepo (`apps/`)

| App          | Path            | Peran                                        |
| ------------ | --------------- | -------------------------------------------- |
| **web**      | `apps/web`      | SPA trainer, admin, checkout publik          |
| **api**      | `apps/api`      | REST `/api/*`, auth, business logic          |
| **renderer** | `apps/renderer` | Render template DOCX/PPTX (+ browser worker) |
| **docs**     | `apps/docs`     | Dokumentasi ini                              |

Entry API production: `apps/api/src/worker.ts` (Workers)\
Entry API lokal: `apps/api/src/server.ts` (Bun + PM2 legacy)

## Keamanan (ringkas)

* **CSRF** — `hono/csrf` untuk origin frontend yang diizinkan
* **Rate limit** — register, generate, payment endpoints
* **Mux** — playback policy `signed` + JWT per lesson
* **Course access** — enrollment `paid` sebelum detail kursus / token video
* **Secrets** — `.env` shared → Wrangler `secret bulk`

## Env penting

Lihat [Model environment](/guides/env-model) dan [Layanan eksternal](/external/overview).

## Kode referensi

| Area              | Lokasi                     |
| ----------------- | -------------------------- |
| Mount routes      | `apps/api/src/app.ts`      |
| Schema DB         | `apps/api/src/db/schema/`  |
| Generate pipeline | `apps/api/src/generation/` |
| Payment           | `apps/api/src/payment/`    |
| Kelas & video     | `apps/api/src/kelas/`      |
| Frontend routes   | `apps/web/src/routes/`     |
