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

02 - Context Boundaries

Tujuan dokumen ini: memastikan boundary Central, Tenant, dan Shared jelas dan konsisten.

Central Context#

Gunakan central untuk:
Auth global (register/login/refresh/logout)
User global profile/security/session
Tenant registry dan onboarding
Platform billing catalog & billing admin
Public billing catalog/webhook ingress
Global audit/security events
Contoh file:
app/Http/Controllers/Api/V1/Central/Auth/MeController.php
app/Http/Controllers/Api/V1/Central/Billing/PlanController.php
app/Services/Central/Auth/AuthorizationResolver.php

Tenant Context#

Gunakan tenant untuk:
Data operasional tenant-scoped
Integrasi tenant (feature-gated)
Master data tenant (taxonomy CRUD)
Subscription usage yang butuh tenant context + token tenant
Contoh file:
app/Http/Controllers/Api/V1/Tenant/Billing/SubscriptionController.php
app/Http/Controllers/Api/V1/Tenant/MasterData/TaxonomyController.php
app/Models/Tenant/MasterData/Taxonomy.php

Shared Context#

Gunakan shared untuk logic yang dipakai lintas context, tanpa mengandung business policy spesifik context.
Contoh file:
app/Services/Shared/Billing/SubscriptionService.php
app/Http/Middleware/Shared/RequestContextMiddleware.php

Boundary Rules#

Controller central tidak boleh query model tenant secara langsung tanpa resolver/context yang benar.
Controller tenant wajib lewat stack middleware tenant (tenant.context, tenant.token, dsb).
Model tenant menggunakan trait HasTenantClusterConnection agar koneksi cluster resolved otomatis.
Endpoint auth tetap central walaupun dipakai setelah tenant login.

Authorization Boundary#

Auth identity tetap central (users, sanctum token, refresh token).
Authz role/permission:
tenant-scoped di cluster tenant
platform admin di central
Resolver: app/Services/Central/Auth/AuthorizationResolver.php
Diubah pada 2026-03-03 22:25:30
Sebelumnya
01 - Project Structure
Berikutnya
03 - Central Auth Runtime
Built with