Navigating collections: pages or fetch collections on click?

Hi,
What setup would you recommend for a Amazon-like website for example, with multiple item category pages:

  1. Create pages for each category with unique API endpoints to query these items per category?
    or
  2. Create 1 page with a category navbar. When clicked on a category => send request to Xano and fetch category items => fetch collection. (all in 1 page)

Are there any differences in terms of functionality/performance?

Thanks!

Hi @Philip1 :wave:

Each approach has its pros and cons.

Option 1 might be making superfluous API calls that slow down the user for no reason (if the data related to a category is not too heavy to start with, might as well fetch it once and for all, maybe use pagination to optimize the UX)

Option 2 might slow down the app and make for a poor user experience (if the data related to a category is too voluminous for a browser to handle well, best make an API call to fetch each item individually)

That said, even if you went with option 1, I don’t think you would need to create specific, unique endpoints for each page or item. You would want one endpoint with a dynamic input to filter the data you want.

To help you make an informed decision, I’d recommend this section of the WeWeb Academy Handbook and these two videos:

Many thanks!
Both tutorials on backend filters and pagination were very interesting and helpful.

1 Like