Back to projects

perpustakaan_laravel

A full library management system — catalog, borrowing/return flow with fine calculation, and an authenticated staff dashboard.

LaravelPHPMySQLBootstrap 5.3Chart.jsPHPUnit

Background

Built as an ongoing Laravel practicum project, later extended far past the assignment scope into a production-style application.

Problem

Campus library workflows (borrowing, returns, fines, catalog search) were manual and error-prone; the goal was a system that models real circulation-desk operations correctly, including edge cases like overdue fines and schema consistency.

Architecture

Laravel MVC with a service-layer separation for transaction logic, Eloquent models for books/members/transactions, Blade + Bootstrap 5.3 for the UI, and Chart.js for the dashboard.

Challenges & Solutions

Challenge

Schema mismatch in the transactions table

A critical bug surfaced where the `transaksis` table schema didn't match what the borrowing logic expected, silently corrupting fine calculations.

Solution

Migration audit + regression tests

Traced the mismatch back to a migration drift, patched the schema, and backfilled PHPUnit feature tests so the same class of bug can't silently reappear.

Challenge

Global search across multiple entity types

Needed one search bar to correctly query books, members, and transactions without N+1 query blowups.

Solution

Indexed, scoped Eloquent queries

Used query scopes and proper indexes instead of loading full collections into memory for search.

Testing

PHPUnit feature tests covering the borrowing/return/fine flow, with a dedicated regression test for the schema-mismatch bug.

Lessons Learned

  • Schema drift is invisible until it corrupts business logic — migrations need the same review rigor as application code.
  • Writing the regression test *before* fixing the bug made the fix verifiable, not just plausible.

Future Improvements

  • Role-based permissions for multiple staff accounts.
  • Automated fine notifications via email/WhatsApp.