# Need help for the best database schema for marketplace project

**URL:** <https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831>\
**Category:** Database\
**Created:** [May 22, 2023, 7:48am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831 "2023-05-22T07:48:25Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 22, 2023, 7:48am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/1 "2023-05-22T07:48:25Z")

</div>

Hello, newbie needs help 😃

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 😃

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 22, 2023, 7:56am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/2 "2023-05-22T07:56:39Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 6:21am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/3 "2023-05-23T06:21:54Z")

</div>

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](https://us1.discourse-cdn.com/bubble/original/3X/d/a/da1a796dacc6df2d2d5350e1806a7d023095062c.png)

 ![Screen Shot 2023-05-23 at 13.16.34](https://us1.discourse-cdn.com/bubble/original/3X/2/3/23c93312a9646adb1a9ed37ae38ff132d6a9a017.png)

Form / page design

 ![Screen Shot 2023-05-23 at 13.17.15](https://us1.discourse-cdn.com/bubble/original/3X/9/2/92b1f692ced3d8ebec4af4026b55606a6b71c065.png)

Workflow

 ![Screen Shot 2023-05-23 at 13.17.35](https://us1.discourse-cdn.com/bubble/original/3X/2/5/25f2e383016760c00b4dfea01f94b720beba192b.png)  
 ![Screen Shot 2023-05-23 at 13.17.44](https://us1.discourse-cdn.com/bubble/original/3X/a/8/a8db18a98c1a98fbcbc42042a41950907bf496ae.png)  
 ![Screen Shot 2023-05-23 at 13.17.52](https://us1.discourse-cdn.com/bubble/original/3X/c/2/c2e9c52140e6b2f8a3c8b8c0909b738bedb9f7ea.png)

Data inside database

 ![Screen Shot 2023-05-23 at 13.18.23](https://us1.discourse-cdn.com/bubble/original/3X/c/2/c2bd08e32d35ac8261deca6582bff366df538cc4.png)  
 ![Screen Shot 2023-05-23 at 13.18.14](https://us1.discourse-cdn.com/bubble/original/3X/8/9/893dbe070fbef278be095a00f5f6723798dc00fb.png)

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

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 23, 2023, 6:50am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/4 "2023-05-23T06:50:09Z")

</div>

> [@fogsgeneral](#):
>
> 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:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/0/40d207e9d6d43a257e9b1d4e2c3c0174d66ae43e.png)

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)?

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/c/4c60ff4cac7b53585fda9ffd1e0377cbbc8a068a.png)

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

---

<div class="post-metadata">

**Author:** ![lindsay\_knowcode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/lindsay_knowcode/32/92967_2.png) [@lindsay\_knowcode](https://forum.bubble.io/u/lindsay_knowcode)\
**Post date:** [May 23, 2023, 7:10am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/5 "2023-05-23T07:10:07Z")

</div>

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

[https://manual.bubble.io/help-guides/data/the-database/database-structure-by-app-type/marketplace-apps](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.

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 7:13am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/6 "2023-05-23T07:13:51Z")

</div>

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

 ![Screen Shot 2023-05-23 at 14.07.18](https://us1.discourse-cdn.com/bubble/original/3X/6/3/63180949ac9bc5009dbf9ad1d331700717d75143.png)

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

 ![Screen Shot 2023-05-23 at 14.04.14](https://us1.discourse-cdn.com/bubble/original/3X/6/0/609169d722b6f4a276528e02504d64d1065f6a5b.png)  
 ![Screen Shot 2023-05-23 at 14.04.20](https://us1.discourse-cdn.com/bubble/original/3X/9/f/9fade40226ea0a09cc6fd827b8b603da3c8f1778.png)  
 ![Screen Shot 2023-05-23 at 14.04.26](https://us1.discourse-cdn.com/bubble/original/3X/7/3/73d251ac541abccc2817b45211ba504afd7863b4.png)

the final data I get is

 ![Screen Shot 2023-05-23 at 14.04.47](https://us1.discourse-cdn.com/bubble/original/3X/1/d/1d2f48cf8f1397fdddcde44838fdfd83f18eb8e2.png)  
 ![Screen Shot 2023-05-23 at 14.04.37](https://us1.discourse-cdn.com/bubble/original/3X/2/1/21034e344f50c82114384597e16ee2475270208f.png)

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](https://us1.discourse-cdn.com/bubble/original/3X/2/7/27271e4caa27ee4c41af3cdff36efa42a42c09fb.png)

the text is grouped inside the PRODUCT group name.

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 7:20am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/7 "2023-05-23T07:20:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 23, 2023, 7:25am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/8 "2023-05-23T07:25:50Z")

</div>

> [@fogsgeneral](#):
>
> 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?

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)?

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 7:39am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/9 "2023-05-23T07:39:14Z")

</div>

Hello Adam,  
yes the items data will contain more information, here I update the data  
 ![Screen Shot 2023-05-23 at 14.31.44](https://us1.discourse-cdn.com/bubble/original/3X/5/1/516ea52ccc9d4a3cb743c53b4c7d085524b768b5.png)

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

> [@adamhholmes](#):
>
> 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)?

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

 ![Screen Shot 2023-05-23 at 14.34.41](https://us1.discourse-cdn.com/bubble/original/3X/3/8/38e4669443609f711263570ae1f14b007b29a5aa.png)

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.

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 23, 2023, 7:51am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/10 "2023-05-23T07:51:39Z")

</div>

> [@fogsgeneral](#):
>
> Yes I already do that, but the data now show in my design.

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?

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 8:05am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/11 "2023-05-23T08:05:49Z")

</div>

> [@adamhholmes](#):
>
> How and where are you defining the parent group’s product?

I manage the component tree like this

 ![Screen Shot 2023-05-23 at 15.04.24](https://us1.discourse-cdn.com/bubble/original/3X/e/2/e285a28b64359c6bd28a405bf9f8fcaa2b53215e.png)

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

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 23, 2023, 8:10am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/12 "2023-05-23T08:10:26Z")

</div>

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).

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/d/6/d698a6768fc2551e2d966043b86411a0267fb9a4.png)

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.

---

<div class="post-metadata">

**Author:** ![fogsgeneral](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fogsgeneral/32/188467_2.png) [@fogsgeneral](https://forum.bubble.io/u/fogsgeneral)\
**Post date:** [May 23, 2023, 8:31am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/13 "2023-05-23T08:31:13Z")

</div>

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

 ![Screen Shot 2023-05-23 at 15.27.05](https://us1.discourse-cdn.com/bubble/original/3X/4/7/47e4012f97b2bb105883632136e2553a5c76b38b.png)

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,

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 23, 2023, 8:34am UTC](https://forum.bubble.io/t/need-help-for-the-best-database-schema-for-marketplace-project/263831/14 "2023-05-23T08:34:50Z")

</div>

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).
