01 - Project Structure#
Dokumen ini menjelaskan struktur kode backend yang berlaku saat ini agar tim dev mudah bernavigasi.Project Tree (Context-Based)#
Project Structure#
app/
├── Http/
│ ├── Controllers/Api/V1/
│ │ ├── Central/
│ │ │ ├── Auth/
│ │ │ └── Billing/
│ │ └── Tenant/
│ │ ├── Billing/
│ │ ├── Integration/
│ │ └── MasterData/
│ ├── Middleware/
│ │ ├── Shared/
│ │ ├── Central/
│ │ └── Tenant/
│ ├── Requests/V1/
│ │ ├── Central/
│ │ └── Tenant/
│ └── Resources/V1/
│ ├── Central/
│ └── Tenant/
├── Models/
│ ├── Central/
│ │ ├── Audit/
│ │ ├── Authorization/
│ │ ├── Billing/
│ │ ├── MasterData/
│ │ └── Tenancy/
│ ├── Tenant/
│ │ ├── Audit/
│ │ ├── Authorization/
│ │ ├── Identity/
│ │ └── MasterData/
│ └── User/
├── Services/
│ ├── Central/
│ │ ├── Auth/
│ │ ├── Billing/
│ │ ├── Hybrid/
│ │ └── Tenancy/
│ └── Shared/
│ └── Billing/
├── Support/
│ ├── Database/
│ ├── Security/
│ └── Tenancy/
├── Jobs/Central/
├── Listeners/Central/
├── Notifications/Central/
└── Mail/
├── Central/
└── Shared/
routes/
├── api-v1.php
├── central.php
├── tenant.php
├── central/
└── tenant/
tests/
├── Feature/
│ ├── Central/
│ ├── Tenant/
│ └── Shared/
└── Unit/
Layer Mapping#
Controllers: entrypoint HTTP + orchestration request/response.
Requests: validasi input API.
Resources: shape output API ke FE.
Services/Central: business logic khusus central domain.
Services/Shared: reusable business logic lintas context.
Support: infra/helper (connection resolving, alerting, context helper).
Models/Central: persistensi central DB.
Models/Tenant: persistensi tenant cluster DB.
Models/User: identity/auth global.
Route Structure#
include routes/central.php
include routes/tenant.php
routes/central/auth-runtime.php
routes/central/billing-public.php
routes/central/billing.php
routes/tenant/billing.php
routes/tenant/integrations.php
routes/tenant/master-data.php (include routes/tenant/taxonomy.php)
Route Composition Flow#
Testing Structure#
Ini menjadi baseline pengelompokan file baru. Hindari menaruh file baru di root namespace lama tanpa context.Diubah pada 2026-03-03 22:25:47