D
Engineering

Code Conventions

Dominant patterns in the codebase vs anti-patterns that emerged from lack of standards. Follow the dominant ones unless there is a strong reason.

The codebase was built by many developers without coding standards or code review. Existing patterns are not design decisions — don’t follow them automatically. But the dominant ones are safe to follow.

Key conventions (see Indonesian version for details):

  • Response API: response()->json() (1,028 usages)
  • Response page: Inertia::render() (124 usages)
  • Get user: auth()->user() (416) — not Auth::user() (33)
  • New logic goes in app/Services/, not controllers (which are bloated)
  • Vue: use <script setup> (144 of 234 pages), Inertia useForm (86 files)
  • For direct API calls, use services/axiosInstance.js (handles JWT refresh) — not raw axios
  • Check for duplicates before creating new components (6 modals, 6 loaders, 4 navbars already exist)