Back

case study BRGY SYSTEM

A high-performance barangay document request system built to handle 5M+ records with millisecond response times through aggressive query optimization, caching, and a clean separation-of-concerns architecture.

Project

BRGY Request Provider – Barangay System BRGY Request Provider – Barangay System screen BRGY Request Provider – Barangay System mobile

BRGY Request Provider – Barangay System

Tech Stack

LaravelInertia.jsVue.jsTailwindRedis

Problem

  • Barangay document requests were processed manually — residents lined up for hours for basic certificates.
  • Querying large resident databases caused significant slowdowns as record counts grew into the millions.
  • N+1 query problems caused by unoptimized Eloquent relationships degraded performance at scale.
  • No address standardization — inconsistent data entry made PSGC-compliant lookups unreliable.
  • The codebase lacked structure — business logic was mixed into controllers with no clear separation.

Solution

  • Built a fully digital request portal allowing residents to submit and track document requests online.
  • Applied Redis caching on frequently accessed queries, cutting repeated database hits to near zero.
  • Eliminated N+1 problems with eager loading, query scoping, and strategic DB indexing on high-traffic columns.
  • Integrated PSGC (Philippine Standard Geographic Code) for standardized, validated address data across all records.
  • Refactored the architecture with Services, Repositories, Traits, and Enums for clean separation of concerns.

Result

5M+ Records Handled

The system sustains millisecond query response times even at 5 million+ resident records.

~0ms Cache Hit Time

Redis caching eliminates repeated DB queries — frequently accessed data is served instantly.

Zero N+1 Query Problems

Eager loading and indexed queries removed all N+1 bottlenecks across the entire application.