Skip to content

A MERN stack web app for everyone to share their backyard crops

Notifications You must be signed in to change notification settings

cyruscsc/yardgrown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YardGrown Documentation

Tech Stack

Back-End

  • Node.js, Express.js
  • MongoDB, Mongoose

Front-End

  • React, Redux
  • Tailwind CSS

Database Structure

This project uses MongoDB as the back-end database. There are two collections, User and Listing. As one user can have multiple listings, the _id field of a user is stored as the userRef in a listing to establish the relationship.

All images are stored in Firebase storage, and the correspondent urls are stored in the MongoDB collections as strings.

Schema Design

YardGrown Schema Design

User Authentication

The YardGrown app uses cookie-based JSON Web Token (JWT) and Google Firebase authentication.

  • Auth controller functions: /server/controllers/auth.controller.js

API Endpoints

Authentication

Method Endpoint Parameter
POST /api/auth/sign-up username, email, password
POST /api/auth/sign-in email
password
GET /api/auth/sign-out none
POST /api/auth/google displayName
email
avatar

User

Method Endpoint Parameter
POST /api/user/update/:id username, email, password, avatar
DELETE /api/user/delete/:id none
GET /api/user/listings/:id none

Listing

Method Endpoint Parameter
GET /api/listing/retrieve query string
GET /api/listing/retrieve/:id none
POST /api/listing/create form data
POST /api/listing/update/:id form data
DELETE /api/listing/delete/:id none

Query string

  • keywords: string
  • category: string
  • city: string
  • delivery: boolean
  • pickup: boolean
  • sort: 'createdAt' or 'price'
  • order: 'asc' of 'desc'
  • limit: number
  • startIndex: number

Form data

  • title: string
  • description: string
  • category: string
  • price: number
  • delivery: boolean
  • pickup: boolean
  • city: string
  • email: string
  • imageUrls: string[]

UI Design

Colours

Background Core Accent Special
#FDFAF6 #FDFAF6 #ABC4AA #ABC4AA #ABC4AA #C4D5C3 #C2BEB9 #C2BEB9
#FFFFFF #FFFFFF #FAF1E6 #FAF1E6 #778977 #778977 #D57E7E #D57E7E
#A9907E #A9907E #F3DEBA #F3DEBA
#675D50 #675D50

Typefaces

Usage Family Style Size
Display title Quicksand medium 30px
Card title Quicksand bold 18px
Button text Quicksand medium 16px
Paragraph text Quicksand regular 16px
Footer text Quicksand light 14px

Pages

Path Page
/ home page
/about about YardGrown
/market all listings
/lsiting/:id a single listing
/mylistings/:id all listings of a user
/create-listing create a new listing
/edit-listing edit an existing listing
/profile/:id profile of an user
/sign-up sign up page
/sign-in sign in page