I am using Supabase to host stock data for an ecommerce store I’m building on Divhunt. I’m able to bring the items through using API calls. I’m trying to figure out best practice while there’s no native integration and for pulling through API data in general.
Should I conduct all the filtering backend and/or with API queries? Or should I pull all stock through and let Divhunt and it’s filter plugin sort items? I have between 500-700 items at any one time.
I want to be as performant as possible, but allow the user to filter between related categories rather than be restricted to a specific sub-sets of products which have already been filtered and pulled through.
Depending on your growth, if you are planning to have many more items, then I would enhance the REST API request to support dynamic properties for filtering, as in this way, having 1000 or 50,000 products will still remain fast.
Otherwise if you will stay at < 1000 products, fetching them all at once is also a good solution and much easier for filtering.
Whatever you choose, it’s possible with Divhunt, just the first option is a bit complicated but I can help ofc.
Is there a tutorial for dynamic filtering using the API I can watch? Or is it in your docs somewhere? Love the idea and it really means anything is possible with Divhunt. Exciting!
Oh I also have a second question. Obviously, each item I’ve created needs its own product page. Do I just connect the page itself to the API as a source? If so, how do I get it to iterate until there is a page for each product?
We are lacking people who can help with documentation and tutorials, but hopefully in the near future we can handle those.
So what you need to do is
Add dynamic properties, let’s say you want to filter by category, so add the property category and default value (optional)
In the query params, or depending how the API is built for filtering, pass the dynamic property
Now inside builder, you’ll see a “Category” property to configure on Source settings, which means now you can dynamically adjust the category to show different products.
So once you have this configured and you have filters ready (HTML) I can show you how to make it working dynamically when clicked.
Yes, it’s also possible to create dynamic single page. In this case your API needs ability to return single row/item based on ID or maybe SLUG as well.
So what you need to do is create another Request which returns single row.
If you can, please share your domain name so I can check, configure for you and record video to explain how did I do it.
Very kind and much appreciated! My Divhunt link is https://kubehome.divhunt.art/. You can look at www.kubehome.co.uk which is my Webflow site to get a feel for it. Right now neither store are displaying products but that should be fixed in a couple hours. I’m having some electrical work done in my home and I’m self-hosting Supabase on my HomeLab. I’m more than happy to add you to my Supabase instance, too, once my server’s back on, if that helps?
My products are rows and I have both a UUID and slugs as item keys. So creating single pages sounds achievable.
Sounds good, I am also bit busy right now, but in couple of hours I can join you.
Slug is much better for SEO, we should use slug.
Please share access to Supabase, I want to experience it, and hopefully in near future build a plugin for it.