Need help for the best database schema for marketplace project

Hello, newbie needs help :smiley:

I have two database ideas for my marketplace project.
VER-1
Product

  • product name - text
  • product desc - text
  • product category - product category ( OS )
  • product thumbnail - image
  • product itemList - ITEMS ( list )

Item

  • item sku - text
  • item brand - brand
  • item stock - number
  • item price - number
  • item OG - product
  • item variant - variant ( OS )
  • item images - images ( list )

VER-2
Product

  • product name - text
  • product desc - text
  • product category - product category ( OS )
  • product thumbnail - image
  • item SKU - text
  • item brand - brand
  • item stock - number
  • item price - number
  • item variant - variant ( OS )
  • item images - images ( list )

by looking for bubble performance and workload, which version is the best?
also if version 1 is the best one, can someone teach me to build the relation between two tables,
the use case is :

  • Admin adds a new product to the platform where each product has a specific detail ( items )
  • users can sort by category, prices, etc.
  • one product listing page only shows a little information about a product, but the detail will be shown on the product detail page.

Your help will make my life easier :smiley:

I’m assuming your ‘Item’ datatype is like a product variant? (if not, what is it, and why is it a separate datatype?)

And you can have multiple product variants for a product? In which case you’ll definitely want to keep them as two separate datatypes.

If the question is purely about WU consumption then VER-1 looks like the way to go.

But if performance is part of the equation , then probably getting rid of the list of product items, and adding a product field to the Item datatype would be better (although it rather depends on the number of Items related to a Product, and how and where you’ll be loading/displaying them).

Hello, Yes correct.
the main goal is we want to split the product and items… ( actually, this is because we follow best erd practices for marketplace databases)
right now the situation is :

  • I was able to create product detail ( data input to the product datatype ) BUT when the data linked ( * product itemList - ITEMS ( list ) ) let say I want to update the SKU, its always failed / the items not connected to the product.
    I’m stuck with it.

here the proces.

Database
Screen Shot 2023-05-23 at 13.16.44

Form / page design

Workflow



Data inside database


We can see the PRODUCT ITEMLIST data is empty / not linked with ITEMS data.

That’s because you’re NOT adding the newly created Item to the newly created Product You’re adding it to the Parent Group’s Product instead:

I’ve got no idea what the Parent Group’s Product is - but it’s certainly NOT the newly created product from step 1 (how could it be)?

By the look of your database screenshot, there is no parent group’s product (it’s empty) so you’re not adding the newly created Item to anything.

To do what you’re trying to do, you need to add the newly created Item (the result of Step 2) to the newly created Product (the result of Step 1) - so just change the ‘Thing to change’ to the result of step 1.

Also, why are you setting ALL the fields apart from the Item List to ‘empty’ on the new Product (after having set them initially in step 1)?

I’m guessing that’s not your intention, so make sure you remove those fields from the workflow action.

I suggest reading this if you haven’t, for pointers on how other people approach designing marketplaces. Can’t hurt. :slight_smile:

https://manual.bubble.io/help-guides/data/the-database/database-structure-by-app-type/marketplace-apps

Marketplaces connect multiple sellers of goods or services with buyers. Most of the time, a marketplace is created to bring more transparency into a market or make the buying process more efficient. While they can differ vastly from managed marketplaces to niche and B2B marketplaces, the standard business model is to capture value from each transaction. Famous examples include Airbnb, Amazon, Upwork, AliExpress.

In this guide, we take you through the creation of the data structure for a home rental marketplace like Airbnb.

I Found the Parent group’s is because in the create product from group name.

when I remove the group type of content, the parent group items is gone.
and I try to remake the workflow like this



the final data I get is


Actually is the thing I want to do, but I still doubt if is this the correct one or not ?
does the workflow is correct? does the database schema the correct one?

and now I found a new challenge.
how I can display the product data in my design?
Screen Shot 2023-05-23 at 14.12.52

the text is grouped inside the PRODUCT group name.

Hei, Lindsay…
thank for the information.
yes actually I already read the article and I use that as my base information to build the marketplace.
but maybe right now i’m facing the “linked” database problems, more to technical problem. .

some thing like .

user can create a product, product have a detail such like
variant - color, size etc
the varian color has a much colors, the size has different sizes too also user can create custom size.
how to make the workflow to build the design , and add the result to database.

more technical like that.
maybe you have idea where I can start to learn.

thank

Yep… that’s correct - although at the moment I’m not sure I really understand the purpose of your Item datatype - as there’s no additional info being stored on it - so why does it need to separate from the main Product Datatype?

Usually, a Product-Varient datatype would contain information specific to the variant (such as price, colour, size, and stock count) - whereas currently all yours contains is the SKU.

and now I found a new challenge.
how I can display the product data in my design?

I’m not so sure what you’re asking? Aren’t you already doing just that in your screenshot (i.e. displaying the Product’s Name)?

Hello Adam,
yes the items data will contain more information, here I update the data
Screen Shot 2023-05-23 at 14.31.44

First, I only add SKU to learn how the workflow process, then add more data when I can do that.

Yes I already do that, but the data now show in my design.

do you have any idea why the data not showed?

also about the product - items.
the idea is items have the different variants ( size, color, etc )
and each variant has its own data too, which one is better

Ver 1
Variant

  • Color
  • Size

Color

  • Red
  • Yellow

Ver 2
Varian ( example: color ) as an Option set
and red, yellow, etc as data.

Well I can’t possibly know without more info… but my guess would be that the Parent Group’s Product is empty.

you can check that in the Debugger.

How and where are you defining the parent group’s product?

I manage the component tree like this

the DATA PREVIEW - GRP is empty.
do i make something wrong

Yes, as I thought… you’re referring in your text elements to the Parent Group’s Product… but the Parent Group doesn’t have a product (it’s empty), as you’re not defining it (at least as far as I can see).

You need to define which Product the parent Group is holding - either in the data source, or in some workflow action.

So, as the data source is empty, unless you’re defining the Product in a workflow somewhere, there is no product in the parent group, so nothing will display.

OMG, hahahaa… its simple but give big knowledge for me.
finally the data showed.

Many thank Adam.

now I’m on the next step doing the “variant” thing… do you have something where I can start to learn?
the use case is
when users add products they can add variant types and each variant has its own data.
for example, choose variant color and add/select red,

Just create a form where your users can create variants and add the relevant data.

You’ll want to use either additional datatypes or option sets for your colours and sizes etc (depending on whether they are pre-defined values or can be created by your users).