GitHub - aayushpandya/cobblr: This repository contains codebase for the Cobblr website, e-commerce platform where customers can browse and purchase a wide range of shoes. (original) (raw)
Our proposed project is Cobblr which represents a shoe retail company. The goal of this project is to develop an online website for a shoe retail business. The website will serve as an e-commerce platform where customers can browse and purchase a wide range of shoes. The primary objective is to create an engaging and user-friendly online shopping experience that showcases the footwear collection and drives sales. Cobblr recognizes that fashion knows no bounds and seeks to create a seamless online experience for individuals of all ages and fashion preferences. The website aims to provide a curated collection of classy and trendy shoes that resonate with contemporary boys and girls who actively follow fashion trends and value expressing their individuality through their choice of footwear.
- Date Created: 29 05 2023
- Last Modification Date: 11 08 2023
- Netlify URL (Deployed site): https://cobblr-store.netlify.app/
Authors
- Sagar Paresh Shah (B00930009) - Full Stack Developer
- Jayant Patidar (B00934519) - Full Stack Developer
- Pratik Mukund Parmar (B00934515) - Full Stack Developer
- Ashish Ojha (B00931967) - Full Stack Developer
- Aayush Yogesh Pandya (B00939670) - Full Stack Developer
- Sahil Dilip Dalvi (B00939343) - Full Stack Developer
Deployment
Getting started
- The following command has been used to create the React app with boilerplate code:
npx create-react-app cobblr
Pre-requisites
- Download and install Node.js
- Clone this repository.
- To run this on the local server:
- Comment the following lines in
frontend/src/App.js:axios.defaults.baseURL = process.env.REACT_APP_API_BASEURL; axios.defaults.headers.common["Access-Control-Allow-Origin"] = "*";
- Comment the following lines in
- Uncomment the following line:
axios.defaults.baseURL = process.env.REACT_APP_API_BASEURL_LOCALHOST;
- Uncomment the following line:
- Comment the following lines in
backend/functions/index.js:app.use("/.netlify/functions/index", router); app.get("/.netlify/functions/index/health-check", healthCheck);
- Comment the following lines in
- Uncomment the following line:
app.use("/", router); app.get("/health-check", healthCheck);
- Uncomment the following line:
- Note that you will have to check the
.envfile infrontendfolder andbackend/functions/app/config/index.jsfile inbackendfolder to update with your settings. - Type the following commands after opening this folder and navigating to
frontendandbackendin VSCode:npm installnpm start
Frontend and Backend Deployment
- The frontend and backend has been deployed to Netlify.
- This deployment is supported via CI/CD on the main branch and YML file can be found at
.gitlab-ci.yml.
Built With
- React - Web framework
- React Material UI - Web Component Library
- React Router DOM - Library for routing through different pages
- Node.js - Open source runtime environment
- Express.js - Node.js web application framework that provides HTTP utility methods and middleware for creating a robust API
- Mongoose - Object mapping package between MongoDB and Backend schema
- Mongodb- Data storage
Sources Used
frontend/src/views/AdditionalProductDetail/index.js
frontend/src/views/Admin/AvailableQuantitiesModal.js
frontend/src/views/Admin/ImageModal.js
frontend/src/views/Admin/index.js
frontend/src/views/BillingDetails/index.js
frontend/src/views/ContactUs/ContactUs.js
frontend/src/views/CustomerReviews/DisplayReviews.js
frontend/src/views/ForgotPassword/index.js
frontend/src/views/FAQ/index.js
frontend/src/views/HomePage/Footer.js
frontend/src/views/HomePage/index.js
frontend/src/views/HomePage/MyCarousel.js
frontend/src/views/HomePage/shop.js
frontend/src/views/Login/index.js
frontend/src/views/OrderConfirmation/index.js
frontend/src/views/Payment/PaymentPage.js
frontend/src/views/ProductDetail/index.js
frontend/src/views/Profile/index.js
frontend/src/views/Register/index.js
frontend/src/views/ShoppingCart/index.js
frontend/src/views/SimilarProducts/index.js
frontend/src/views/Stores/index.js
frontend/src/views/Wishlist/index.js
<Accordion></Accordion>
<AccordionSummary></AccordionSummary>
<AccordionDetails></AccordionDetails>
<Alert></Alert>
<Box></Box>
<Button></Button>
<Container></Container>
<Card></Card>
<CardActions></CardActions>
<CardContent></CardContent>
<CardMedia></CardMedia>
<Carousel></Carousel>
<Chip></Chip>
<Col></Col>
<Dialog></Dialog>
<DialogActions></DialogActions>
<DialogTitle></DialogTitle>
<DialogContent></DialogContent>
<Dropdown></Dropdown>
<Grid></Grid>
<Link></Link>
<List></List>
<Modal></Modal>
<Navbar></Navbar>
<Paper></Paper>
<RadioGroup></RadioGroup>
<Row></Row>
<Snackbar></Snackbar>
<Select></Select>
<ToastContainer></ToastContainer>
<Toast></Toast>
<TextField></TextField>
<Typography></Typography>
- The above tags (CSS components) in React MUI were implemented in their official documentation.
- React MUI's Code was used as a CSS framework and a reference to understand how to implement different elements such as Button, Grid, TextField, Card, Snackbar, and Alert on the UI in React.
- React MUI's component code was heavily modified by adding custom logic, styling, onChange and onClick behaviors and have been used at multiple instances in the sources mentioned above.
- Material UI template was referred for login and sign up pages and modified according to our needs.
frontend/src/views/Payment/index.js
Lines 9 - 20
const PaymentContainer = () => {
const location = useLocation();
const params = location.state?.params;
return (
<>
<Elements stripe={stripePromise}>
<PaymentPage details={params} />
</Elements>
<Footer />
</>
);
- The above code has been adapted from Stripe which is implemented in their official documentation.
- Stripe's code was used as a reference to understand on how to integrate stripe payment gateway in our application in React.
- Stripe's code was modified by writing the custom template as per the requirements.
backend/app/components/filter/filter.route.js
Lines 13 - 18
router
.route("/filterShoes")
.post(
validate(filterValidation.filterShoes),
filterController.filterShoes.bind(filterController)
);
The code above was created by adapting the code in MDN Web Docs as shown below:
// Home page route.
router.get("/", function (req, res) {
res.send("Wiki home page");
});
- The code for Routing was implemented in MDN Web Docs Example.
- Routing's Code was used to get reference on how to implement routing in node and express.
- Routing's Code was modified by adding custom routing logic.
backend/app/components/shoes/shoes.model.js
Lines 4 - 24
const Shoe = new Schema(
{
code: { type: String, required: true, unique: true },
name: { type: String, required: true },
subText: { type: String, required: true },
shortDescription: { type: String, required: true },
price: { type: Number, required: true },
color: { type: String, required: true },
availableQuantity: [{ size: String, quantity: Number }],
images: [{ name: String, data: String }],
briefDescription: { type: String, required: true },
brand: { type: String, required: true },
tags: [String],
category: { type: String, required: true },
gender: { type: String, required: true },
type: { type: String, required: true },
material: { type: String, required: true },
availability: { type: Boolean, required: true },
},
{ timestamps: true }
);
- The above schema has been adapted from Mongoose Schemas which is implemented in their official documentation.
- Mongoose Schemas's code was used as a reference to understand on how to implement schemas in MongoDB.
- Mongoose Schemas's code was modified by writing the custom schema as per the requirements.
backend/app/components/shoes/shoes.validation.js
Lines 5 - 26
const validationSchema = {
_id: Joi.string().min(1).required(),
_ids: Joi.array().items(Joi.string()),
code: Joi.string().min(1).required(),
name: Joi.string().min(3).max(100).required(),
subText: Joi.string().min(3).required(),
shortDescription: Joi.string().min(3).required(),
price: Joi.number().min(3).max(10).required(),
color: Joi.string().min(1).max(100).required(),
thumbnail: Joi.string().min(3),
sizes: Joi.array().items(Joi.string()),
quantity: Joi.array().items(Joi.number()),
images: Joi.array().items(Joi.string()),
briefDescription: Joi.string().min(3).required(),
brand: Joi.string().min(3),
tags: Joi.array().items(Joi.string()),
category: Joi.string().min(1).required(),
gender: Joi.string().min(1).required(),
type: Joi.string().min(1).required(),
material: Joi.string().min(1).required(),
availability: Joi.boolean().required(),
sortValue: Joi.string()
.valid("sort1", "sort2", "sort3")
.default("sort1")
.required(),
selectedFilters: Joi.object().pattern(/^.*$/, Joi.string()),
currentPage: Joi.number().default(1).optional(),
searchKeyword: Joi.string().allow("", null).optional(),
pageChangeType: Joi.string().allow("", null).optional(),
};
- The above validation schema has been adapted from JOI which is implemented in their official documentation.
- JOI's code was used as a reference to understand on how to implement validation on API request bodies.
- JOI's code was modified by writing the custom validation schema as per the requirements.
backend/app/components/wishlist/wishlist.validation.js
const validationSchema = {
_id: Joi.string().min(1).required(),
};
- The above validation schema has been adapted from JOI documentation.
- Swiper - Effect coverflow has been used for the carrousel on the homepage
- Mongoose Schemas's code was used as a reference to understand on how to implement schemas in MongoDB.
- JOI's code was used as a reference to understand on how to implement validation on API request bodies.
Additional packages
- Framer Motion was used to animate the transitions between pages.
- React Responsive Carousel was used to implement customizable carousel component.
- React Router DOM was used for navigation.
- React Icons were used for the icons.
- Swiper was used for carrousel.
- jsPDF was used to generate PDF for invoices to be downloaded by the customer.
- React Google Maps was used to integrate maps into store locator.
- React Stripe JS was used to integrate Stripe payment gateway as library components.
- Stripe JS was used to integrate utility modules of the Stripe components.
- Bcrypt was used for password hashing.
- Sendgrid/mail was used to send mail for password reset.
Images
- Nike
- FAQ Image
- Contact Image
- Profile Image
- Home Page - Sneaker Swap
- Home Page - Freepik
- Home Page - Dribble
Icons
All icons are adapted from React Material Icons Library
Acknowledgement
The UI has been inspired from Nike