As applications grow, APIs naturally evolve. For my portfolio, I realized that REST endpoints were fetching either too much or too little data. Here is why I transitioned to GraphQL.
Over-fetching and Under-fetching Problems#
With a REST setup, loading the home page required hitting three separate endpoints: profile data, recent blog posts, and featured projects. This caused multiple roundtrips and returned fields that the UI didn't immediately need.
Switching to GraphQL enabled a single, consolidated query requesting exactly the required fields. It improved client-side rendering times and simplified client-side state management significantly.
