Laravel 11 + Clean Architecture

Frontend va backend tach luong ro rang.

Project nay da duoc chia thanh cac layer Domain, Application, Infrastructure va Presentation. Frontend di qua web route va view, backend di qua API route va use case de giu business flow gon va de test.

Nguyen tac

  • Presentation chi xu ly HTTP, request, response va UI.
  • Application chua use case va dieu phoi luong nghiep vu.
  • Domain giu contract va quy tac cot loi cua he thong.
  • Infrastructure dong vai tro adapter toi DB, queue, mail, cache.
Frontend Flow

Luong frontend

Danh cho SSR, blade, dashboard, auth page va cac man hinh nguoi dung thao tac truc tiep.

  • Client -> web route
  • Presentation Controller
  • Blade/ViewModel
  • HTML response
Backend Flow

Luong backend

Danh cho mobile app, SPA, third-party integration va API contract JSON.

  • Client -> api route
  • API Controller
  • Application Use Case
  • Domain Contract
  • Infrastructure Repository
  • JSON response

Cau truc thu muc de xuat

Moi feature moi co the tiep tuc di theo mau nay de giu codebase on dinh khi project lon dan.

app/ |-- Application/ | `-- System/ | `-- UseCases/ | `-- GetSystemStatus.php |-- Domain/ | `-- System/ | `-- Contracts/ | `-- SystemStatusRepositoryInterface.php |-- Infrastructure/ | `-- Persistence/ | `-- System/ | `-- LaravelSystemStatusRepository.php `-- Presentation/ `-- Http/ `-- Controllers/ |-- Api/ | `-- V1/ | `-- SystemStatusController.php `-- Frontend/ `-- HomeController.php routes/ |-- web.php `-- api.php resources/views/ `-- frontend/ `-- home.blade.php