Garment.id
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
Home
Core APITenant APISupport CenterChangelog
Home
Core APITenant APISupport CenterChangelog
Github
Instagram
|
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
  1. Home
  • Introduction
  • 01 - Project Structure
  • 02 - Context Boundaries
  • 03 - Central Auth Runtime
  • 04 - Central Billing
  • 05 - Tenant Runtime
  • 06 - FE Integration Contracts
  • 07 - Security, Middleware, and RLS
  • 08 - Events, Jobs, Listeners, Notifications, Observers
  • 09 - Testing and Quality Gates
  • 10 - Operations Runbook
  • 11 - Architecture Decisions (ADR Ringkas)
  • 12 - API Endpoint Catalog (v1)
  • 13 - Class Catalog by Context
  • 14 - Feature Development Playbook
  • 15 - Migration and Model Conventions
  • 16 - Service, Support, and Trait Contracts
  • 17 - Auth Business Scenarios and Decision Tree
  • 18 - Config Reference and Impact
  • 19 - Migration and Model Cookbook
  • 20 - Billing and Provisioning Business Flows
  • 21 - FE Error Handling Matrix
  • 22 - Incident Playbooks
  • 23 - Data Ownership Matrix
  • 24 - Documentation Governance and Changelog
  • 25 - Tenant Authorization Backend Guide
Home
Core APITenant APISupport CenterChangelog
Home
Core APITenant APISupport CenterChangelog
Github
Instagram
|
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
  1. Home

14 - Feature Development Playbook

Dokumen ini adalah SOP implementasi fitur baru dari awal sampai siap rilis.

Objective#

Memberi alur kerja baku agar pengembangan fitur konsisten dengan arsitektur context-based (central, tenant, shared).

High-Level Flow#

Step-by-Step SOP#

1) Define Scope#

Checklist:
masalah bisnis yang diselesaikan
siapa actor utama (platform admin / tenant user / system)
apakah data bersifat global atau tenant-local
apakah butuh feature gate subscription
Output minimal:
short RFC (1 halaman)
keputusan context (central/tenant/shared)

2) Choose Context#

Gunakan aturan cepat:
central jika fitur terkait auth global, tenant registry, platform config, billing source-of-truth.
tenant jika fitur adalah data operasional tenant harian.
shared jika logic reusable lintas context tanpa business policy spesifik.

3) Schema and Migration#

jika table central: buat migration di database/migrations/central.
jika table tenant: buat migration di database/migrations/tenant.
untuk tenant migration PostgreSQL:
gunakan InteractsWithPostgresRls
aktifkan RLS + policy tenant isolation
pertimbangkan partial index untuk query path aktif
ikuti konvensi di docs/15-migration-and-model-conventions.md.

4) Model and Data Access#

model central di app/Models/Central/*.
model tenant di app/Models/Tenant/*.
model tenant evaluasi trait HasTenantClusterConnection.

5) API Layer#

route:
central: routes/central/*.php
tenant: routes/tenant/*.php
controller:
app/Http/Controllers/Api/V1/Central/* atau .../Tenant/*
request validation:
app/Http/Requests/V1/{Central|Tenant}/*
response resource:
app/Http/Resources/V1/{Central|Tenant}/*

6) Business Logic Layer#

orchestration domain di app/Services/{Central|Shared}.
infra/helper di app/Support/*.
hindari business policy berat di controller.
Jika fitur adalah default provisioning tenant:
implement class provisioner di app/Services/Central/Tenancy/Provisioning/*.
implement kontrak TenantProvisioner.
return ProvisioningResult standar.
registrasikan class di config/tenancy.php → provisioning.provisioners.
jangan jalankan provisioning langsung dari controller/runtime tenant.
trigger lewat event/listener + orchestrator.

7) Middleware and Authorization#

Pastikan untuk endpoint protected:
auth middleware (auth:sanctum)
tenant context middleware jika endpoint tenant/runtime
ability sesuai token (tenant:access, platform:access, dll)
additional guard (password.confirmed, stepup.confirmed, subscription.feature, usage.track)

8) Tests#

Lokasi test:
central feature: tests/Feature/Central/*
tenant feature: tests/Feature/Tenant/*
shared: tests/Feature/Shared/* atau tests/Unit/*
Minimal test matrix:
happy path
unauthorized/forbidden
validation error
edge case domain

9) Documentation and Contracts#

Wajib update:
domain doc terkait (03, 04, 05, 07, 11)
jika provisioning berubah: update 08, 10, 18, 20
jalankan sinkronisasi katalog:

10) Verification Gate#

Minimal command:
Jika ada perubahan migration:

Pull Request Checklist#

context sudah benar
route file sudah benar
request/resource sudah context-based
middleware dan ability sudah tepat
tests lulus
docs diupdate
FE contract diupdate jika payload berubah
provisioning path tetap single-entry via orchestrator (jika domain provisioning disentuh)
Diubah pada 2026-03-03 22:25:30
Sebelumnya
13 - Class Catalog by Context
Berikutnya
15 - Migration and Model Conventions
Built with