API Integration Guide
Environment Variables
Contoh baseline:
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000/api/v1LARAVEL_OPENAPI_URL=http://localhost:8000/docs/v1/openapi.yaml
Integration Workflow
- Backend update endpoint + OpenAPI spec.
- Regenerate frontend API client/types (if a generator is used).
- Implement service/use-case di layer API frontend.
- Tambahkan error handling + loading state + fallback UI.
- Jalankan quality gate.
Error Handling Rules
- Selalu tangani status 4xx/5xx secara eksplisit.
- Jangan expose raw server error ke UI user.
- Logging error teknis ke console/monitoring channel internal.
Auth Notes
If using cookie-based auth (e.g., Sanctum):
- Backend CORS must allow the frontend origin.
withCredentialsaktif di HTTP client.- Use a consistent host in local dev to avoid cookie issues.