# Arsitektur Sistem

## Pola

Gunakan MVC sederhana.

```text
Request
  ↓
public/index.php
  ↓
Router
  ↓
Middleware
  ↓
Controller
  ↓
Service
  ↓
Model/Repository
  ↓
Database
```

## Lapisan

### Presentation
View, layout, formulir, tabel, dan komponen UI.

### Application
Controller, service, validator, dan alur use case.

### Domain
Aturan status, hak akses, SLA, dan penyelesaian.

### Data
PDO, model, query, migrasi, dan audit.

## Prinsip

- controller tipis;
- logika bisnis di service;
- query database tidak ditaruh di view;
- konfigurasi dari `.env`;
- setiap endpoint memeriksa hak akses;
- file upload disimpan di luar folder publik;
- error production tidak menampilkan detail internal.

## Struktur Awal

```text
app/
├── Config/
├── Controllers/
├── Core/
├── Exceptions/
├── Helpers/
├── Middleware/
├── Models/
├── Services/
└── Views/
```

## Route Awal

```php
$router->get('/', [HomeController::class, 'index']);
$router->get('/system/database', [SystemController::class, 'database']);
```

## URL Lokal

```text
http://localhost/bkkbn_eticketing/public
```
