Sellers on MERN Marketplace can create shops and add products to each shop. To store the shop data and enable shop management, we will implement a Mongoose Schema for shops, backend APIs to access and modify the shop data, and frontend views for the shop owner and buyers browsing through the marketplace.
Shops in the Marketplace
Shop model
The Shop schema defined in server/models/shop.model.js will have simple fields to store shop details, along with a logo image, and a reference to the user who owns the shop.
- Shop name and description:Â Name and description fields will be string types, with name as a required field:
name: {
type: String,
trim: true,
required: 'Name is required'
},
description: ...