Daniel’s Substack

Daniel’s Substack

How I optimized an API and reduced latency refactoring a PHP backend to Node.js

Faster response equals better user experience and more engagement

Daniel Osorio's avatar
Daniel Osorio
Mar 17, 2025
∙ Paid
Share

ServeNow, an app to make a difference

Last year (2024), I helped hundreds of volunteers spend less time waiting for screens to load and more time making a difference.

I worked for Serve The City (STC) on their app, ServeNow.

ServeNow is an innovative app to help connect volunteers with local non-profit organizations to volunteer.

Because ServeNow connects volunteers with local organizations, its user experience is crucial in helping users find and register for their favorite volunteering activities.

The app streamlines the registration process, communication, information retrieval, and updates between volunteers and local organizations. Before the app, these processes were handled by phone calls and emails.

ServeNow helps the staff of Serve The City focus on other tasks by eliminating the overhead associated with coordinating logistics between volunteers and the organizations they serve.

Hence, a well-designed mobile application can benefit three key stakeholders: Serve The City, volunteers, and non-profit organizations.


Refactoring the backend

The architecture of the app, like any other, consists of three layers:

  • The front end is what the user sees on their device.

  • The back end handles all data processing behind the scenes.

  • The database is where the data lives permanently.

When I started working on ServeNow, the backend was based on PHP and in a terminal state. The backend struggled with the number of volunteers and requests it received, causing users to experience delays in their actions.

We knew that, depending on the request, sometimes it could take a few seconds to get a response from the server.

They hired me to help them refactor it into a more efficient solution based on Node.js.

In itself, Node.js is fast and reliable for applications like ServeNow.

However, just using Node.js without any additional data management solutions may not be the best approach.

The plan was to add several layers of data management to make the backend even faster:

  • Local server cache: Caches data on the server that stores frequently accessed data locally.

  • External cache via Redis: Relying on an external caching layer service to store data.

  • Query optimization: Optimize the queries that collect data from the database by separating/grouping query logic when necessary.

  • Redux for state management: Enhance the front end to use a state management architecture so there would be fewer calls to the back end.

I will review each solution individually, with examples of how we made it happen.

Local server cache

Keep reading with a 7-day free trial

Subscribe to Daniel’s Substack to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Daniel Osorio
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture