Improve Data Retrieval
Replace full-collection retrieval with server-side query processing that returns only records matching the user's requested criteria.
Software Developer • Enterprise Applications • AI Solutions
CS 499 Capstone Enhancement
This enhancement revisits the Travlr Getaways full-stack travel management application originally developed in CS 465: Full Stack Development I. The application includes a customer-facing Express and Handlebars website, an Angular administrative single-page application, a RESTful Express API, and a MongoDB database.
The original application retrieved complete collections of trip records before allowing the client applications to search, sort, or organize the information. While this approach worked with a limited dataset, it created unnecessary data transfers and required each interface to perform additional processing.
This enhancement redesigned the data-retrieval process by moving searching, filtering, sorting, and pagination to the server. The REST API now processes query parameters and returns only the subset of trip records requested by the user, improving scalability, consistency, and overall application performance.
Replace full-collection retrieval with server-side query processing that returns only records matching the user's requested criteria.
Limit unnecessary network traffic by introducing pagination and restricting the number of trip records returned during each API request.
Allow users to search, filter, and sort travel packages using REST API query parameters and multiple trip attributes.
Centralize query logic within the REST API so the Angular administrative application and customer-facing website provide consistent results.
The REST API receives search, filtering, sorting, and pagination values through query parameters. The application validates these values before using them to construct the database request.
A query object is created dynamically based on the supplied criteria. Only filters included in the request are added, allowing users to combine search terms, price ranges, and duration requirements.
When price or duration sorting is requested, MongoDB aggregation operations convert legacy text values into numeric values so the records can be ordered accurately.
Matching records are sorted using the selected field and direction. Pagination calculations determine which records should be skipped and how many should be returned.
The API returns only the matching page of records rather than the entire trip collection. Both application interfaces then display the same consistently processed results.
Designed and evaluated a server-side data-retrieval solution that applies searching, filtering, sorting, aggregation, and pagination while considering efficiency, scalability, and design trade-offs.
Used REST API query processing and MongoDB aggregation techniques to improve application performance and deliver useful functionality across multiple user interfaces.
Centralized business logic within the REST API, reduced duplication across the Angular and Express interfaces, and maintained compatibility with the existing application architecture.
Documented the enhanced query functionality, implementation decisions, technical trade-offs, and application behavior through the repository README and capstone narrative.
Validated query parameters, restricted accepted sorting and pagination values, and preserved secure interactions with the application's existing authenticated API.
A significant challenge involved the representation of price and duration values in the original database. These values were stored as text, which prevented standard numeric sorting from producing accurate results. Permanently changing the data types would have required a database migration and broader schema redesign.
Because the database redesign belongs to the next enhancement, I implemented MongoDB aggregation-based conversions as an interim solution. This allowed the application to perform accurate numeric sorting while preserving compatibility with the existing records and interfaces.
This decision balanced immediate performance and functionality requirements against the long-term goal of improving the underlying database schema. It also prevented unnecessary scope expansion during the Algorithms and Data Structures enhancement.
This enhancement reinforced that algorithmic thinking in modern software engineering extends beyond implementing traditional textbook algorithms. In a full-stack application, it also involves designing efficient methods for retrieving, filtering, organizing, and transferring data.
Moving search, filtering, sorting, and pagination from the clients to the server improved scalability and reduced duplicated logic. It also created a more consistent experience because both the Angular administrative application and the customer-facing website now rely on the same centralized query-processing logic.
The enhancement also demonstrated how strongly data representation affects algorithmic efficiency. Discovering that prices and durations were stored as text required evaluating several possible solutions and selecting one that addressed the immediate need without disrupting the existing architecture.
Overall, this work strengthened my understanding of scalable data processing, API design, algorithmic trade-offs, and the importance of aligning technical decisions with the current phase of the software development lifecycle.
The original repository contains the Travlr Getaways application as developed during CS 465. The Algorithms and Data Structures branch contains the completed server-side searching, filtering, sorting, pagination, validation, interface, and data-processing enhancements.